Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Unified Diff: chrome/test/base/in_process_browser_test.cc

Issue 10408030: [Mac] Ensure that browser tests' teardown destroys all browser objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698