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

Unified Diff: chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc

Issue 2828163004: Revert of Revert "Revert of Reland: Switch WindowedNotificationObserver to use base::RunLoop. (Closed)
Patch Set: Created 3 years, 8 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
Index: chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc
diff --git a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc
index e4eac62b09b5bd104364ce2af512b13b1bd80b7c..c9da53c5eda3a27eb2509e9c04614f41ecefea17 100644
--- a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc
+++ b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc
@@ -525,21 +525,21 @@
class WindowDestroyer : public content::WebContentsObserver {
public:
WindowDestroyer(content::WebContents* web_contents, TabStripModel* model)
- : content::WebContentsObserver(web_contents),
- tab_strip_model_(model),
- browser_closed_observer_(chrome::NOTIFICATION_BROWSER_CLOSED,
- content::NotificationService::AllSources()) {}
-
- // Wait for the browser window to be destroyed.
- void Wait() { browser_closed_observer_.Wait(); }
+ : content::WebContentsObserver(web_contents), tab_strip_model_(model) {}
void RenderProcessGone(base::TerminationStatus status) override {
+ // Wait for the window to be destroyed, which will ensure all other
+ // RenderViewHost objects are deleted before we return and proceed with
+ // the next iteration of notifications.
+ content::WindowedNotificationObserver observer(
+ chrome::NOTIFICATION_BROWSER_CLOSED,
+ content::NotificationService::AllSources());
tab_strip_model_->CloseAllTabs();
+ observer.Wait();
}
private:
TabStripModel* tab_strip_model_;
- content::WindowedNotificationObserver browser_closed_observer_;
DISALLOW_COPY_AND_ASSIGN(WindowDestroyer);
};
@@ -572,12 +572,16 @@
// Create an object that will close the window on a process crash.
WindowDestroyer destroyer(wc1, browser()->tab_strip_model());
+ content::WindowedNotificationObserver observer(
+ chrome::NOTIFICATION_BROWSER_CLOSED,
+ content::NotificationService::AllSources());
+
// Kill the renderer process, simulating a crash. This should the ProcessDied
// method to be called. Alternatively, RenderProcessHost::OnChannelError can
// be called to directly force a call to ProcessDied.
wc1->GetRenderProcessHost()->Shutdown(-1, true);
- destroyer.Wait();
+ observer.Wait();
}
// Sets up the browser in order to start the tests with two tabs open: one

Powered by Google App Engine
This is Rietveld 408576698