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

Side by Side Diff: chrome/test/base/in_process_browser_test.cc

Issue 23684031: Ensures NOTIFICATION_APP_TERMINATING at the end of InProcessBrowserTest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 QuitBrowsers(); 451 QuitBrowsers();
452 // All BrowserLists should be empty at this point. 452 // All BrowserLists should be empty at this point.
453 for (chrome::HostDesktopType t = chrome::HOST_DESKTOP_TYPE_FIRST; 453 for (chrome::HostDesktopType t = chrome::HOST_DESKTOP_TYPE_FIRST;
454 t < chrome::HOST_DESKTOP_TYPE_COUNT; 454 t < chrome::HOST_DESKTOP_TYPE_COUNT;
455 t = static_cast<chrome::HostDesktopType>(t + 1)) { 455 t = static_cast<chrome::HostDesktopType>(t + 1)) {
456 CHECK(BrowserList::GetInstance(t)->empty()) << t; 456 CHECK(BrowserList::GetInstance(t)->empty()) << t;
457 } 457 }
458 } 458 }
459 459
460 void InProcessBrowserTest::QuitBrowsers() { 460 void InProcessBrowserTest::QuitBrowsers() {
461 if (chrome::GetTotalBrowserCount() == 0) 461 if (chrome::GetTotalBrowserCount() == 0) {
462 chrome::NotifyAppTerminating();
sky 2013/09/05 15:33:45 Might this result in sending out notification twic
Jun Mukai 2013/09/05 18:46:56 No, as far as I see. Usually app-terminating will
462 return; 463 return;
464 }
463 465
464 // Invoke AttemptExit on a running message loop. 466 // Invoke AttemptExit on a running message loop.
465 // AttemptExit exits the message loop after everything has been 467 // AttemptExit exits the message loop after everything has been
466 // shut down properly. 468 // shut down properly.
467 base::MessageLoopForUI::current()->PostTask(FROM_HERE, 469 base::MessageLoopForUI::current()->PostTask(FROM_HERE,
468 base::Bind(&chrome::AttemptExit)); 470 base::Bind(&chrome::AttemptExit));
469 content::RunMessageLoop(); 471 content::RunMessageLoop();
470 472
471 #if defined(OS_MACOSX) 473 #if defined(OS_MACOSX)
472 // chrome::AttemptExit() will attempt to close all browsers by deleting 474 // chrome::AttemptExit() will attempt to close all browsers by deleting
473 // their tab contents. The last tab contents being removed triggers closing of 475 // their tab contents. The last tab contents being removed triggers closing of
474 // the browser window. 476 // the browser window.
475 // 477 //
476 // On the Mac, this eventually reaches 478 // On the Mac, this eventually reaches
477 // -[BrowserWindowController windowWillClose:], which will post a deferred 479 // -[BrowserWindowController windowWillClose:], which will post a deferred
478 // -autorelease on itself to ultimately destroy the Browser object. The line 480 // -autorelease on itself to ultimately destroy the Browser object. The line
479 // below is necessary to pump these pending messages to ensure all Browsers 481 // below is necessary to pump these pending messages to ensure all Browsers
480 // get deleted. 482 // get deleted.
481 content::RunAllPendingInMessageLoop(); 483 content::RunAllPendingInMessageLoop();
482 delete autorelease_pool_; 484 delete autorelease_pool_;
483 autorelease_pool_ = NULL; 485 autorelease_pool_ = NULL;
484 #endif 486 #endif
485 } 487 }
OLDNEW
« 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