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

Unified Diff: chrome/browser/ui/views/find_bar_views_interactive_uitest.cc

Issue 1660273003: Keep focus on Find-In-Page buttons when using the keyboard to navigate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months 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
Index: chrome/browser/ui/views/find_bar_views_interactive_uitest.cc
diff --git a/chrome/browser/ui/views/find_bar_views_interactive_uitest.cc b/chrome/browser/ui/views/find_bar_views_interactive_uitest.cc
index bd706d650518990e39bbc1a5b207e965395b3be8..a10a71529c4a0a568cd9ac22667818b2d3c9824c 100644
--- a/chrome/browser/ui/views/find_bar_views_interactive_uitest.cc
+++ b/chrome/browser/ui/views/find_bar_views_interactive_uitest.cc
@@ -108,26 +108,57 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, NavigationByKeyEvent) {
browser()->tab_strip_model()->GetActiveWebContents(), ASCIIToUTF16("a"),
true, false, NULL, NULL);
- // The textfield should be focused after pressing [Enter] on the find button.
+ // The previous button should still be focused after pressing [Enter] on it.
ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_TAB, false,
false, false, false));
ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_RETURN, false,
false, false, false));
EXPECT_TRUE(
- ui_test_utils::IsViewFocused(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
+ ui_test_utils::IsViewFocused(browser(),
+ VIEW_ID_FIND_IN_PAGE_PREVIOUS_BUTTON));
- // The textfield should be focused after pressing [Enter] on the find button.
+ // The next button should still be focused after pressing [Enter] on it.
ui_test_utils::FindInPage(
browser()->tab_strip_model()->GetActiveWebContents(), ASCIIToUTF16("b"),
true, false, NULL, NULL);
ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_TAB, false,
false, false, false));
- ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_TAB, false,
- false, false, false));
ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_RETURN, false,
false, false, false));
EXPECT_TRUE(
+ ui_test_utils::IsViewFocused(browser(),
+ VIEW_ID_FIND_IN_PAGE_NEXT_BUTTON));
+}
+
+// TODO(mpistrich): Enable again when ui_test_utils::ClickOnView works with find
msw 2016/02/03 19:58:02 Why doesn't ClickOnView work with these buttons?
Mario Pistrich 2016/02/03 20:41:59 I couldn't figure it out why ClickOnView does not
msw 2016/02/03 21:43:34 Please file a bug and cite in this comment; follow
Mario Pistrich 2016/02/03 23:32:54 Done, see http://crbug.com/584043
+// bar view IDs.
+IN_PROC_BROWSER_TEST_F(FindInPageTest, DISABLED_NavigationByMouse) {
+ ASSERT_TRUE(embedded_test_server()->Start());
+ // Make sure Chrome is in the foreground, otherwise sending input
+ // won't do anything and the test will hang.
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+ // First we navigate to any page.
+ ui_test_utils::NavigateToURL(browser(),
+ embedded_test_server()->GetURL(kSimplePage));
+ // Show the Find bar.
+ browser()->GetFindBarController()->Show();
+ EXPECT_TRUE(
ui_test_utils::IsViewFocused(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
+ ui_test_utils::FindInPage(
+ browser()->tab_strip_model()->GetActiveWebContents(), ASCIIToUTF16("a"),
+ true, false, NULL, NULL);
+
+ // The textfield should be focused after clicking on any button.
+ ui_test_utils::ClickOnView(browser(), VIEW_ID_FIND_IN_PAGE_PREVIOUS_BUTTON);
+ EXPECT_TRUE(
+ ui_test_utils::IsViewFocused(browser(),
+ VIEW_ID_FIND_IN_PAGE_PREVIOUS_BUTTON));
msw 2016/02/03 19:58:02 This should be VIEW_ID_FIND_IN_PAGE_TEXT_FIELD
Mario Pistrich 2016/02/03 20:41:59 Done.
+
+ // The textfield should be focused after clicking on any button.
+ ui_test_utils::ClickOnView(browser(), VIEW_ID_FIND_IN_PAGE_NEXT_BUTTON);
+ EXPECT_TRUE(
+ ui_test_utils::IsViewFocused(browser(),
+ VIEW_ID_FIND_IN_PAGE_NEXT_BUTTON));
msw 2016/02/03 19:58:02 Ditto: This should be VIEW_ID_FIND_IN_PAGE_TEXT_FI
Mario Pistrich 2016/02/03 20:41:59 Done.
}
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
« chrome/browser/ui/views/find_bar_view.cc ('K') | « chrome/browser/ui/views/find_bar_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698