| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/in_process_browser_test.h" | 5 #include "chrome/test/base/in_process_browser_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 return incognito; | 267 return incognito; |
| 268 } | 268 } |
| 269 | 269 |
| 270 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { | 270 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { |
| 271 Browser* browser = Browser::CreateForType(Browser::TYPE_POPUP, profile); | 271 Browser* browser = Browser::CreateForType(Browser::TYPE_POPUP, profile); |
| 272 AddBlankTabAndShow(browser); | 272 AddBlankTabAndShow(browser); |
| 273 return browser; | 273 return browser; |
| 274 } | 274 } |
| 275 | 275 |
| 276 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { | 276 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { |
| 277 browser->window()->Show(); |
| 278 |
| 277 ui_test_utils::WindowedNotificationObserver observer( | 279 ui_test_utils::WindowedNotificationObserver observer( |
| 278 content::NOTIFICATION_LOAD_STOP, | 280 content::NOTIFICATION_LOAD_STOP, |
| 279 NotificationService::AllSources()); | 281 NotificationService::AllSources()); |
| 280 browser->AddSelectedTabWithURL( | 282 browser->AddSelectedTabWithURL( |
| 281 GURL(chrome::kAboutBlankURL), PageTransition::START_PAGE); | 283 GURL(chrome::kAboutBlankURL), PageTransition::START_PAGE); |
| 282 observer.Wait(); | 284 observer.Wait(); |
| 283 | 285 |
| 284 browser->window()->Show(); | 286 browser->window()->Activate(); |
| 285 } | 287 } |
| 286 | 288 |
| 287 #if defined(OS_POSIX) | 289 #if defined(OS_POSIX) |
| 288 // On SIGTERM (sent by the runner on timeouts), dump a stack trace (to make | 290 // On SIGTERM (sent by the runner on timeouts), dump a stack trace (to make |
| 289 // debugging easier) and also exit with a known error code (so that the test | 291 // debugging easier) and also exit with a known error code (so that the test |
| 290 // framework considers this a failure -- http://crbug.com/57578). | 292 // framework considers this a failure -- http://crbug.com/57578). |
| 291 static void DumpStackTraceSignalHandler(int signal) { | 293 static void DumpStackTraceSignalHandler(int signal) { |
| 292 base::debug::StackTrace().PrintBacktrace(); | 294 base::debug::StackTrace().PrintBacktrace(); |
| 293 _exit(128 + signal); | 295 _exit(128 + signal); |
| 294 } | 296 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 return; | 354 return; |
| 353 | 355 |
| 354 // Invoke CloseAllBrowsersAndMayExit on a running message loop. | 356 // Invoke CloseAllBrowsersAndMayExit on a running message loop. |
| 355 // CloseAllBrowsersAndMayExit exits the message loop after everything has been | 357 // CloseAllBrowsersAndMayExit exits the message loop after everything has been |
| 356 // shut down properly. | 358 // shut down properly. |
| 357 MessageLoopForUI::current()->PostTask( | 359 MessageLoopForUI::current()->PostTask( |
| 358 FROM_HERE, | 360 FROM_HERE, |
| 359 NewRunnableFunction(&BrowserList::AttemptExit)); | 361 NewRunnableFunction(&BrowserList::AttemptExit)); |
| 360 ui_test_utils::RunMessageLoop(); | 362 ui_test_utils::RunMessageLoop(); |
| 361 } | 363 } |
| OLD | NEW |