| Index: chrome/test/in_process_browser_test.cc
|
| ===================================================================
|
| --- chrome/test/in_process_browser_test.cc (revision 66188)
|
| +++ chrome/test/in_process_browser_test.cc (working copy)
|
| @@ -139,7 +139,54 @@
|
| // Allow subclasses the opportunity to make changes to the command line before
|
| // running any tests.
|
| SetUpCommandLine(command_line);
|
| + // Add command line arguments that are used by all InProcessBrowserTests.
|
| + PrepareTestCommandLine(command_line);
|
|
|
| + // Save the single process mode state before it was reset in this test. This
|
| + // state will be recovered in TearDown(). Single-process mode is not set in
|
| + // BrowserMain so it needs to be processed explicitly.
|
| + original_single_process_ = RenderProcessHost::run_renderer_in_process();
|
| + if (command_line->HasSwitch(switches::kSingleProcess))
|
| + RenderProcessHost::set_run_renderer_in_process(true);
|
| +
|
| +#if defined(OS_CHROMEOS)
|
| + chromeos::CrosLibrary::Get()->GetTestApi()->SetUseStubImpl();
|
| +
|
| + // Make sure that the log directory exists.
|
| + FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName();
|
| + file_util::CreateDirectory(log_dir);
|
| +#endif // defined(OS_CHROMEOS)
|
| +
|
| + SandboxInitWrapper sandbox_wrapper;
|
| + MainFunctionParams params(*command_line, sandbox_wrapper, NULL);
|
| + params.ui_task =
|
| + NewRunnableMethod(this, &InProcessBrowserTest::RunTestOnMainThreadLoop);
|
| +
|
| + host_resolver_ = new net::RuleBasedHostResolverProc(
|
| + new IntranetRedirectHostResolverProc(NULL));
|
| +
|
| + // Something inside the browser does this lookup implicitly. Make it fail
|
| + // to avoid external dependency. It won't break the tests.
|
| + host_resolver_->AddSimulatedFailure("*.google.com");
|
| +
|
| + // See http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol
|
| + // We don't want the test code to use it.
|
| + host_resolver_->AddSimulatedFailure("wpad");
|
| +
|
| + net::ScopedDefaultHostResolverProc scoped_host_resolver_proc(
|
| + host_resolver_.get());
|
| +
|
| + SetUpInProcessBrowserTestFixture();
|
| +
|
| + BrowserMain(params);
|
| + TearDownInProcessBrowserTestFixture();
|
| +}
|
| +
|
| +void InProcessBrowserTest::PrepareTestCommandLine(
|
| + CommandLine* command_line) {
|
| + // Propagate commandline settings from test_launcher_utils.
|
| + test_launcher_utils::PrepareBrowserCommandLineForTests(command_line);
|
| +
|
| #if defined(OS_WIN)
|
| // Hide windows on show.
|
| if (!command_line->HasSwitch(kUnitTestShowWindows) && !show_window_)
|
| @@ -152,12 +199,6 @@
|
| // This is a Browser test.
|
| command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType);
|
|
|
| - // Single-process mode is not set in BrowserMain so it needs to be processed
|
| - // explicitly.
|
| - original_single_process_ = RenderProcessHost::run_renderer_in_process();
|
| - if (command_line->HasSwitch(switches::kSingleProcess))
|
| - RenderProcessHost::set_run_renderer_in_process(true);
|
| -
|
| #if defined(OS_WIN)
|
| // The Windows sandbox requires that the browser and child processes are the
|
| // same binary. So we launch browser_process.exe which loads chrome.dll
|
| @@ -184,40 +225,6 @@
|
| // 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();
|
| -
|
| - // Make sure that the log directory exists.
|
| - FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName();
|
| - file_util::CreateDirectory(log_dir);
|
| -#endif // defined(OS_CHROMEOS)
|
| -
|
| - SandboxInitWrapper sandbox_wrapper;
|
| - MainFunctionParams params(*command_line, sandbox_wrapper, NULL);
|
| - params.ui_task =
|
| - NewRunnableMethod(this, &InProcessBrowserTest::RunTestOnMainThreadLoop);
|
| -
|
| - host_resolver_ = new net::RuleBasedHostResolverProc(
|
| - new IntranetRedirectHostResolverProc(NULL));
|
| -
|
| - // Something inside the browser does this lookup implicitly. Make it fail
|
| - // to avoid external dependency. It won't break the tests.
|
| - host_resolver_->AddSimulatedFailure("*.google.com");
|
| -
|
| - // See http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol
|
| - // We don't want the test code to use it.
|
| - host_resolver_->AddSimulatedFailure("wpad");
|
| -
|
| - net::ScopedDefaultHostResolverProc scoped_host_resolver_proc(
|
| - host_resolver_.get());
|
| -
|
| - SetUpInProcessBrowserTestFixture();
|
| -
|
| - BrowserMain(params);
|
| - TearDownInProcessBrowserTestFixture();
|
| }
|
|
|
| bool InProcessBrowserTest::CreateUserDataDirectory() {
|
|
|