summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/find_bar_win_browsertest.cc
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-21 20:37:49 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-21 20:37:49 +0000
commit2a1a1815a228089514ca0eb52ea9533d9e070672 (patch)
tree5ae6e2d6376cf68b61a404b8771fb01c034a7052 /chrome/browser/views/find_bar_win_browsertest.cc
parent0f08bf3692c1db8ff2032a7e944335cb5bb6a453 (diff)
downloadchromium_src-2a1a1815a228089514ca0eb52ea9533d9e070672.zip
chromium_src-2a1a1815a228089514ca0eb52ea9533d9e070672.tar.gz
chromium_src-2a1a1815a228089514ca0eb52ea9533d9e070672.tar.bz2
Convert all but one Find test from ui_test to In-Process
Browser test. I also added initialization for a struct that static code analysis complained about. Not technically needed, but harmless to add. BUG=None TEST=None (covered by tests already). Review URL: http://codereview.chromium.org/115652 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16651 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/find_bar_win_browsertest.cc')
-rw-r--r--chrome/browser/views/find_bar_win_browsertest.cc84
1 files changed, 84 insertions, 0 deletions
diff --git a/chrome/browser/views/find_bar_win_browsertest.cc b/chrome/browser/views/find_bar_win_browsertest.cc
index 84248ba..b24f229 100644
--- a/chrome/browser/views/find_bar_win_browsertest.cc
+++ b/chrome/browser/views/find_bar_win_browsertest.cc
@@ -14,6 +14,7 @@
#include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h"
+const std::wstring kSimplePage = L"404_is_enough_for_us.html";
const std::wstring kFramePage = L"files/find_in_page/frames.html";
const std::wstring kFrameData = L"files/find_in_page/framedata_general.html";
const std::wstring kUserSelectPage = L"files/find_in_page/user-select.html";
@@ -104,6 +105,12 @@ class FindInPageControllerTest : public InProcessBrowserTest {
*ordinal = observer.active_match_ordinal();
return observer.number_of_matches();
}
+
+ void GetFindBarWindowInfo(gfx::Point* position, bool* fully_visible) {
+ FindBarTesting* find_bar =
+ browser()->find_bar()->find_bar()->GetFindBarTesting();
+ find_bar->GetFindBarWindowInfo(position, fully_visible);
+ }
};
// This test loads a page with frames and starts FindInPage requests.
@@ -403,3 +410,80 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
EXPECT_EQ(2, FindInPage(L"html ", FWD, IGNORE_CASE, false, &ordinal));
EXPECT_EQ(1, ordinal);
}
+
+// Make sure Find box disappears on Navigate but not on Refresh.
+IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) {
+ HTTPTestServer* server = StartHTTPServer();
+
+ // First we navigate to our special focus tracking page.
+ GURL url = server->TestServerPageW(kSimplePage);
+ GURL url2 = server->TestServerPageW(kFramePage);
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ // Open the Find window with animations disabled.
+ FindBarWin::disable_animations_during_testing_ = true;
+ browser()->ShowFindBar();
+
+ gfx::Point position;
+ bool fully_visible = false;
+
+ // Make sure it is open.
+ GetFindBarWindowInfo(&position, &fully_visible);
+ EXPECT_TRUE(fully_visible);
+
+ // Reload the tab and make sure Find window doesn't go away.
+ browser()->Reload();
+
+ GetFindBarWindowInfo(&position, &fully_visible);
+ EXPECT_TRUE(fully_visible);
+
+ // Navigate and make sure the Find window goes away.
+ ui_test_utils::NavigateToURL(browser(), url2);
+
+ GetFindBarWindowInfo(&position, &fully_visible);
+ EXPECT_FALSE(fully_visible);
+}
+
+// Make sure Find box disappears when History/Downloads page is opened, and
+// when a New Tab is opened.
+IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
+ FindDisappearOnNewTabAndHistory) {
+ HTTPTestServer* server = StartHTTPServer();
+
+ // First we navigate to our special focus tracking page.
+ GURL url = server->TestServerPageW(kSimplePage);
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ // Open the Find window with animations disabled.
+ FindBarWin::disable_animations_during_testing_ = true;
+ browser()->ShowFindBar();
+
+ gfx::Point position;
+ bool fully_visible = false;
+
+ // Make sure it is open.
+ GetFindBarWindowInfo(&position, &fully_visible);
+ EXPECT_TRUE(fully_visible);
+
+ // Open another tab (tab B).
+ browser()->NewTab();
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ // Make sure Find box is closed.
+ GetFindBarWindowInfo(&position, &fully_visible);
+ EXPECT_FALSE(fully_visible);
+
+ // Close tab B.
+ browser()->CloseTab();
+
+ // Make sure Find window appears again.
+ GetFindBarWindowInfo(&position, &fully_visible);
+ EXPECT_TRUE(fully_visible);
+
+ browser()->ShowHistoryTab();
+
+ // Make sure Find box is closed.
+ GetFindBarWindowInfo(&position, &fully_visible);
+ EXPECT_FALSE(fully_visible);
+}
+