diff options
author | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-27 04:58:51 +0000 |
---|---|---|
committer | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-27 04:58:51 +0000 |
commit | b1d1c87e0639f237d9d19a4f3bc599a00121b89f (patch) | |
tree | 31412abf6ee463d1bd6ba743530479343a759659 /base | |
parent | 6ebe3fc0530639459b70413724db71f734c99422 (diff) | |
download | chromium_src-b1d1c87e0639f237d9d19a4f3bc599a00121b89f.zip chromium_src-b1d1c87e0639f237d9d19a4f3bc599a00121b89f.tar.gz chromium_src-b1d1c87e0639f237d9d19a4f3bc599a00121b89f.tar.bz2 |
Fix the net_perftests to work again.
Since only one test needed a MessageLoop, I decided to only give that single test a MessageLoop. I used a MessageLoopForIO (subclass of MessageLoop) for future use when the disk cache leverages MessageLoopForIO for asynchronous IO.
TBR=rvargas
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1428 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/run_all_perftests.cc | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/base/run_all_perftests.cc b/base/run_all_perftests.cc index 8e62c53..967aeb9 100644 --- a/base/run_all_perftests.cc +++ b/base/run_all_perftests.cc @@ -4,32 +4,39 @@ #include <windows.h> -#include "base/at_exit.h" #include "base/command_line.h" #include "base/perftimer.h" #include "base/string_util.h" #include "base/test_suite.h" +class PerfTestSuite : public TestSuite { + public: + PerfTestSuite(int argc, char** argv) : TestSuite(argc, argv) { + } + + virtual void Initialize() { + // Initialize the perf timer log + std::string log_file = + WideToUTF8(CommandLine().GetSwitchValue(L"log-file")); + if (log_file.empty()) + log_file = "perf_test.log"; + ASSERT_TRUE(InitPerfLog(log_file.c_str())); + + // 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 (!IsDebuggerPresent()) + SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); + + TestSuite::Initialize(); + } + + virtual void Shutdown() { + TestSuite::Shutdown(); + + FinalizePerfLog(); + } +}; + int main(int argc, char** argv) { - // Some tests may use base::Singleton<>, thus we need to instanciate - // the AtExitManager or else we will leak objects. - base::AtExitManager at_exit_manager; - - // Initialize the perf timer log - std::string log_file = - WideToUTF8(CommandLine().GetSwitchValue(L"log-file")); - if (log_file.empty()) - log_file = "perf_test.log"; - ASSERT_TRUE(InitPerfLog(log_file.c_str())); - - // 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 (!IsDebuggerPresent()) - SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); - - int rv = TestSuite(argc, argv).Run(); - - FinalizePerfLog(); - return rv; + return PerfTestSuite(argc, argv).Run(); } - |