| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/test/in_process_browser_test.h" | 5 #include "chrome/test/in_process_browser_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // For some reason the sandbox wasn't happy running in test mode. These | 104 // For some reason the sandbox wasn't happy running in test mode. These |
| 105 // tests aren't intended to test the sandbox, so we turn it off. | 105 // tests aren't intended to test the sandbox, so we turn it off. |
| 106 command_line->AppendSwitch(switches::kNoSandbox); | 106 command_line->AppendSwitch(switches::kNoSandbox); |
| 107 | 107 |
| 108 // Single-process mode is not set in BrowserMain so it needs to be processed | 108 // Single-process mode is not set in BrowserMain so it needs to be processed |
| 109 // explicitlty. | 109 // explicitlty. |
| 110 original_single_process_ = RenderProcessHost::run_renderer_in_process(); | 110 original_single_process_ = RenderProcessHost::run_renderer_in_process(); |
| 111 if (command_line->HasSwitch(switches::kSingleProcess)) | 111 if (command_line->HasSwitch(switches::kSingleProcess)) |
| 112 RenderProcessHost::set_run_renderer_in_process(true); | 112 RenderProcessHost::set_run_renderer_in_process(true); |
| 113 | 113 |
| 114 // Explicitly set the path of the exe used for the renderer, otherwise it'll | 114 // Explicitly set the path of the exe used for the renderer and plugin, |
| 115 // try to use unit_test.exe. | 115 // otherwise they'll try to use unit_test.exe. |
| 116 std::wstring renderer_path; | 116 std::wstring subprocess_path; |
| 117 PathService::Get(base::FILE_EXE, &renderer_path); | 117 PathService::Get(base::FILE_EXE, &subprocess_path); |
| 118 FilePath fp_renderer_path = FilePath::FromWStringHack(renderer_path); | 118 FilePath fp_subprocess_path = FilePath::FromWStringHack(subprocess_path); |
| 119 renderer_path = fp_renderer_path.DirName().ToWStringHack(); | 119 subprocess_path = fp_subprocess_path.DirName().ToWStringHack(); |
| 120 file_util::AppendToPath(&renderer_path, | 120 file_util::AppendToPath(&subprocess_path, |
| 121 chrome::kBrowserProcessExecutablePath); | 121 chrome::kBrowserProcessExecutablePath); |
| 122 command_line->AppendSwitchWithValue(switches::kRendererPath, renderer_path); | 122 command_line->AppendSwitchWithValue(switches::kBrowserSubprocessPath, |
| 123 subprocess_path); |
| 123 | 124 |
| 124 sandbox::SandboxInterfaceInfo sandbox_info = {0}; | 125 sandbox::SandboxInterfaceInfo sandbox_info = {0}; |
| 125 SandboxInitWrapper sandbox_wrapper; | 126 SandboxInitWrapper sandbox_wrapper; |
| 126 MainFunctionParams params(*command_line, sandbox_wrapper, NULL); | 127 MainFunctionParams params(*command_line, sandbox_wrapper, NULL); |
| 127 params.ui_task = | 128 params.ui_task = |
| 128 NewRunnableMethod(this, &InProcessBrowserTest::RunTestOnMainThreadLoop); | 129 NewRunnableMethod(this, &InProcessBrowserTest::RunTestOnMainThreadLoop); |
| 129 | 130 |
| 130 scoped_refptr<net::RuleBasedHostMapper> host_mapper( | 131 scoped_refptr<net::RuleBasedHostMapper> host_mapper( |
| 131 new net::RuleBasedHostMapper()); | 132 new net::RuleBasedHostMapper()); |
| 132 ConfigureHostMapper(host_mapper.get()); | 133 ConfigureHostMapper(host_mapper.get()); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 MessageLoopForUI::current()->Quit(); | 222 MessageLoopForUI::current()->Quit(); |
| 222 } | 223 } |
| 223 | 224 |
| 224 void InProcessBrowserTest::ConfigureHostMapper( | 225 void InProcessBrowserTest::ConfigureHostMapper( |
| 225 net::RuleBasedHostMapper* host_mapper) { | 226 net::RuleBasedHostMapper* host_mapper) { |
| 226 host_mapper->AllowDirectLookup("*.google.com"); | 227 host_mapper->AllowDirectLookup("*.google.com"); |
| 227 // See http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol | 228 // See http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol |
| 228 // We don't want the test code to use it. | 229 // We don't want the test code to use it. |
| 229 host_mapper->AddSimulatedFailure("wpad"); | 230 host_mapper->AddSimulatedFailure("wpad"); |
| 230 } | 231 } |
| OLD | NEW |