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

Unified Diff: chrome/browser/unload_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/unload_browsertest.cc
diff --git a/chrome/browser/unload_browsertest.cc b/chrome/browser/unload_browsertest.cc
index 9948a187481ff6ec308bd7f3c5808665780ba31a..ae66d8c3002daa0b7a8d0c0df32da291f1b1a834 100644
--- a/chrome/browser/unload_browsertest.cc
+++ b/chrome/browser/unload_browsertest.cc
@@ -151,15 +151,10 @@
base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true));
}
- void CheckTitle(const char* expected_title, bool wait = false) {
- auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents();
+ void CheckTitle(const char* expected_title) {
base::string16 expected = base::ASCIIToUTF16(expected_title);
- base::string16 actual;
- if (wait)
- actual = content::TitleWatcher(web_contents, expected).WaitAndGetTitle();
- else
- actual = web_contents->GetTitle();
- EXPECT_EQ(expected, actual);
+ EXPECT_EQ(expected,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetTitle());
}
void NavigateToDataURL(const char* html_content, const char* expected_title) {
@@ -617,13 +612,15 @@
content::WindowedNotificationObserver observer(
chrome::NOTIFICATION_TAB_ADDED,
content::NotificationService::AllSources());
+ content::WindowedNotificationObserver load_stop_observer(
+ content::NOTIFICATION_LOAD_STOP,
+ content::NotificationService::AllSources());
content::SimulateMouseClick(
browser()->tab_strip_model()->GetActiveWebContents(), 0,
blink::WebMouseEvent::Button::kLeft);
observer.Wait();
- // Need to wait for the title, because the initial page (about:blank) can stop
- // loading before the click handler calls document.write.
- CheckTitle("popup", true);
+ load_stop_observer.Wait();
+ CheckTitle("popup");
content::WebContentsDestroyedWatcher destroyed_watcher(
browser()->tab_strip_model()->GetActiveWebContents());
« no previous file with comments | « chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc ('k') | content/public/test/test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698