| 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 command_line->AppendSwitch(switches::kNoFirstRun); | 104 command_line->AppendSwitch(switches::kNoFirstRun); |
| 105 | 105 |
| 106 // Single-process mode is not set in BrowserMain so it needs to be processed | 106 // Single-process mode is not set in BrowserMain so it needs to be processed |
| 107 // explicitlty. | 107 // explicitlty. |
| 108 original_single_process_ = RenderProcessHost::run_renderer_in_process(); | 108 original_single_process_ = RenderProcessHost::run_renderer_in_process(); |
| 109 if (command_line->HasSwitch(switches::kSingleProcess)) | 109 if (command_line->HasSwitch(switches::kSingleProcess)) |
| 110 RenderProcessHost::set_run_renderer_in_process(true); | 110 RenderProcessHost::set_run_renderer_in_process(true); |
| 111 | 111 |
| 112 // Explicitly set the path of the exe used for the renderer and plugin, | 112 // Explicitly set the path of the exe used for the renderer and plugin, |
| 113 // otherwise they'll try to use unit_test.exe. | 113 // otherwise they'll try to use unit_test.exe. |
| 114 std::wstring subprocess_path; | 114 FilePath subprocess_path; |
| 115 PathService::Get(base::FILE_EXE, &subprocess_path); | 115 PathService::Get(base::FILE_EXE, &subprocess_path); |
| 116 FilePath fp_subprocess_path = FilePath::FromWStringHack(subprocess_path); | 116 subprocess_path = subprocess_path.DirName(); |
| 117 subprocess_path = fp_subprocess_path.DirName().ToWStringHack(); | 117 subprocess_path = subprocess_path.AppendASCII(WideToASCII( |
| 118 file_util::AppendToPath(&subprocess_path, | 118 chrome::kBrowserProcessExecutablePath)); |
| 119 chrome::kBrowserProcessExecutablePath); | |
| 120 command_line->AppendSwitchWithValue(switches::kBrowserSubprocessPath, | 119 command_line->AppendSwitchWithValue(switches::kBrowserSubprocessPath, |
| 121 subprocess_path); | 120 subprocess_path.ToWStringHack()); |
| 122 | 121 |
| 123 // Enable warning level logging so that we can see when bad stuff happens. | 122 // Enable warning level logging so that we can see when bad stuff happens. |
| 124 command_line->AppendSwitch(switches::kEnableLogging); | 123 command_line->AppendSwitch(switches::kEnableLogging); |
| 125 command_line->AppendSwitchWithValue(switches::kLoggingLevel, | 124 command_line->AppendSwitchWithValue(switches::kLoggingLevel, |
| 126 IntToWString(1)); // warning | 125 IntToWString(1)); // warning |
| 127 | 126 |
| 128 SandboxInitWrapper sandbox_wrapper; | 127 SandboxInitWrapper sandbox_wrapper; |
| 129 MainFunctionParams params(*command_line, sandbox_wrapper, NULL); | 128 MainFunctionParams params(*command_line, sandbox_wrapper, NULL); |
| 130 params.ui_task = | 129 params.ui_task = |
| 131 NewRunnableMethod(this, &InProcessBrowserTest::RunTestOnMainThreadLoop); | 130 NewRunnableMethod(this, &InProcessBrowserTest::RunTestOnMainThreadLoop); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 NewRunnableMethod(this, &InProcessBrowserTest::TimedOut), | 256 NewRunnableMethod(this, &InProcessBrowserTest::TimedOut), |
| 258 kSubsequentTimeoutInMS); | 257 kSubsequentTimeoutInMS); |
| 259 | 258 |
| 260 MessageLoopForUI::current()->Quit(); | 259 MessageLoopForUI::current()->Quit(); |
| 261 } | 260 } |
| 262 | 261 |
| 263 void InProcessBrowserTest::SetInitialTimeoutInMS(int timeout_value) { | 262 void InProcessBrowserTest::SetInitialTimeoutInMS(int timeout_value) { |
| 264 DCHECK_GT(timeout_value, 0); | 263 DCHECK_GT(timeout_value, 0); |
| 265 initial_timeout_ = timeout_value; | 264 initial_timeout_ = timeout_value; |
| 266 } | 265 } |
| OLD | NEW |