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

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

Issue 1305153004: Focus comes on the 'close button' in find bar when selecting 'Enter' key. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 4 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
« no previous file with comments | « chrome/browser/ui/views/find_bar_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 904fec606817c594ae58708904fb07bedd979a3f..d7d23b36199ef9ea12b387616052c988cf41a3fa 100644
--- a/chrome/browser/ui/views/find_bar_views_interactive_uitest.cc
+++ b/chrome/browser/ui/views/find_bar_views_interactive_uitest.cc
@@ -90,6 +90,43 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, CrashEscHandlers) {
browser(), ui::VKEY_ESCAPE, false, false, false, false));
}
+IN_PROC_BROWSER_TEST_F(FindInPageTest, NavigationByKeyEvent) {
+ ASSERT_TRUE(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(), 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 pressing [Enter] on the find button.
+ 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));
+
+ // The textfield should be focused after pressing [Enter] on the find button.
+ 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_TEXT_FIELD));
+}
+
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
// TODO(erg): linux_aura bringup: http://crbug.com/163931
#define MAYBE_FocusRestore DISABLED_FocusRestore
« no previous file with comments | « 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