Index: chrome/test/base/in_process_browser_test.cc |
=================================================================== |
--- chrome/test/base/in_process_browser_test.cc (revision 137713) |
+++ chrome/test/base/in_process_browser_test.cc (working copy) |
@@ -373,20 +373,30 @@ |
#endif |
QuitBrowsers(); |
+ CHECK(BrowserList::empty()); |
} |
void InProcessBrowserTest::QuitBrowsers() { |
if (BrowserList::size() == 0) |
return; |
- // Invoke CloseAllBrowsersAndMayExit on a running message loop. |
- // CloseAllBrowsersAndMayExit exits the message loop after everything has been |
+ // Invoke AttemptExit on a running message loop. |
+ // AttemptExit exits the message loop after everything has been |
// shut down properly. |
MessageLoopForUI::current()->PostTask(FROM_HERE, |
base::Bind(&BrowserList::AttemptExit)); |
ui_test_utils::RunMessageLoop(); |
#if defined(OS_MACOSX) |
+ // BrowserList::AttemptExit() will attempt to close all browsers by deleting |
+ // their tab contents. The last tab contents being removed triggers closing of |
+ // the browser window. |
+ // |
+ // On the Mac, this eventually reaches -windowWillClose: on |
Robert Sesek
2012/05/18 20:10:15
nit: just write this as -[BrowserWindowController
|
+ // BrowserWindowController, which will post a deferred -autorelease on itself |
+ // to ultimately destroy the Browser object. The line below is necessary to |
+ // pump these pending tasks to ensure all Browsers get deleted. |
Robert Sesek
2012/05/18 20:10:15
nit: I'd use the word "messages" instead of "tasks
|
+ ui_test_utils::RunAllPendingInMessageLoop(); |
delete autorelease_pool_; |
autorelease_pool_ = NULL; |
#endif |