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

Unified Diff: chrome/test/in_process_browser_test.cc

Issue 126175: Close all browsers during InProcessBrowserTest cleanup, not just the main one... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 | « chrome/test/in_process_browser_test.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/in_process_browser_test.cc
===================================================================
--- chrome/test/in_process_browser_test.cc (revision 18385)
+++ chrome/test/in_process_browser_test.cc (working copy)
@@ -9,6 +9,7 @@
#include "base/file_util.h"
#include "base/path_service.h"
#include "chrome/browser/browser.h"
+#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_shutdown.h"
#include "chrome/browser/browser_window.h"
@@ -143,17 +144,6 @@
RenderProcessHost::set_run_renderer_in_process(original_single_process_);
}
-void InProcessBrowserTest::Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details) {
- if (type == NotificationType::BROWSER_CLOSED) {
- DCHECK(Source<Browser>(source).ptr() == browser_);
- browser_ = NULL;
- } else {
- NOTREACHED();
- }
-}
-
HTTPTestServer* InProcessBrowserTest::StartHTTPServer() {
// The HTTPServer must run on the IO thread.
DCHECK(!http_server_.get());
@@ -199,19 +189,14 @@
browser_ = CreateBrowser(profile);
- registrar_.Add(this,
- NotificationType::BROWSER_CLOSED,
- Source<Browser>(browser_));
-
RunTestOnMainThread();
- if (browser_)
- browser_->CloseAllTabs();
+ BrowserList::const_reverse_iterator browser =
+ BrowserList::begin_last_active();
+ for (; browser != BrowserList::end_last_active(); ++browser) {
sky 2009/06/16 00:04:48 nit: no {}
+ (*browser)->CloseAllTabs();
+ }
- // Remove all registered notifications, otherwise by the time the
- // destructor is run the NotificationService is dead.
- registrar_.RemoveAll();
-
// Stop the HTTP server.
http_server_ = NULL;
« no previous file with comments | « chrome/test/in_process_browser_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698