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

Unified Diff: chrome/browser/ui/find_bar/find_bar_host_browsertest.cc

Issue 7489019: Fix up various browser tests not to use WaitForNavigation. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 5 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/ui/find_bar/find_bar_host_browsertest.cc
diff --git a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
index 353e6e9986218502e6477da25b090edbbbc9f82c..05e8f3c85c1541be594dd45f2c873884c142f126 100644
--- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
+++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
@@ -580,8 +580,9 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) {
EXPECT_TRUE(fully_visible);
// Reload the tab and make sure Find window doesn't go away.
+ ui_test_utils::WindowedNotificationObserver observer(*browser());
browser()->Reload(CURRENT_TAB);
- ui_test_utils::WaitForNavigationInCurrentTab(browser());
+ observer.Wait();
EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible));
EXPECT_TRUE(fully_visible);
@@ -1047,9 +1048,10 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NoIncognitoPrepopulate) {
// Open a new incognito window and navigate to the same page.
Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile();
Browser* incognito_browser = Browser::Create(incognito_profile);
+ ui_test_utils::WindowedNotificationObserver observer(
+ content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
incognito_browser->AddSelectedTabWithURL(url, PageTransition::START_PAGE);
- ui_test_utils::WaitForNavigation(
- &incognito_browser->GetSelectedTabContents()->controller());
+ observer.Wait();
incognito_browser->window()->Show();
// Open the find box and make sure that it is prepopulated with "page".
@@ -1092,8 +1094,9 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, ActivateLinkNavigatesPage) {
EXPECT_EQ(ordinal, 1);
// End the find session, click on the link.
+ ui_test_utils::WindowedNotificationObserver observer(*browser());
tab->find_tab_helper()->StopFinding(FindBarController::kActivateSelection);
- EXPECT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
+ observer.Wait();
}
// Tests that FindBar fits within a narrow browser window.
@@ -1101,12 +1104,12 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FitWindow) {
Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile());
params.initial_bounds = gfx::Rect(0, 0, 250, 500);
Browser* popup = Browser::CreateWithParams(params);
+ ui_test_utils::WindowedNotificationObserver observer(
+ content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
popup->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL),
PageTransition::LINK);
-
// Wait for the page to finish loading.
- ui_test_utils::WaitForNavigation(
- &popup->GetSelectedTabContents()->controller());
+ observer.Wait();
popup->window()->Show();
// On GTK, bounds change is asynchronous.

Powered by Google App Engine
This is Rietveld 408576698