Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7627)

Unified Diff: chrome/browser/views/find_bar_host_browsertest.cc

Issue 335012: Update the find result index "(m of n)" whenever there is an active selection... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: simplify test Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/renderer/render_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/find_bar_host_browsertest.cc
===================================================================
--- chrome/browser/views/find_bar_host_browsertest.cc (revision 31004)
+++ chrome/browser/views/find_bar_host_browsertest.cc (working copy)
@@ -27,6 +27,8 @@
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";
+const std::wstring kSelectChangesOrdinal =
+ L"files/find_in_page/select_changes_ordinal.html";
const bool kBack = false;
const bool kFwd = true;
@@ -225,6 +227,43 @@
EXPECT_EQ(3, ordinal);
}
+// This tests that the ordinal is correctly adjusted after a selection
+IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
+ SelectChangesOrdinal_Issue20883) {
+ HTTPTestServer* server = StartHTTPServer();
+
+ // First we navigate to our test content.
+ GURL url = server->TestServerPageW(kSelectChangesOrdinal);
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ TabContents* tab_contents = browser()->GetSelectedTabContents();
+ ASSERT_TRUE(NULL != tab_contents);
+
+ // Search for a text that exists within a link on the page.
+ TabContents* tab = browser()->GetSelectedTabContents();
+ int ordinal = 0;
+ EXPECT_EQ(4, ui_test_utils::FindInPage(tab_contents, L"google",
+ kFwd, kIgnoreCase, &ordinal));
+ EXPECT_EQ(1, ordinal);
+
+ // Move the selection to link 1, after searching.
+ std::string result;
+ ui_test_utils::ExecuteJavaScriptAndExtractString(
+ tab_contents->render_view_host(),
+ L"",
+ L"window.domAutomationController.send(selectLink1());",
+ &result);
+
+ // Do a find-next after the selection. This should move forward
+ // from there to the 3rd instance of 'google'.
+ EXPECT_EQ(4, ui_test_utils::FindInPage(tab, L"google",
+ kFwd, kIgnoreCase, &ordinal));
+ EXPECT_EQ(3, ordinal);
+
+ // End the find session.
+ tab_contents->StopFinding(false);
+}
+
// This test loads a page with frames and makes sure the ordinal returned makes
// sense.
IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageMultiFramesOrdinal) {
« no previous file with comments | « no previous file | chrome/renderer/render_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698