summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorfinnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-08 20:29:43 +0000
committerfinnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-08 20:29:43 +0000
commite292fca9e47cba237bb5b2d885f900eddecd70c5 (patch)
tree6b9a508844c0750364033bad598d24c350b3cdd4 /chrome
parenta2c257166578102f6874dace42dcbbfdb1441231 (diff)
downloadchromium_src-e292fca9e47cba237bb5b2d885f900eddecd70c5.zip
chromium_src-e292fca9e47cba237bb5b2d885f900eddecd70c5.tar.gz
chromium_src-e292fca9e47cba237bb5b2d885f900eddecd70c5.tar.bz2
Fixing 5132: Find-in-page reports wrong ordinal when restarting search in sub-frame
ReportFindInPageSelection calls OrdinalOfFirstMatchForFrame internally, so we don't need to do it again at the call site. Added a test to catch this in the future. Review URL: http://codereview.chromium.org/13190 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6532 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/views/find_bar_win_uitest.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/chrome/browser/views/find_bar_win_uitest.cc b/chrome/browser/views/find_bar_win_uitest.cc
index 1ce49f5..7350779 100644
--- a/chrome/browser/views/find_bar_win_uitest.cc
+++ b/chrome/browser/views/find_bar_win_uitest.cc
@@ -153,6 +153,36 @@ TEST_F(FindInPageControllerTest, FindInPageMultiFramesOrdinal) {
EXPECT_EQ(7, ordinal);
}
+// We could get ordinals out of whack when restarting search in subframes.
+// See http://crbug.com/5132
+TEST_F(FindInPageControllerTest, FindInPage_Issue5132) {
+ TestServer server(L"chrome/test/data");
+
+ // First we navigate to our frames page.
+ GURL url = server.TestServerPageW(kFramePage);
+ scoped_ptr<TabProxy> tab(GetActiveTab());
+ ASSERT_TRUE(tab->NavigateToURL(url));
+ WaitUntilTabCount(1);
+
+ // Search for 'goa' three times (6 matches on page).
+ int ordinal = 0;
+ EXPECT_EQ(6, tab->FindInPage(L"goa", FWD, IGNORE_CASE, false, &ordinal));
+ EXPECT_EQ(1, ordinal);
+ // FindNext returns -1 for match count because it doesn't bother with
+ // recounting the number of matches. We don't care about the match count
+ // anyway in this case, we just want to check the ordinal.
+ EXPECT_EQ(-1, tab->FindInPage(L"goa", FWD, IGNORE_CASE, true, &ordinal));
+ EXPECT_EQ(2, ordinal);
+ EXPECT_EQ(-1, tab->FindInPage(L"goa", FWD, IGNORE_CASE, true, &ordinal));
+ EXPECT_EQ(3, ordinal);
+ // Add space to search (should result in no matches).
+ EXPECT_EQ(0, tab->FindInPage(L"goa ", FWD, IGNORE_CASE, false, &ordinal));
+ EXPECT_EQ(-1, ordinal);
+ // Remove the space, should be back to '3 out of 6')
+ EXPECT_EQ(6, tab->FindInPage(L"goa", FWD, IGNORE_CASE, false, &ordinal));
+ EXPECT_EQ(3, ordinal);
+}
+
// Load a page with no selectable text and make sure we don't crash.
TEST_F(FindInPageControllerTest, FindUnSelectableText) {
TestServer server(L"chrome/test/data");