| 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 return incognito; | 239 return incognito; |
| 240 } | 240 } |
| 241 | 241 |
| 242 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { | 242 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { |
| 243 Browser* browser = Browser::CreateForType(Browser::TYPE_POPUP, profile); | 243 Browser* browser = Browser::CreateForType(Browser::TYPE_POPUP, profile); |
| 244 AddBlankTabAndShow(browser); | 244 AddBlankTabAndShow(browser); |
| 245 return browser; | 245 return browser; |
| 246 } | 246 } |
| 247 | 247 |
| 248 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { | 248 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { |
| 249 browser->window()->Show(); |
| 250 |
| 249 ui_test_utils::WindowedNotificationObserver observer( | 251 ui_test_utils::WindowedNotificationObserver observer( |
| 250 content::NOTIFICATION_LOAD_STOP, | 252 content::NOTIFICATION_LOAD_STOP, |
| 251 NotificationService::AllSources()); | 253 NotificationService::AllSources()); |
| 252 browser->AddSelectedTabWithURL( | 254 browser->AddSelectedTabWithURL( |
| 253 GURL(chrome::kAboutBlankURL), PageTransition::START_PAGE); | 255 GURL(chrome::kAboutBlankURL), PageTransition::START_PAGE); |
| 254 observer.Wait(); | 256 observer.Wait(); |
| 255 | 257 |
| 256 browser->window()->Show(); | 258 browser->window()->Activate(); |
| 257 } | 259 } |
| 258 | 260 |
| 259 #if defined(OS_POSIX) | 261 #if defined(OS_POSIX) |
| 260 // On SIGTERM (sent by the runner on timeouts), dump a stack trace (to make | 262 // On SIGTERM (sent by the runner on timeouts), dump a stack trace (to make |
| 261 // debugging easier) and also exit with a known error code (so that the test | 263 // debugging easier) and also exit with a known error code (so that the test |
| 262 // framework considers this a failure -- http://crbug.com/57578). | 264 // framework considers this a failure -- http://crbug.com/57578). |
| 263 static void DumpStackTraceSignalHandler(int signal) { | 265 static void DumpStackTraceSignalHandler(int signal) { |
| 264 base::debug::StackTrace().PrintBacktrace(); | 266 base::debug::StackTrace().PrintBacktrace(); |
| 265 _exit(128 + signal); | 267 _exit(128 + signal); |
| 266 } | 268 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 return; | 311 return; |
| 310 | 312 |
| 311 // Invoke CloseAllBrowsersAndMayExit on a running message loop. | 313 // Invoke CloseAllBrowsersAndMayExit on a running message loop. |
| 312 // CloseAllBrowsersAndMayExit exits the message loop after everything has been | 314 // CloseAllBrowsersAndMayExit exits the message loop after everything has been |
| 313 // shut down properly. | 315 // shut down properly. |
| 314 MessageLoopForUI::current()->PostTask( | 316 MessageLoopForUI::current()->PostTask( |
| 315 FROM_HERE, | 317 FROM_HERE, |
| 316 NewRunnableFunction(&BrowserList::AttemptExit)); | 318 NewRunnableFunction(&BrowserList::AttemptExit)); |
| 317 ui_test_utils::RunMessageLoop(); | 319 ui_test_utils::RunMessageLoop(); |
| 318 } | 320 } |
| OLD | NEW |