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