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

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

Issue 498133002: Findbox should disappear once we reload and open new tab and come back to previous tab. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make same logic for removing Findbox on reload. 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
« no previous file with comments | « chrome/browser/ui/find_bar/find_bar_controller.cc ('k') | chrome/browser/ui/find_bar/find_tab_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..eb81965c33f49ec842cd90407c6b4a94da54d816 100644
--- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
+++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
@@ -1552,3 +1552,55 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, IncognitoFindNextShared) {
EXPECT_EQ(ASCIIToUTF16("bar"),
GetFindBarTextForBrowser(browser_incognito));
}
+
+IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
+ FindboxDisappearAfterReloadBackFromNewTab) {
+ FindBar* find_bar = browser()->GetFindBarController()->find_bar();
+ if (find_bar->HasGlobalFindPasteboard())
+ return;
+
+ // First we navigate to any page.
+ GURL url = GetURL(kSimple);
+ gfx::Point position;
+ bool fully_visible = false;
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ // Search for the word "page".
+ int ordinal = 0;
+ 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()));
+
+ chrome::Reload(browser(), CURRENT_TAB);
+
+ // Now create a second tab and load new page.
+ chrome::AddTabAt(browser(), GURL(), -1, true);
+ GURL url2 = GetURL(kFramePage);
+ ui_test_utils::NavigateToURL(browser(), url2);
+ WebContents* web_contents_2 =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ EXPECT_NE(web_contents_1, web_contents_2);
+
+ observer.Wait();
+ // Go back to the first tab
+ browser()->tab_strip_model()->ActivateTabAt(0, false);
+
+ // Make sure Find box is closed.
+ EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible));
+ EXPECT_FALSE(fully_visible);
+}
« no previous file with comments | « chrome/browser/ui/find_bar/find_bar_controller.cc ('k') | chrome/browser/ui/find_bar/find_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698