diff options
author | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-15 23:53:41 +0000 |
---|---|---|
committer | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-15 23:53:41 +0000 |
commit | c1bcb90272edd39e67f85877b58da4f28fef055e (patch) | |
tree | 3a5fb036d3c9bcccb5b4623dd8010687129461c5 | |
parent | 4d87ceb4a9b76da50f30afd47043b35fd0fd24a8 (diff) | |
download | chromium_src-c1bcb90272edd39e67f85877b58da4f28fef055e.zip chromium_src-c1bcb90272edd39e67f85877b58da4f28fef055e.tar.gz chromium_src-c1bcb90272edd39e67f85877b58da4f28fef055e.tar.bz2 |
Add a ui test to make sure the Find box does not go away on Reload but does
go away when you navigate to a new page.
Review URL: http://codereview.chromium.org/14130
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7016 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/views/find_bar_win_uitest.cc | 27 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.cc | 7 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.h | 9 |
3 files changed, 35 insertions, 8 deletions
diff --git a/chrome/browser/views/find_bar_win_uitest.cc b/chrome/browser/views/find_bar_win_uitest.cc index 2354d72a..ac534b4 100644 --- a/chrome/browser/views/find_bar_win_uitest.cc +++ b/chrome/browser/views/find_bar_win_uitest.cc @@ -260,7 +260,7 @@ TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) { // Open the Find window and wait for it to animate. EXPECT_TRUE(tabA->OpenFindInPage()); - EXPECT_TRUE(WaitForFindWindowFullyVisible(tabA.get())); + EXPECT_TRUE(WaitForFindWindowVisibilityChange(tabA.get(), true)); // Find its location. int x = -1, y = -1; @@ -300,3 +300,28 @@ TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) { EXPECT_EQ(x, new_x); EXPECT_EQ(y, new_y); } + +// Make sure Find box disappears on Navigate but not on Refresh. +TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) { + TestServer server(L"chrome/test/data"); + + GURL url = server.TestServerPageW(kUserSelectPage); + scoped_ptr<TabProxy> tab(GetActiveTab()); + ASSERT_TRUE(tab->NavigateToURL(url)); + WaitUntilTabCount(1); + + scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); + ASSERT_TRUE(browser.get() != NULL); + + // Open the Find window and wait for it to animate. + EXPECT_TRUE(tab->OpenFindInPage()); + EXPECT_TRUE(WaitForFindWindowVisibilityChange(tab.get(), true)); + + // Reload the tab and make sure Find box doesn't go away. + EXPECT_TRUE(tab->Reload()); + EXPECT_TRUE(WaitForFindWindowVisibilityChange(tab.get(), true)); + + // Navigate and make sure the Find box goes away. + EXPECT_TRUE(tab->NavigateToURL(url)); + EXPECT_TRUE(WaitForFindWindowVisibilityChange(tab.get(), false)); +} diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index 35f09cf..c3f0c4b 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -389,14 +389,15 @@ bool UITest::WaitForDownloadShelfVisible(TabProxy* tab) { return false; } -bool UITest::WaitForFindWindowFullyVisible(TabProxy* tab) { +bool UITest::WaitForFindWindowVisibilityChange(TabProxy* tab, + bool wait_for_open) { const int kCycles = 20; for (int i = 0; i < kCycles; i++) { bool visible = false; if (!tab->IsFindWindowFullyVisible(&visible)) return false; // Some error. - if (visible) - return true; // Find window is visible. + if (visible == wait_for_open) + return true; // Find window visibility change complete. // Give it a chance to catch up. Sleep(kWaitForActionMaxMsec / kCycles); diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h index 5c1625a..4b9bf600 100644 --- a/chrome/test/ui/ui_test.h +++ b/chrome/test/ui/ui_test.h @@ -130,10 +130,11 @@ class UITest : public testing::Test { // as possible. bool WaitForDownloadShelfVisible(TabProxy* tab); - // Waits until the Find window has become fully visible (and stopped - // animating) in the specified tab. This function can time out (return false) - // if the window doesn't appear within a specific time. - bool WaitForFindWindowFullyVisible(TabProxy* tab); + // Waits until the Find window has become fully visible (if |wait_for_open| is + // true) or fully hidden (if |wait_for_open| is false). This function can time + // out (return false) if the window doesn't appear within a specific time. + bool WaitForFindWindowVisibilityChange(TabProxy* tab, + bool wait_for_open); // Waits until the Bookmark bar has stopped animating and become fully visible // (if |wait_for_open| is true) or fully hidden (if |wait_for_open| is false). |