summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-10 00:21:35 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-10 00:21:35 +0000
commit99cc51e28aa075dec3a999a406db7d062666321a (patch)
tree33b6032fb47232d1f7aa28ddf03c808085e34e10
parentd41af62c7ed4221f5dfe65e017f5d408493d5001 (diff)
downloadchromium_src-99cc51e28aa075dec3a999a406db7d062666321a.zip
chromium_src-99cc51e28aa075dec3a999a406db7d062666321a.tar.gz
chromium_src-99cc51e28aa075dec3a999a406db7d062666321a.tar.bz2
Move PerfTestSuite implementation into a .cc file and add it to the base
namespace. TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/3695001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62095 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/base.gyp1
-rw-r--r--base/test/perf_test_suite.cc46
-rw-r--r--base/test/perf_test_suite.h44
-rw-r--r--base/test/run_all_perftests.cc2
-rw-r--r--chrome/test/perf/perftests.cc4
-rw-r--r--chrome_frame/test/perf/run_all.cc5
-rw-r--r--ipc/ipc_tests.cc2
-rw-r--r--media/ffmpeg/ffmpeg_unittest.cc2
8 files changed, 63 insertions, 43 deletions
diff --git a/base/base.gyp b/base/base.gyp
index f24279a..1c76ee1 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -253,6 +253,7 @@
'sources': [
'test/multiprocess_test.cc',
'test/multiprocess_test.h',
+ 'test/perf_test_suite.cc',
'test/perf_test_suite.h',
'test/test_file_util.h',
'test/test_file_util_linux.cc',
diff --git a/base/test/perf_test_suite.cc b/base/test/perf_test_suite.cc
new file mode 100644
index 0000000..b787add
--- /dev/null
+++ b/base/test/perf_test_suite.cc
@@ -0,0 +1,46 @@
+// Copyright (c) 2010 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/test/perf_test_suite.h"
+
+#include "base/command_line.h"
+#include "base/debug_util.h"
+#include "base/file_path.h"
+#include "base/path_service.h"
+#include "base/perftimer.h"
+#include "base/process_util.h"
+#include "base/string_util.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace base {
+
+PerfTestSuite::PerfTestSuite(int argc, char** argv) : TestSuite(argc, argv) {
+}
+
+void PerfTestSuite::Initialize() {
+ TestSuite::Initialize();
+
+ // Initialize the perf timer log
+ FilePath log_path =
+ CommandLine::ForCurrentProcess()->GetSwitchValuePath("log-file");
+ if (log_path.empty()) {
+ FilePath exe;
+ PathService::Get(base::FILE_EXE, &exe);
+ log_path = exe.ReplaceExtension(FILE_PATH_LITERAL("log"));
+ log_path = log_path.InsertBeforeExtension(FILE_PATH_LITERAL("_perf"));
+ }
+ ASSERT_TRUE(InitPerfLog(log_path));
+
+ // Raise to high priority to have more precise measurements. Since we don't
+ // aim at 1% precision, it is not necessary to run at realtime level.
+ if (!DebugUtil::BeingDebugged())
+ base::RaiseProcessToHighPriority();
+}
+
+void PerfTestSuite::Shutdown() {
+ TestSuite::Shutdown();
+ FinalizePerfLog();
+}
+
+} // namespace base
diff --git a/base/test/perf_test_suite.h b/base/test/perf_test_suite.h
index 37abea6..83d5b37 100644
--- a/base/test/perf_test_suite.h
+++ b/base/test/perf_test_suite.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -6,46 +6,18 @@
#define BASE_TEST_PERF_TEST_SUITE_H_
#pragma once
-#include "base/command_line.h"
-#include "base/debug_util.h"
-#include "base/file_path.h"
-#include "base/path_service.h"
-#include "base/perftimer.h"
-#include "base/process_util.h"
-#include "base/string_util.h"
#include "base/test/test_suite.h"
-#include "testing/gtest/include/gtest/gtest.h"
+
+namespace base {
class PerfTestSuite : public TestSuite {
public:
- PerfTestSuite(int argc, char** argv) : TestSuite(argc, argv) {
- }
-
- virtual void Initialize() {
- TestSuite::Initialize();
-
- // Initialize the perf timer log
- FilePath log_path =
- CommandLine::ForCurrentProcess()->GetSwitchValuePath("log-file");
- if (log_path.empty()) {
- FilePath exe;
- PathService::Get(base::FILE_EXE, &exe);
- log_path = exe.ReplaceExtension(FILE_PATH_LITERAL("log"));
- log_path = log_path.InsertBeforeExtension(FILE_PATH_LITERAL("_perf"));
- }
- ASSERT_TRUE(InitPerfLog(log_path));
+ PerfTestSuite(int argc, char** argv);
- // Raise to high priority to have more precise measurements. Since we don't
- // aim at 1% precision, it is not necessary to run at realtime level.
- if (!DebugUtil::BeingDebugged())
- base::RaiseProcessToHighPriority();
- }
-
- virtual void Shutdown() {
- TestSuite::Shutdown();
-
- FinalizePerfLog();
- }
+ virtual void Initialize();
+ virtual void Shutdown();
};
+} // namespace base
+
#endif // BASE_TEST_PERF_TEST_SUITE_H_
diff --git a/base/test/run_all_perftests.cc b/base/test/run_all_perftests.cc
index 6d0a8ee..2b4c628 100644
--- a/base/test/run_all_perftests.cc
+++ b/base/test/run_all_perftests.cc
@@ -5,5 +5,5 @@
#include "base/test/perf_test_suite.h"
int main(int argc, char** argv) {
- return PerfTestSuite(argc, argv).Run();
+ return base::PerfTestSuite(argc, argv).Run();
}
diff --git a/chrome/test/perf/perftests.cc b/chrome/test/perf/perftests.cc
index 904d44e..d766e39 100644
--- a/chrome/test/perf/perftests.cc
+++ b/chrome/test/perf/perftests.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -7,7 +7,7 @@
#include "chrome/common/chrome_paths.cc"
int main(int argc, char **argv) {
- PerfTestSuite suite(argc, argv);
+ base::PerfTestSuite suite(argc, argv);
chrome::RegisterPathProvider();
MessageLoop main_message_loop;
diff --git a/chrome_frame/test/perf/run_all.cc b/chrome_frame/test/perf/run_all.cc
index a5f4738..26c6e99 100644
--- a/chrome_frame/test/perf/run_all.cc
+++ b/chrome_frame/test/perf/run_all.cc
@@ -1,6 +1,7 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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/platform_thread.h"
#include "base/test/perf_test_suite.h"
#include "base/scoped_ptr.h"
@@ -10,7 +11,7 @@
#include "chrome_frame/utils.h"
int main(int argc, char **argv) {
- PerfTestSuite perf_suite(argc, argv);
+ base::PerfTestSuite perf_suite(argc, argv);
chrome::RegisterPathProvider();
PlatformThread::SetName("ChromeFrame perf tests");
diff --git a/ipc/ipc_tests.cc b/ipc/ipc_tests.cc
index 90be687..a407c70 100644
--- a/ipc/ipc_tests.cc
+++ b/ipc/ipc_tests.cc
@@ -534,7 +534,7 @@ MULTIPROCESS_TEST_MAIN(RunReflector) {
int main(int argc, char** argv) {
#ifdef PERFORMANCE_TEST
- int retval = PerfTestSuite(argc, argv).Run();
+ int retval = base::PerfTestSuite(argc, argv).Run();
#else
int retval = base::TestSuite(argc, argv).Run();
#endif
diff --git a/media/ffmpeg/ffmpeg_unittest.cc b/media/ffmpeg/ffmpeg_unittest.cc
index 14b117d..343486e 100644
--- a/media/ffmpeg/ffmpeg_unittest.cc
+++ b/media/ffmpeg/ffmpeg_unittest.cc
@@ -42,7 +42,7 @@
#include "testing/gtest/include/gtest/gtest.h"
int main(int argc, char** argv) {
- return PerfTestSuite(argc, argv).Run();
+ return base::PerfTestSuite(argc, argv).Run();
}
namespace media {