summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-19 22:13:08 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-19 22:13:08 +0000
commitf93ae60203dd5c83aefbd1d0881e05639aa50780 (patch)
treef60bc8c09d994663e1afaab0f4583e67e3bcc465 /content
parent759e69acff6343087c743aab9a8299ae028c646d (diff)
downloadchromium_src-f93ae60203dd5c83aefbd1d0881e05639aa50780.zip
chromium_src-f93ae60203dd5c83aefbd1d0881e05639aa50780.tar.gz
chromium_src-f93ae60203dd5c83aefbd1d0881e05639aa50780.tar.bz2
InProcessBrowserTest.Empty is only valid for browser_tests, so ask the test delegate whether they have an empty test or not and get the test name then. Also get rid of the EarlyInitialize function since it's called right in the beginning, and the delegate can just do that work before calling TestLauncher.
BUG=90448 Review URL: https://chromiumcodereview.appspot.com/10807043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147549 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/public/test/test_launcher.h4
-rw-r--r--content/test/content_test_launcher.cc10
-rw-r--r--content/test/test_launcher.cc44
3 files changed, 29 insertions, 29 deletions
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;