| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/mac/scoped_nsautorelease_pool.h" | 10 #include "base/mac/scoped_nsautorelease_pool.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } | 272 } |
| 273 | 273 |
| 274 // Creates a browser with a single tab (about:blank), waits for the tab to | 274 // Creates a browser with a single tab (about:blank), waits for the tab to |
| 275 // finish loading and shows the browser. | 275 // finish loading and shows the browser. |
| 276 Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) { | 276 Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) { |
| 277 Browser* browser = Browser::Create(profile); | 277 Browser* browser = Browser::Create(profile); |
| 278 InitializeBrowser(browser); | 278 InitializeBrowser(browser); |
| 279 return browser; | 279 return browser; |
| 280 } | 280 } |
| 281 | 281 |
| 282 Browser* InProcessBrowserTest::CreateIncognitoBrowser() { |
| 283 // Create a new browser with using the incognito profile. |
| 284 Browser* incognito = |
| 285 Browser::Create(browser()->profile()->GetOffTheRecordProfile()); |
| 286 InitializeBrowser(incognito); |
| 287 return incognito; |
| 288 } |
| 289 |
| 282 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { | 290 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { |
| 283 Browser* browser = Browser::CreateForType(Browser::TYPE_POPUP, profile); | 291 Browser* browser = Browser::CreateForType(Browser::TYPE_POPUP, profile); |
| 284 InitializeBrowser(browser); | 292 InitializeBrowser(browser); |
| 285 return browser; | 293 return browser; |
| 286 } | 294 } |
| 287 | 295 |
| 288 void InProcessBrowserTest::RunTestOnMainThreadLoop() { | 296 void InProcessBrowserTest::RunTestOnMainThreadLoop() { |
| 289 #if defined(OS_POSIX) | 297 #if defined(OS_POSIX) |
| 290 // Restore default signal handler for SIGTERM, so when the out-of-process | 298 // Restore default signal handler for SIGTERM, so when the out-of-process |
| 291 // test runner tries to terminate us, we don't catch it and possibly make it | 299 // test runner tries to terminate us, we don't catch it and possibly make it |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 return; | 351 return; |
| 344 | 352 |
| 345 // Invoke CloseAllBrowsersAndExit on a running message loop. | 353 // Invoke CloseAllBrowsersAndExit on a running message loop. |
| 346 // CloseAllBrowsersAndExit exits the message loop after everything has been | 354 // CloseAllBrowsersAndExit exits the message loop after everything has been |
| 347 // shut down properly. | 355 // shut down properly. |
| 348 MessageLoopForUI::current()->PostTask( | 356 MessageLoopForUI::current()->PostTask( |
| 349 FROM_HERE, | 357 FROM_HERE, |
| 350 NewRunnableFunction(&BrowserList::CloseAllBrowsersAndExit)); | 358 NewRunnableFunction(&BrowserList::CloseAllBrowsersAndExit)); |
| 351 ui_test_utils::RunMessageLoop(); | 359 ui_test_utils::RunMessageLoop(); |
| 352 } | 360 } |
| OLD | NEW |