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

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: Adding test case. 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
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..f692551b71f69a10af0433f768781eac52e63230 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,35 @@ 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.
+ GURL url = test_server()->GetURL(kSimplePage);
msw 2015/08/26 18:44:32 nit: inline test_server()->GetURL(kSimplePage) in
Deepak 2015/08/27 05:31:04 Done.
+ ui_test_utils::NavigateToURL(browser(), url);
+ // Show the Find bar.
+ chrome::FocusLocationBar(browser());
msw 2015/08/26 18:44:32 Focusing the location bar seems unnecessary here;
Deepak 2015/08/27 05:31:04 Done.
+ EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX));
+ // Ensure the creation of the find bar controller.
+ browser()->GetFindBarController()->Show();
+ EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(),
+ VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
+ ui_test_utils::FindInPage(
msw 2015/08/26 18:44:32 Fix indentation.
Deepak 2015/08/27 05:31:04 Done.
+ browser()->tab_strip_model()->GetActiveWebContents(),
+ ASCIIToUTF16("a"), true, false, NULL, NULL);
+
+ ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
msw 2015/08/26 18:44:32 Add a similar check for the 'v' (previous) button
Deepak 2015/08/27 05:31:04 Done.
+ 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(),
msw 2015/08/26 18:44:32 Fix indentation... You'll also need to update this
Deepak 2015/08/27 05:31:04 Done.
+ VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
+}
msw 2015/08/26 18:44:32 Please add a similar test for mouse events.
Deepak 2015/08/27 05:31:04 I have tried to add mouse event test case, But for
msw 2015/08/27 18:09:02 Acknowledged.
+
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
// TODO(erg): linux_aura bringup: http://crbug.com/163931
#define MAYBE_FocusRestore DISABLED_FocusRestore
« 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