diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-30 07:51:26 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-30 07:51:26 +0000 |
commit | 8e930954216a5a4c7795c42cf288376f3fa2e7e2 (patch) | |
tree | 5dc5eac3b29443e4a26775b3e225114bdb5b7a40 /chrome/test | |
parent | 88293c22547209ea3629a54b08fa338dc9da76ad (diff) | |
download | chromium_src-8e930954216a5a4c7795c42cf288376f3fa2e7e2.zip chromium_src-8e930954216a5a4c7795c42cf288376f3fa2e7e2.tar.gz chromium_src-8e930954216a5a4c7795c42cf288376f3fa2e7e2.tar.bz2 |
Extract common browser command-line flags used by tests.
This will help avoiding adding a required flag to ui_tests but not browser_tests
and vice versa.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3565003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/in_process_browser_test.cc | 15 | ||||
-rw-r--r-- | chrome/test/test_launcher_utils.cc | 21 | ||||
-rw-r--r-- | chrome/test/test_launcher_utils.h | 6 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.cc | 10 |
4 files changed, 31 insertions, 21 deletions
diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc index ad26580..a930da2 100644 --- a/chrome/test/in_process_browser_test.cc +++ b/chrome/test/in_process_browser_test.cc @@ -147,17 +147,8 @@ void InProcessBrowserTest::SetUp() { if (dom_automation_enabled_) command_line->AppendSwitch(switches::kDomAutomationController); - // Turn off tip loading for tests; see http://crbug.com/17725 - command_line->AppendSwitch(switches::kDisableWebResources); - - // Turn off preconnects because they break the brittle python webserver. - command_line->AppendSwitch(switches::kDisablePreconnect); - command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); - // Don't show the first run ui. - command_line->AppendSwitch(switches::kNoFirstRun); - // This is a Browser test. command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType); @@ -193,14 +184,12 @@ void InProcessBrowserTest::SetUp() { subprocess_path); #endif - // Enable warning level logging so that we can see when bad stuff happens. - command_line->AppendSwitch(switches::kEnableLogging); - command_line->AppendSwitchASCII(switches::kLoggingLevel, "1"); // warning - // If ncecessary, disable TabCloseableStateWatcher. if (!tab_closeable_state_watcher_enabled_) command_line->AppendSwitch(switches::kDisableTabCloseableStateWatcher); + test_launcher_utils::PrepareBrowserCommandLineForTests(command_line); + #if defined(OS_CHROMEOS) chromeos::CrosLibrary::Get()->GetTestApi()->SetUseStubImpl(); #endif // defined(OS_CHROMEOS) diff --git a/chrome/test/test_launcher_utils.cc b/chrome/test/test_launcher_utils.cc index d5ccd18..3b83861 100644 --- a/chrome/test/test_launcher_utils.cc +++ b/chrome/test/test_launcher_utils.cc @@ -2,14 +2,35 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/command_line.h" #include "base/environment.h" #include "base/path_service.h" #include "base/scoped_ptr.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/chrome_switches.h" #include "chrome/test/test_launcher_utils.h" namespace test_launcher_utils { +void PrepareBrowserCommandLineForTests(CommandLine* command_line) { + // Turn off tip loading for tests; see http://crbug.com/17725 + command_line->AppendSwitch(switches::kDisableWebResources); + + // Turn off preconnects because they break the brittle python webserver. + command_line->AppendSwitch(switches::kDisablePreconnect); + + // Don't show the first run ui. + command_line->AppendSwitch(switches::kNoFirstRun); + + // No default browser check, it would create an info-bar (if we are not the + // default browser) that could conflicts with some tests expectations. + command_line->AppendSwitch(switches::kNoDefaultBrowserCheck); + + // Enable warning level logging so that we can see when bad stuff happens. + command_line->AppendSwitch(switches::kEnableLogging); + command_line->AppendSwitchASCII(switches::kLoggingLevel, "1"); // warning +} + bool OverrideUserDataDir(const FilePath& user_data_dir) { bool success = true; diff --git a/chrome/test/test_launcher_utils.h b/chrome/test/test_launcher_utils.h index e83b519..b4c1ac0 100644 --- a/chrome/test/test_launcher_utils.h +++ b/chrome/test/test_launcher_utils.h @@ -9,9 +9,15 @@ #include "base/compiler_specific.h" #include "base/file_path.h" +class CommandLine; + // A set of utilities for test code that launches separate processes. namespace test_launcher_utils { +// Appends browser switches to provided |command_line| to be used +// when running under tests. +void PrepareBrowserCommandLineForTests(CommandLine* command_line); + // Overrides the current process' user data dir. bool OverrideUserDataDir(const FilePath& user_data_dir) WARN_UNUSED_RESULT; diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index dc2f7b4..71665a5 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -997,12 +997,6 @@ bool UITestBase::LaunchBrowserHelper(const CommandLine& arguments, command_line.AppendArgNative(flags[i]); } - // Turn off preconnects because they break the brittle python webserver. - command_line.AppendSwitch(switches::kDisablePreconnect); - - // No first-run dialogs, please. - command_line.AppendSwitch(switches::kNoFirstRun); - // No default browser check, it would create an info-bar (if we are not the // default browser) that could conflicts with some tests expectations. command_line.AppendSwitch(switches::kNoDefaultBrowserCheck); @@ -1046,8 +1040,6 @@ bool UITestBase::LaunchBrowserHelper(const CommandLine& arguments, command_line.AppendSwitch(switches::kDisableBreakpad); if (!homepage_.empty()) command_line.AppendSwitchASCII(switches::kHomePage, homepage_); - // Don't try to fetch web resources during UI testing. - command_line.AppendSwitch(switches::kDisableWebResources); if (!js_flags_.empty()) command_line.AppendSwitchASCII(switches::kJavaScriptFlags, js_flags_); @@ -1076,6 +1068,8 @@ bool UITestBase::LaunchBrowserHelper(const CommandLine& arguments, // Disable TabCloseableStateWatcher for tests. command_line.AppendSwitch(switches::kDisableTabCloseableStateWatcher); + test_launcher_utils::PrepareBrowserCommandLineForTests(&command_line); + DebugFlags::ProcessDebugFlags( &command_line, ChildProcessInfo::UNKNOWN_PROCESS, false); command_line.AppendArguments(arguments, false); |