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

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

Issue 532143002: Close the find bar on reload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per reviewser comments. Created 6 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 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 865e9768f024d3d4a8a28e422e4c6531aee1799a..1bda780f4ec6add8c7cf52938b23ab8d0da537dd 100644
--- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
+++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
@@ -854,7 +854,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) {
EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible));
EXPECT_TRUE(fully_visible);
- // Reload the tab and make sure Find window doesn't go away.
+ // Reload and make sure the Find window goes away.
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::Source<NavigationController>(
@@ -862,7 +862,13 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) {
GetController()));
chrome::Reload(browser(), CURRENT_TAB);
observer.Wait();
+ EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible));
+ EXPECT_FALSE(fully_visible);
Finnur 2014/09/04 12:45:10 With this change, I'm not sure the added test (at
Deepak 2014/09/04 13:18:15 Acknowledged.
+ // Opening Findbar again.
+ chrome::ShowFindBar(browser());
+
+ // Make sure it is open.
EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible));
EXPECT_TRUE(fully_visible);
@@ -1552,3 +1558,43 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, IncognitoFindNextShared) {
EXPECT_EQ(ASCIIToUTF16("bar"),
GetFindBarTextForBrowser(browser_incognito));
}
+
+IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindDisappearOnReload) {
+ FindBar* find_bar = browser()->GetFindBarController()->find_bar();
+ if (find_bar->HasGlobalFindPasteboard())
+ return;
Finnur 2014/09/04 12:45:10 Why is this needed if it is not needed in FindDisa
Deepak 2014/09/04 13:18:15 Acknowledged.
+
+ // First we navigate to any page.
+ GURL url = GetURL(kSimple);
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ // Search for the word "page".
+ int ordinal = 0;
+ gfx::Point position;
+ bool fully_visible = false;
+
+ WebContents* web_contents_1 =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ EXPECT_EQ(
+ 1, FindInPageWchar(web_contents_1, L"page", kFwd, kIgnoreCase, &ordinal));
+
+ // Open the Find box.
+ EnsureFindBoxOpen();
+
+ EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText());
+ EXPECT_EQ(ASCIIToUTF16("1 of 1"),
+ GetFindBarMatchCountTextForBrowser(browser()));
+
+ content::WindowedNotificationObserver observer(
+ content::NOTIFICATION_LOAD_STOP,
+ content::Source<NavigationController>(&browser()
+ ->tab_strip_model()
+ ->GetActiveWebContents()
+ ->GetController()));
+ // Reloading the tab.
+ chrome::Reload(browser(), CURRENT_TAB);
+ observer.Wait();
+ // Make sure Find box is closed.
+ EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible));
+ EXPECT_FALSE(fully_visible);
+}

Powered by Google App Engine
This is Rietveld 408576698