summaryrefslogtreecommitdiffstats
path: root/mojo/common
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 20:40:53 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 20:40:53 +0000
commit1477ef4c522c910b5f1933f6ebf095e8d9f4d8d7 (patch)
treeab3cc8b7493be252ddc98797c957ad7a331faac1 /mojo/common
parente3eac422c0cd5db311a567e6137c073b73d9bfaa (diff)
downloadchromium_src-1477ef4c522c910b5f1933f6ebf095e8d9f4d8d7.zip
chromium_src-1477ef4c522c910b5f1933f6ebf095e8d9f4d8d7.tar.gz
chromium_src-1477ef4c522c910b5f1933f6ebf095e8d9f4d8d7.tar.bz2
Mojo: Make a public test_support shared library.
The test runner can then inject dependencies into it (just as we do for system and gles2). This removes public/tests's base dependency. R=sky@chromium.org Review URL: https://codereview.chromium.org/160003007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251115 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/common')
-rw-r--r--mojo/common/test/run_all_perftests.cc4
-rw-r--r--mojo/common/test/run_all_unittests.cc3
-rw-r--r--mojo/common/test/test_support_impl.cc25
-rw-r--r--mojo/common/test/test_support_impl.h30
4 files changed, 61 insertions, 1 deletions
diff --git a/mojo/common/test/run_all_perftests.cc b/mojo/common/test/run_all_perftests.cc
index 9bc4748..3718bf1 100644
--- a/mojo/common/test/run_all_perftests.cc
+++ b/mojo/common/test/run_all_perftests.cc
@@ -3,10 +3,12 @@
// found in the LICENSE file.
#include "base/test/perf_test_suite.h"
+#include "mojo/common/test/test_support_impl.h"
+#include "mojo/public/tests/test_support_private.h"
#include "mojo/system/embedder/embedder.h"
int main(int argc, char** argv) {
mojo::embedder::Init();
+ mojo::test::TestSupport::Init(new mojo::test::TestSupportImpl());
return base::PerfTestSuite(argc, argv).Run();
}
-
diff --git a/mojo/common/test/run_all_unittests.cc b/mojo/common/test/run_all_unittests.cc
index 617ab72..792c2a1 100644
--- a/mojo/common/test/run_all_unittests.cc
+++ b/mojo/common/test/run_all_unittests.cc
@@ -5,12 +5,15 @@
#include "base/bind.h"
#include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h"
+#include "mojo/common/test/test_support_impl.h"
+#include "mojo/public/tests/test_support_private.h"
#include "mojo/system/embedder/embedder.h"
int main(int argc, char** argv) {
base::TestSuite test_suite(argc, argv);
mojo::embedder::Init();
+ mojo::test::TestSupport::Init(new mojo::test::TestSupportImpl());
return base::LaunchUnitTests(
argc, argv, base::Bind(&base::TestSuite::Run,
diff --git a/mojo/common/test/test_support_impl.cc b/mojo/common/test/test_support_impl.cc
new file mode 100644
index 0000000..54c3376
--- /dev/null
+++ b/mojo/common/test/test_support_impl.cc
@@ -0,0 +1,25 @@
+// Copyright 2014 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 "mojo/common/test/test_support_impl.h"
+
+#include "base/test/perf_log.h"
+
+namespace mojo {
+namespace test {
+
+TestSupportImpl::TestSupportImpl() {
+}
+
+TestSupportImpl::~TestSupportImpl() {
+}
+
+void TestSupportImpl::LogPerfResult(const char* test_name,
+ double value,
+ const char* units) {
+ base::LogPerfResult(test_name, value, units);
+}
+
+} // namespace test
+} // namespace mojo
diff --git a/mojo/common/test/test_support_impl.h b/mojo/common/test/test_support_impl.h
new file mode 100644
index 0000000..ca3f58a
--- /dev/null
+++ b/mojo/common/test/test_support_impl.h
@@ -0,0 +1,30 @@
+// Copyright 2014 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.
+
+#ifndef MOJO_COMMON_TEST_TEST_SUPPORT_IMPL_H_
+#define MOJO_COMMON_TEST_TEST_SUPPORT_IMPL_H_
+
+#include "base/macros.h"
+#include "mojo/public/tests/test_support_private.h"
+
+namespace mojo {
+namespace test {
+
+class TestSupportImpl : public TestSupport {
+ public:
+ TestSupportImpl();
+ virtual ~TestSupportImpl();
+
+ virtual void LogPerfResult(const char* test_name,
+ double value,
+ const char* units) OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TestSupportImpl);
+};
+
+} // namespace test
+} // namespace mojo
+
+#endif // MOJO_COMMON_TEST_TEST_SUPPORT_IMPL_H_