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