From 968efff76e72340022169b518c04e9cfbf2f8fb5 Mon Sep 17 00:00:00 2001 From: "finnur@google.com" Date: Wed, 27 Aug 2008 19:11:56 +0000 Subject: Adding a test to make sure Find restarts properly after a timeout. BUG=1155639 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1456 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/find_in_page_controller_uitest.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'chrome/browser/find_in_page_controller_uitest.cc') diff --git a/chrome/browser/find_in_page_controller_uitest.cc b/chrome/browser/find_in_page_controller_uitest.cc index d8e722a..2845c07 100644 --- a/chrome/browser/find_in_page_controller_uitest.cc +++ b/chrome/browser/find_in_page_controller_uitest.cc @@ -17,6 +17,7 @@ class FindInPageControllerTest : public UITest { const std::wstring kFramePage = L"files/find_in_page/frames.html"; const std::wstring kUserSelectPage = L"files/find_in_page/user-select.html"; const std::wstring kCrashPage = L"files/find_in_page/crash_1341577.html"; +const std::wstring kTooFewMatchesPage = L"files/find_in_page/bug_1155639.html"; // This test loads a page with frames and starts FindInPage requests TEST_F(FindInPageControllerTest, FindInPageFrames) { @@ -95,3 +96,23 @@ TEST_F(FindInPageControllerTest, DISABLED_FindCrash_Issue1341577) { EXPECT_EQ(1, tab->FindInPage(L"\u0D24\u0D46", FWD, IGNORE_CASE, false)); EXPECT_EQ(0, tab->FindInPage(L"nostring", FWD, IGNORE_CASE, false)); } + +// Test to make sure Find does the right thing when restarting from a timeout. +// We used to have a problem where we'd stop finding matches when all of the +// following conditions were true: +// 1) The page has a lot of text to search. +// 2) The page contains more than one match. +// 3) It takes longer than the time-slice given to each Find operation (100 +// ms) to find one or more of those matches (so Find times out and has to try +// again from where it left off). +TEST_F(FindInPageControllerTest, FindEnoughMatches_Issue1341577) { + TestServer server(L"chrome/test/data"); + + GURL url = server.TestServerPageW(kTooFewMatchesPage); + scoped_ptr tab(GetActiveTab()); + ASSERT_TRUE(tab->NavigateToURL(url)); + + // This string appears 5 times at the bottom of a long page. If Find restarts + // properly after a timeout, it will find 5 matches, not just 1. + EXPECT_EQ(5, tab->FindInPage(L"008.xml", FWD, IGNORE_CASE, false)); +} -- cgit v1.1