OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/stack_trace.h" | 10 #include "base/debug/stack_trace.h" |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 372 |
373 void InProcessBrowserTest::QuitBrowsers() { | 373 void InProcessBrowserTest::QuitBrowsers() { |
374 if (BrowserList::empty()) | 374 if (BrowserList::empty()) |
375 return; | 375 return; |
376 | 376 |
377 // Invoke AttemptExit on a running message loop. | 377 // Invoke AttemptExit on a running message loop. |
378 // AttemptExit exits the message loop after everything has been | 378 // AttemptExit exits the message loop after everything has been |
379 // shut down properly. | 379 // shut down properly. |
380 MessageLoopForUI::current()->PostTask(FROM_HERE, | 380 MessageLoopForUI::current()->PostTask(FROM_HERE, |
381 base::Bind(&browser::AttemptExit)); | 381 base::Bind(&browser::AttemptExit)); |
382 ui_test_utils::RunMessageLoop(); | 382 content::RunMessageLoop(); |
383 | 383 |
384 #if defined(OS_MACOSX) | 384 #if defined(OS_MACOSX) |
385 // browser::AttemptExit() will attempt to close all browsers by deleting | 385 // browser::AttemptExit() will attempt to close all browsers by deleting |
386 // their tab contents. The last tab contents being removed triggers closing of | 386 // their tab contents. The last tab contents being removed triggers closing of |
387 // the browser window. | 387 // the browser window. |
388 // | 388 // |
389 // On the Mac, this eventually reaches | 389 // On the Mac, this eventually reaches |
390 // -[BrowserWindowController windowWillClose:], which will post a deferred | 390 // -[BrowserWindowController windowWillClose:], which will post a deferred |
391 // -autorelease on itself to ultimately destroy the Browser object. The line | 391 // -autorelease on itself to ultimately destroy the Browser object. The line |
392 // below is necessary to pump these pending messages to ensure all Browsers | 392 // below is necessary to pump these pending messages to ensure all Browsers |
393 // get deleted. | 393 // get deleted. |
394 ui_test_utils::RunAllPendingInMessageLoop(); | 394 ui_test_utils::RunAllPendingInMessageLoop(); |
395 delete autorelease_pool_; | 395 delete autorelease_pool_; |
396 autorelease_pool_ = NULL; | 396 autorelease_pool_ = NULL; |
397 #endif | 397 #endif |
398 } | 398 } |
OLD | NEW |