summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authoravayvod@google.com <avayvod@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 16:20:14 +0000
committeravayvod@google.com <avayvod@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 16:20:14 +0000
commit235e78fa9d5cc04809cef1a9d1b85b20a58eeb6b (patch)
treec5c330c7a51b29247c69310681f6be2303fce504 /chrome/test
parentfe9e5960882d7107ee7bd80f6c6bae56703db071 (diff)
downloadchromium_src-235e78fa9d5cc04809cef1a9d1b85b20a58eeb6b.zip
chromium_src-235e78fa9d5cc04809cef1a9d1b85b20a58eeb6b.tar.gz
chromium_src-235e78fa9d5cc04809cef1a9d1b85b20a58eeb6b.tar.bz2
Added logic that exits message loop upon test ending even if no browser
window exists. BUG=None. TEST=Run in process browser test that doesn't create browser window: it should quit without timeout error. Review URL: http://codereview.chromium.org/1508007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43085 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/in_process_browser_test.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc
index 5afcfc2..6070bd4 100644
--- a/chrome/test/in_process_browser_test.cc
+++ b/chrome/test/in_process_browser_test.cc
@@ -276,7 +276,8 @@ void InProcessBrowserTest::RunTestOnMainThreadLoop() {
// Close all browser windows. This might not happen immediately, since some
// may need to wait for beforeunload and unload handlers to fire in a tab.
- // When all windows are closed, the last window will call Quit().
+ // When all windows are closed, the last window will call Quit(). Call
+ // Quit() explicitly if no windows are open.
#if defined(OS_MACOSX)
// When the browser window closes, Cocoa will generate an inner-loop that
// processes the RenderProcessHost delete task, so allow task nesting.
@@ -284,8 +285,12 @@ void InProcessBrowserTest::RunTestOnMainThreadLoop() {
MessageLoopForUI::current()->SetNestableTasksAllowed(true);
#endif
BrowserList::const_iterator browser = BrowserList::begin();
- for (; browser != BrowserList::end(); ++browser)
- (*browser)->CloseWindow();
+ if (browser == BrowserList::end()) {
+ MessageLoopForUI::current()->Quit();
+ } else {
+ for (; browser != BrowserList::end(); ++browser)
+ (*browser)->CloseWindow();
+ }
#if defined(OS_MACOSX)
MessageLoopForUI::current()->SetNestableTasksAllowed(old_state);
#endif