diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-02 19:05:19 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-02 19:05:19 +0000 |
commit | 3a31d4855b91065ffd87d7de3f4db0ef92c94ec7 (patch) | |
tree | a6e7f7e5b57cd1cf9d8741260e81882142a74ff4 /chrome/browser/views/find_bar_host_browsertest.cc | |
parent | 8062678b6b02902058d2a688099a650783fc5556 (diff) | |
download | chromium_src-3a31d4855b91065ffd87d7de3f4db0ef92c94ec7.zip chromium_src-3a31d4855b91065ffd87d7de3f4db0ef92c94ec7.tar.gz chromium_src-3a31d4855b91065ffd87d7de3f4db0ef92c94ec7.tar.bz2 |
The focus would only be restored properly the first time the
find-in-bar box was closed.
Also wrote an interactive ui test and took the opportunity to convert the existing find-in-bar interactive ui test to be a browser test.
BUG=23599
TEST=See bug.
Review URL: http://codereview.chromium.org/251064
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27875 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/find_bar_host_browsertest.cc')
-rw-r--r-- | chrome/browser/views/find_bar_host_browsertest.cc | 248 |
1 files changed, 123 insertions, 125 deletions
diff --git a/chrome/browser/views/find_bar_host_browsertest.cc b/chrome/browser/views/find_bar_host_browsertest.cc index caed556..6c108de 100644 --- a/chrome/browser/views/find_bar_host_browsertest.cc +++ b/chrome/browser/views/find_bar_host_browsertest.cc @@ -28,61 +28,11 @@ const std::wstring kPrematureEnd = L"files/find_in_page/premature_end.html"; const std::wstring kMoveIfOver = L"files/find_in_page/move_if_obscuring.html"; const std::wstring kBitstackCrash = L"files/find_in_page/crash_14491.html"; -namespace { +const bool kBack = false; +const bool kFwd = true; -class FindInPageNotificationObserver : public NotificationObserver { - public: - explicit FindInPageNotificationObserver(TabContents* parent_tab) - : parent_tab_(parent_tab), - active_match_ordinal_(-1), - number_of_matches_(0) { - current_find_request_id_ = parent_tab->current_find_request_id(); - registrar_.Add(this, NotificationType::FIND_RESULT_AVAILABLE, - Source<TabContents>(parent_tab_)); - ui_test_utils::RunMessageLoop(); - } - - int active_match_ordinal() const { return active_match_ordinal_; } - - int number_of_matches() const { return number_of_matches_; } - - virtual void Observe(NotificationType type, const NotificationSource& source, - const NotificationDetails& details) { - if (type == NotificationType::FIND_RESULT_AVAILABLE) { - Details<FindNotificationDetails> find_details(details); - if (find_details->request_id() == current_find_request_id_) { - // We get multiple responses and one of those will contain the ordinal. - // This message comes to us before the final update is sent. - if (find_details->active_match_ordinal() > -1) - active_match_ordinal_ = find_details->active_match_ordinal(); - if (find_details->final_update()) { - number_of_matches_ = find_details->number_of_matches(); - MessageLoopForUI::current()->Quit(); - } else { - DLOG(INFO) << "Ignoring, since we only care about the final message"; - } - } - } else { - NOTREACHED(); - } - } - - private: - NotificationRegistrar registrar_; - TabContents* parent_tab_; - // We will at some point (before final update) be notified of the ordinal and - // we need to preserve it so we can send it later. - int active_match_ordinal_; - int number_of_matches_; - // The id of the current find request, obtained from TabContents. Allows us - // to monitor when the search completes. - int current_find_request_id_; -}; - -} // namespace - -typedef enum { BACK = 0, FWD = 1 } FindInPageDirection; -typedef enum { IGNORE_CASE = 0, CASE_SENSITIVE = 1 } FindInPageCase; +const bool kIgnoreCase = false; +const bool kCaseSensitive = true; class FindInPageControllerTest : public InProcessBrowserTest { public: @@ -91,21 +41,6 @@ class FindInPageControllerTest : public InProcessBrowserTest { } protected: - int FindInPage(const std::wstring& search_string, - FindInPageDirection forward, - FindInPageCase match_case, - int* ordinal) { - TabContents* tab_contents = browser()->GetSelectedTabContents(); - tab_contents->StartFinding(search_string, forward == FWD, - match_case == CASE_SENSITIVE); - - FindInPageNotificationObserver observer = - FindInPageNotificationObserver(tab_contents); - if (ordinal) - *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(); @@ -123,55 +58,73 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageFrames) { // Try incremental search (mimicking user typing in). int ordinal = 0; - EXPECT_EQ(18, FindInPage(L"g", FWD, IGNORE_CASE, &ordinal)); + TabContents* tab = browser()->GetSelectedTabContents(); + EXPECT_EQ(18, ui_test_utils::FindInPage(tab, L"g", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); - EXPECT_EQ(11, FindInPage(L"go", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(11, ui_test_utils::FindInPage(tab, L"go", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); - EXPECT_EQ(04, FindInPage(L"goo", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(04, ui_test_utils::FindInPage(tab, L"goo", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); - EXPECT_EQ(03, FindInPage(L"goog", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(03, ui_test_utils::FindInPage(tab, L"goog", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); - EXPECT_EQ(02, FindInPage(L"googl", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(02, ui_test_utils::FindInPage(tab, L"googl", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); - EXPECT_EQ(01, FindInPage(L"google", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(01, ui_test_utils::FindInPage(tab, L"google", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); - EXPECT_EQ(00, FindInPage(L"google!", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(00, ui_test_utils::FindInPage(tab, L"google!", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(0, ordinal); // Negative test (no matches should be found). - EXPECT_EQ(0, FindInPage(L"Non-existing string", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(0, ui_test_utils::FindInPage(tab, L"Non-existing string", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(0, ordinal); // 'horse' only exists in the three right frames. - EXPECT_EQ(3, FindInPage(L"horse", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(3, ui_test_utils::FindInPage(tab, L"horse", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); // 'cat' only exists in the first frame. - EXPECT_EQ(1, FindInPage(L"cat", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(1, ui_test_utils::FindInPage(tab, L"cat", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); // Try searching again, should still come up with 1 match. - EXPECT_EQ(1, FindInPage(L"cat", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(1, ui_test_utils::FindInPage(tab, L"cat", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); // Try searching backwards, ignoring case, should still come up with 1 match. - EXPECT_EQ(1, FindInPage(L"CAT", BACK, IGNORE_CASE, &ordinal)); + EXPECT_EQ(1, ui_test_utils::FindInPage(tab, L"CAT", + kBack, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); // Try case sensitive, should NOT find it. - EXPECT_EQ(0, FindInPage(L"CAT", FWD, CASE_SENSITIVE, &ordinal)); + EXPECT_EQ(0, ui_test_utils::FindInPage(tab, L"CAT", + kFwd, kCaseSensitive, &ordinal)); EXPECT_EQ(0, ordinal); // Try again case sensitive, but this time with right case. - EXPECT_EQ(1, FindInPage(L"dog", FWD, CASE_SENSITIVE, &ordinal)); + EXPECT_EQ(1, ui_test_utils::FindInPage(tab, L"dog", + kFwd, kCaseSensitive, &ordinal)); EXPECT_EQ(1, ordinal); // Try non-Latin characters ('Hreggvidur' with 'eth' for 'd' in left frame). - EXPECT_EQ(1, FindInPage(L"Hreggvi\u00F0ur", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(1, ui_test_utils::FindInPage(tab, L"Hreggvi\u00F0ur", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); - EXPECT_EQ(1, FindInPage(L"Hreggvi\u00F0ur", FWD, CASE_SENSITIVE, &ordinal)); + EXPECT_EQ(1, ui_test_utils::FindInPage(tab, L"Hreggvi\u00F0ur", + kFwd, kCaseSensitive, &ordinal)); EXPECT_EQ(1, ordinal); - EXPECT_EQ(0, FindInPage(L"hreggvi\u00F0ur", FWD, CASE_SENSITIVE, &ordinal)); + EXPECT_EQ(0, ui_test_utils::FindInPage(tab, L"hreggvi\u00F0ur", + kFwd, kCaseSensitive, &ordinal)); EXPECT_EQ(0, ordinal); } @@ -203,7 +156,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageEndState) { // Search for a text that exists within a link on the page. int ordinal = 0; - EXPECT_EQ(1, FindInPage(L"nk", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(1, ui_test_utils::FindInPage(tab_contents, L"nk", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); // End the find session, which should set focus to the link. @@ -213,7 +167,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageEndState) { EXPECT_STREQ("link1", FocusedOnPage(tab_contents).c_str()); // Search for a text that exists within a link on the page. - EXPECT_EQ(1, FindInPage(L"Google", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(1, ui_test_utils::FindInPage(tab_contents, L"Google", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); // Move the selection to link 1, after searching. @@ -242,23 +197,31 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageOrdinal) { // Search for 'o', which should make the first item active and return // '1 in 3' (1st ordinal of a total of 3 matches). + TabContents* tab = browser()->GetSelectedTabContents(); int ordinal = 0; - EXPECT_EQ(3, FindInPage(L"o", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(3, ui_test_utils::FindInPage(tab, L"o", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); - EXPECT_EQ(3, FindInPage(L"o", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(3, ui_test_utils::FindInPage(tab, L"o", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(2, ordinal); - EXPECT_EQ(3, FindInPage(L"o", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(3, ui_test_utils::FindInPage(tab, L"o", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(3, ordinal); // Go back one match. - EXPECT_EQ(3, FindInPage(L"o", BACK, IGNORE_CASE, &ordinal)); + EXPECT_EQ(3, ui_test_utils::FindInPage(tab, L"o", + kBack, kIgnoreCase, &ordinal)); EXPECT_EQ(2, ordinal); - EXPECT_EQ(3, FindInPage(L"o", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(3, ui_test_utils::FindInPage(tab, L"o", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(3, ordinal); // This should wrap to the top. - EXPECT_EQ(3, FindInPage(L"o", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(3, ui_test_utils::FindInPage(tab, L"o", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); // This should go back to the end. - EXPECT_EQ(3, FindInPage(L"o", BACK, IGNORE_CASE, &ordinal)); + EXPECT_EQ(3, ui_test_utils::FindInPage(tab, L"o", + kBack, kIgnoreCase, &ordinal)); EXPECT_EQ(3, ordinal); } @@ -273,31 +236,43 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageMultiFramesOrdinal) { // Search for 'a', which should make the first item active and return // '1 in 7' (1st ordinal of a total of 7 matches). + TabContents* tab = browser()->GetSelectedTabContents(); int ordinal = 0; - EXPECT_EQ(7, FindInPage(L"a", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(7, + ui_test_utils::FindInPage(tab, L"a", kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); - EXPECT_EQ(7, FindInPage(L"a", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(7, + ui_test_utils::FindInPage(tab, L"a", kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(2, ordinal); - EXPECT_EQ(7, FindInPage(L"a", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(7, + ui_test_utils::FindInPage(tab, L"a", kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(3, ordinal); - EXPECT_EQ(7, FindInPage(L"a", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(7, + ui_test_utils::FindInPage(tab, L"a", kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(4, ordinal); // Go back one, which should go back one frame. - EXPECT_EQ(7, FindInPage(L"a", BACK, IGNORE_CASE, &ordinal)); + EXPECT_EQ(7, + ui_test_utils::FindInPage(tab, L"a", kBack, kIgnoreCase, &ordinal)); EXPECT_EQ(3, ordinal); - EXPECT_EQ(7, FindInPage(L"a", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(7, + ui_test_utils::FindInPage(tab, L"a", kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(4, ordinal); - EXPECT_EQ(7, FindInPage(L"a", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(7, + ui_test_utils::FindInPage(tab, L"a", kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(5, ordinal); - EXPECT_EQ(7, FindInPage(L"a", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(7, + ui_test_utils::FindInPage(tab, L"a", kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(6, ordinal); - EXPECT_EQ(7, FindInPage(L"a", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(7, + ui_test_utils::FindInPage(tab, L"a", kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(7, ordinal); // Now we should wrap back to frame 1. - EXPECT_EQ(7, FindInPage(L"a", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(7, + ui_test_utils::FindInPage(tab, L"a", kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); // Now we should wrap back to frame last frame. - EXPECT_EQ(7, FindInPage(L"a", BACK, IGNORE_CASE, &ordinal)); + EXPECT_EQ(7, + ui_test_utils::FindInPage(tab, L"a", kBack, kIgnoreCase, &ordinal)); EXPECT_EQ(7, ordinal); } @@ -312,17 +287,23 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPage_Issue5132) { // Search for 'goa' three times (6 matches on page). int ordinal = 0; - EXPECT_EQ(6, FindInPage(L"goa", FWD, IGNORE_CASE, &ordinal)); + TabContents* tab = browser()->GetSelectedTabContents(); + EXPECT_EQ(6, ui_test_utils::FindInPage(tab, L"goa", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); - EXPECT_EQ(6, FindInPage(L"goa", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(6, ui_test_utils::FindInPage(tab, L"goa", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(2, ordinal); - EXPECT_EQ(6, FindInPage(L"goa", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(6, ui_test_utils::FindInPage(tab, L"goa", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(3, ordinal); // Add space to search (should result in no matches). - EXPECT_EQ(0, FindInPage(L"goa ", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(0, ui_test_utils::FindInPage(tab, L"goa ", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(0, ordinal); // Remove the space, should be back to '3 out of 6') - EXPECT_EQ(6, FindInPage(L"goa", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(6, ui_test_utils::FindInPage(tab, L"goa", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(3, ordinal); } @@ -335,9 +316,12 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindUnSelectableText) { ui_test_utils::NavigateToURL(browser(), url); int ordinal = 0; - EXPECT_EQ(0, FindInPage(L"text", FWD, IGNORE_CASE, &ordinal)); + TabContents* tab = browser()->GetSelectedTabContents(); + EXPECT_EQ(0, ui_test_utils::FindInPage(tab, L"text", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(-1, ordinal); // Nothing is selected. - EXPECT_EQ(0, FindInPage(L"Non-existing string", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(0, ui_test_utils::FindInPage(tab, L"Non-existing string", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(0, ordinal); } @@ -359,13 +343,16 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindCrash_Issue1341577) { // TODO(jungshik): According to a native Malayalam speaker, it's ok not // to find U+0D4C. Still need to investigate further this issue. int ordinal = 0; - FindInPage(L"\u0D4C", FWD, IGNORE_CASE, &ordinal); - FindInPage(L"\u0D4C", FWD, IGNORE_CASE, &ordinal); + TabContents* tab = browser()->GetSelectedTabContents(); + ui_test_utils::FindInPage(tab, L"\u0D4C", kFwd, kIgnoreCase, &ordinal); + ui_test_utils::FindInPage(tab, L"\u0D4C", kFwd, kIgnoreCase, &ordinal); // This should work fine. - EXPECT_EQ(1, FindInPage(L"\u0D24\u0D46", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(1, ui_test_utils::FindInPage(tab, L"\u0D24\u0D46", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); - EXPECT_EQ(0, FindInPage(L"nostring", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(0, ui_test_utils::FindInPage(tab, L"nostring", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(0, ordinal); } @@ -380,7 +367,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindCrash_Issue14491) { // This used to crash the tab. int ordinal = 0; - EXPECT_EQ(0, FindInPage(L"s", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(0, ui_test_utils::FindInPage(browser()->GetSelectedTabContents(), + L"s", kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(0, ordinal); } @@ -402,7 +390,9 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindRestarts_Issue1155639) { // 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. int ordinal = 0; - EXPECT_EQ(5, FindInPage(L"008.xml", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(5, ui_test_utils::FindInPage(browser()->GetSelectedTabContents(), + L"008.xml", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); } @@ -421,7 +411,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, // Search for a text that exists within a link on the page. int ordinal = 0; - EXPECT_EQ(2, FindInPage(L"html ", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(2, ui_test_utils::FindInPage(tab_contents, L"html ", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); } @@ -526,7 +517,9 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, // Search for 'dream' which the Find box is obscuring. int ordinal = 0; - EXPECT_EQ(1, FindInPage(L"dream", FWD, IGNORE_CASE, &ordinal)); + TabContents* tab = browser()->GetSelectedTabContents(); + EXPECT_EQ(1, ui_test_utils::FindInPage(tab, L"dream", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); // Make sure Find box has moved. @@ -536,7 +529,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, EXPECT_TRUE(fully_visible); // Search for 'Too much' which the Find box is not obscuring. - EXPECT_EQ(1, FindInPage(L"Too much", FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(1, ui_test_utils::FindInPage(tab, L"Too much", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(1, ordinal); // Make sure Find box has moved back to its original location. @@ -556,7 +550,9 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, // Search for 'no_match'. No matches should be found. int ordinal = 0; - EXPECT_EQ(0, FindInPage(L"no_match", FWD, IGNORE_CASE, &ordinal)); + TabContents* tab = browser()->GetSelectedTabContents(); + EXPECT_EQ(0, ui_test_utils::FindInPage(tab, L"no_match", + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(0, ordinal); // Open another tab (tab B). @@ -565,7 +561,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, // Simulate what happens when you press F3 for FindNext. We should get a // response here (a hang means search was aborted). - EXPECT_EQ(0, FindInPage(std::wstring(), FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(0, ui_test_utils::FindInPage(tab, std::wstring(), + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(0, ordinal); // Open another tab (tab C). @@ -574,7 +571,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, // Simulate what happens when you press F3 for FindNext. We should get a // response here (a hang means search was aborted). - EXPECT_EQ(0, FindInPage(std::wstring(), FWD, IGNORE_CASE, &ordinal)); + EXPECT_EQ(0, ui_test_utils::FindInPage(tab, std::wstring(), + kFwd, kIgnoreCase, &ordinal)); EXPECT_EQ(0, ordinal); } |