diff options
-rw-r--r-- | chrome/test/base/chrome_test_launcher.cc | 18 | ||||
-rw-r--r-- | content/public/test/test_launcher.h | 4 | ||||
-rw-r--r-- | content/test/content_test_launcher.cc | 10 | ||||
-rw-r--r-- | content/test/test_launcher.cc | 44 |
4 files changed, 38 insertions, 38 deletions
diff --git a/chrome/test/base/chrome_test_launcher.cc b/chrome/test/base/chrome_test_launcher.cc index 23054a5..6318ef4 100644 --- a/chrome/test/base/chrome_test_launcher.cc +++ b/chrome/test/base/chrome_test_launcher.cc @@ -32,18 +32,15 @@ #include "ui/views/focus/accelerator_handler.h" #endif +const char kEmptyTestName[] = "InProcessBrowserTest.Empty"; + class ChromeTestLauncherDelegate : public test_launcher::TestLauncherDelegate { public: - ChromeTestLauncherDelegate() { - } - - virtual ~ChromeTestLauncherDelegate() { - } + ChromeTestLauncherDelegate() {} + virtual ~ChromeTestLauncherDelegate() {} - virtual void EarlyInitialize() OVERRIDE { -#if defined(OS_MACOSX) - chrome_browser_application_mac::RegisterBrowserCrApp(); -#endif + virtual std::string GetEmptyTestName() OVERRIDE { + return kEmptyTestName; } virtual bool Run(int argc, char** argv, int* return_code) OVERRIDE { @@ -146,6 +143,9 @@ class ChromeTestLauncherDelegate : public test_launcher::TestLauncherDelegate { }; int main(int argc, char** argv) { +#if defined(OS_MACOSX) + chrome_browser_application_mac::RegisterBrowserCrApp(); +#endif ChromeTestLauncherDelegate launcher_delegate; return test_launcher::LaunchTests(&launcher_delegate, argc, argv); } diff --git a/content/public/test/test_launcher.h b/content/public/test/test_launcher.h index 1f7cdac..d0859bb 100644 --- a/content/public/test/test_launcher.h +++ b/content/public/test/test_launcher.h @@ -5,6 +5,8 @@ #ifndef CONTENT_PUBLIC_TEST_TEST_LAUNCHER_H_ #define CONTENT_PUBLIC_TEST_TEST_LAUNCHER_H_ +#include <string> + #include "base/basictypes.h" #include "base/compiler_specific.h" @@ -30,7 +32,7 @@ extern const char kWarmupFlag[]; class TestLauncherDelegate { public: - virtual void EarlyInitialize() = 0; + virtual std::string GetEmptyTestName() = 0; virtual bool Run(int argc, char** argv, int* return_code) = 0; virtual int RunTestSuite(int argc, char** argv) = 0; virtual bool AdjustChildProcessCommandLine(CommandLine* command_line) = 0; diff --git a/content/test/content_test_launcher.cc b/content/test/content_test_launcher.cc index d5b9c8f..e9dc6a3 100644 --- a/content/test/content_test_launcher.cc +++ b/content/test/content_test_launcher.cc @@ -87,13 +87,11 @@ class ContentBrowserTestSuite : public ContentTestSuiteBase { class ContentTestLauncherDelegate : public test_launcher::TestLauncherDelegate { public: - ContentTestLauncherDelegate() { - } - - virtual ~ContentTestLauncherDelegate() { - } + ContentTestLauncherDelegate() {} + virtual ~ContentTestLauncherDelegate() {} - virtual void EarlyInitialize() OVERRIDE { + virtual std::string GetEmptyTestName() OVERRIDE { + return std::string(); } virtual bool Run(int argc, char** argv, int* return_code) OVERRIDE { diff --git a/content/test/test_launcher.cc b/content/test/test_launcher.cc index 47ce759..9b6d449 100644 --- a/content/test/test_launcher.cc +++ b/content/test/test_launcher.cc @@ -57,8 +57,6 @@ const FilePath::CharType kDefaultOutputFile[] = FILE_PATH_LITERAL( // Quit test execution after this number of tests has timed out. const int kMaxTimeouts = 5; // 45s timeout * (5 + 1) = 270s max run time. -const char kEmptyTestName[] = "InProcessBrowserTest.Empty"; - namespace { // Parses the environment variable var as an Int32. If it is unset, returns @@ -444,9 +442,9 @@ bool RunTests(TestLauncherDelegate* launcher_delegate, test_name.append("."); test_name.append(test_info->name()); - // Skip our special test so it's not run twice. That confuses - // the log parser. - if (test_name == kEmptyTestName) + // Skip our special test so it's not run twice. That confuses the log + // parser. + if (test_name == launcher_delegate->GetEmptyTestName()) continue; // Skip disabled tests. @@ -579,7 +577,6 @@ int LaunchTests(TestLauncherDelegate* launcher_delegate, char** argv) { DCHECK(!g_launcher_delegate); g_launcher_delegate = launcher_delegate; - launcher_delegate->EarlyInitialize(); CommandLine::Init(argc, argv); const CommandLine* command_line = CommandLine::ForCurrentProcess(); @@ -630,22 +627,25 @@ int LaunchTests(TestLauncherDelegate* launcher_delegate, TestTimeouts::Initialize(); int exit_code = 0; - // Make sure the entire browser code is loaded into memory. Reading it - // from disk may be slow on a busy bot, and can easily exceed the default - // timeout causing flaky test failures. Use an empty test that only starts - // and closes a browser with a long timeout to avoid those problems. - // NOTE: We don't do this when specifying a filter because this slows down the - // common case of running one test locally, and also on trybots when sharding - // as this one test runs ~200 times and wastes a few minutes. - bool warmup = command_line->HasSwitch(kWarmupFlag); - bool has_filter = command_line->HasSwitch(kGTestFilterFlag); - if (warmup || (!should_shard && !has_filter)) { - exit_code = RunTest(launcher_delegate, - kEmptyTestName, - TestTimeouts::large_test_timeout(), - NULL); - if (exit_code != 0 || warmup) - return exit_code; + std::string empty_test = launcher_delegate->GetEmptyTestName(); + if (!empty_test.empty()) { + // Make sure the entire browser code is loaded into memory. Reading it + // from disk may be slow on a busy bot, and can easily exceed the default + // timeout causing flaky test failures. Use an empty test that only starts + // and closes a browser with a long timeout to avoid those problems. + // NOTE: We don't do this when specifying a filter because this slows down + // the common case of running one test locally, and also on trybots when + // sharding as this one test runs ~200 times and wastes a few minutes. + bool warmup = command_line->HasSwitch(kWarmupFlag); + bool has_filter = command_line->HasSwitch(kGTestFilterFlag); + if (warmup || (!should_shard && !has_filter)) { + exit_code = RunTest(launcher_delegate, + empty_test, + TestTimeouts::large_test_timeout(), + NULL); + if (exit_code != 0 || warmup) + return exit_code; + } } int cycles = 1; |