OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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" |
11 #include "base/test/test_file_util.h" | 11 #include "base/test/test_file_util.h" |
12 #include "chrome/browser/browser.h" | 12 #include "chrome/browser/browser.h" |
13 #include "chrome/browser/browser_list.h" | 13 #include "chrome/browser/browser_list.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/browser_shutdown.h" | 15 #include "chrome/browser/browser_shutdown.h" |
16 #include "chrome/browser/browser_window.h" | 16 #include "chrome/browser/browser_window.h" |
| 17 #include "chrome/browser/chrome_thread.h" |
17 #include "chrome/browser/net/url_request_mock_util.h" | 18 #include "chrome/browser/net/url_request_mock_util.h" |
18 #include "chrome/browser/profile.h" | 19 #include "chrome/browser/profile.h" |
19 #include "chrome/browser/profile_manager.h" | 20 #include "chrome/browser/profile_manager.h" |
20 #include "chrome/browser/renderer_host/render_process_host.h" | 21 #include "chrome/browser/renderer_host/render_process_host.h" |
21 #include "chrome/browser/tab_contents/tab_contents.h" | 22 #include "chrome/browser/tab_contents/tab_contents.h" |
22 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
23 #include "chrome/browser/views/frame/browser_view.h" | 24 #include "chrome/browser/views/frame/browser_view.h" |
24 #endif | 25 #endif |
25 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
26 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); | 214 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); |
214 chrome_path = chrome_path.DirName(); | 215 chrome_path = chrome_path.DirName(); |
215 #if defined(OS_WIN) | 216 #if defined(OS_WIN) |
216 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); | 217 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); |
217 #elif defined(OS_POSIX) | 218 #elif defined(OS_POSIX) |
218 chrome_path = chrome_path.Append( | 219 chrome_path = chrome_path.Append( |
219 WideToASCII(chrome::kBrowserProcessExecutablePath)); | 220 WideToASCII(chrome::kBrowserProcessExecutablePath)); |
220 #endif | 221 #endif |
221 CHECK(PathService::Override(base::FILE_EXE, chrome_path)); | 222 CHECK(PathService::Override(base::FILE_EXE, chrome_path)); |
222 | 223 |
223 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, | 224 ChromeThread::PostTask( |
| 225 ChromeThread::IO, FROM_HERE, |
224 NewRunnableFunction(chrome_browser_net::SetUrlRequestMocksEnabled, true)); | 226 NewRunnableFunction(chrome_browser_net::SetUrlRequestMocksEnabled, true)); |
225 | 227 |
226 browser_ = CreateBrowser(profile); | 228 browser_ = CreateBrowser(profile); |
227 | 229 |
228 // Start the timeout timer to prevent hangs. | 230 // Start the timeout timer to prevent hangs. |
229 MessageLoopForUI::current()->PostDelayedTask(FROM_HERE, | 231 MessageLoopForUI::current()->PostDelayedTask(FROM_HERE, |
230 NewRunnableMethod(this, &InProcessBrowserTest::TimedOut), | 232 NewRunnableMethod(this, &InProcessBrowserTest::TimedOut), |
231 initial_timeout_); | 233 initial_timeout_); |
232 | 234 |
233 RunTestOnMainThread(); | 235 RunTestOnMainThread(); |
(...skipping 24 matching lines...) Expand all Loading... |
258 NewRunnableMethod(this, &InProcessBrowserTest::TimedOut), | 260 NewRunnableMethod(this, &InProcessBrowserTest::TimedOut), |
259 kSubsequentTimeoutInMS); | 261 kSubsequentTimeoutInMS); |
260 | 262 |
261 MessageLoopForUI::current()->Quit(); | 263 MessageLoopForUI::current()->Quit(); |
262 } | 264 } |
263 | 265 |
264 void InProcessBrowserTest::SetInitialTimeoutInMS(int timeout_value) { | 266 void InProcessBrowserTest::SetInitialTimeoutInMS(int timeout_value) { |
265 DCHECK_GT(timeout_value, 0); | 267 DCHECK_GT(timeout_value, 0); |
266 initial_timeout_ = timeout_value; | 268 initial_timeout_ = timeout_value; |
267 } | 269 } |
OLD | NEW |