shell-encryption: Add base test runner for SHELL unit tests
As SHELL tests are going to be always enabled on some bots, it needs to
use base test_runner.
This CL is adding the support of using base test_runner for SHELL.
BUG=chromium:1151230
Change-Id: I4d059d7bc30878013e5058349af8743b2fa0aec5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2560207
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: François Doray <fdoray@chromium.org>
Reviewed-by: Amr Aboelkher <amraboelkher@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Cr-Commit-Position: refs/heads/master@{#832079}
GitOrigin-RevId: 3af4efe76cf2e9996352fba0a1c62281fd9c8a71
diff --git a/BUILD.gn b/BUILD.gn
index 07507f3..f58822e 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -122,7 +122,7 @@
]
}
- source_set("shell_encryption_test") {
+ test("shell_encryption_unittests") {
testonly = true
public_configs = [ ":shell_encryption_config1" ]
configs -= [ "//build/config/compiler:chromium_code" ]
@@ -148,14 +148,12 @@
"src/testing/coefficient_polynomial_test.cc",
"src/testing/protobuf_matchers_test.cc",
"src/transcription_test.cc",
+ "tests/run_all_unittests.cc",
]
deps = [
":shell_encryption_test_library",
- "//testing/gtest:gtest_main",
+ "//base/test:test_support",
+ "//testing/gtest",
]
}
-
- test("shell_encryption_unittests") {
- deps = [ ":shell_encryption_test" ]
- }
}
diff --git a/DEPS b/DEPS
index 1740610..bfe61b6 100644
--- a/DEPS
+++ b/DEPS
@@ -5,6 +5,9 @@
'+glog',
'+prng',
'+testing',
+ # Base test_runner includes.
+ '+base/bind.h',
+ '+base/test',
# The lib will be able to use abseil, but without being imported directly in
# chromium.
'+absl',
diff --git a/tests/run_all_unittests.cc b/tests/run_all_unittests.cc
new file mode 100644
index 0000000..65ed57e
--- /dev/null
+++ b/tests/run_all_unittests.cc
@@ -0,0 +1,14 @@
+// Copyright 2020 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/bind.h"
+#include "base/test/launcher/unit_test_launcher.h"
+#include "base/test/test_suite.h"
+
+int main(int argc, char** argv) {
+ base::TestSuite test_suite(argc, argv);
+ return base::LaunchUnitTests(
+ argc, argv,
+ base::BindOnce(&base::TestSuite::Run, base::Unretained(&test_suite)));
+}