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

Side by Side 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, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/strings/string_util.h" 5 #include "base/strings/string_util.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_commands.h" 9 #include "chrome/browser/ui/browser_commands.h"
10 #include "chrome/browser/ui/browser_tabstrip.h" 10 #include "chrome/browser/ui/browser_tabstrip.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 ASSERT_NO_FATAL_FAILURE(ui_test_utils::ClickOnView(browser(), 83 ASSERT_NO_FATAL_FAILURE(ui_test_utils::ClickOnView(browser(),
84 VIEW_ID_OMNIBOX)); 84 VIEW_ID_OMNIBOX));
85 // Check the location bar is focused. 85 // Check the location bar is focused.
86 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); 86 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX));
87 87
88 // This used to crash until bug 1303709 was fixed. 88 // This used to crash until bug 1303709 was fixed.
89 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( 89 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
90 browser(), ui::VKEY_ESCAPE, false, false, false, false)); 90 browser(), ui::VKEY_ESCAPE, false, false, false, false));
91 } 91 }
92 92
93 IN_PROC_BROWSER_TEST_F(FindInPageTest, NavigationByKeyEvent) {
94 ASSERT_TRUE(test_server()->Start());
95 // Make sure Chrome is in the foreground, otherwise sending input
96 // won't do anything and the test will hang.
97 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
98 // First we navigate to any page.
99 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage));
100 // Show the Find bar.
101 chrome::FocusLocationBar(browser());
msw 2015/08/27 18:09:02 Remove this unnecessary step, as I previously aske
Deepak 2015/08/28 04:20:21 Done.
102 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX));
msw 2015/08/27 18:09:02 Remove this unnecessary step, as I previously aske
Deepak 2015/08/28 04:20:20 Done.
103 // Ensure the creation of the find bar controller.
msw 2015/08/27 18:09:02 Remove this comment (redundant with the one on lin
Deepak 2015/08/28 04:20:20 Done.
104 browser()->GetFindBarController()->Show();
105 EXPECT_TRUE(
106 ui_test_utils::IsViewFocused(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
107 ui_test_utils::FindInPage(
108 browser()->tab_strip_model()->GetActiveWebContents(), ASCIIToUTF16("a"),
109 true, false, NULL, NULL);
110
111 // Verifying that TextField will get focused when we select Enter key with
msw 2015/08/27 18:09:02 nit: "// The textfield should be focused after pre
Deepak 2015/08/28 04:20:20 Done.
112 // '/\' button focused in find bar.
113 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_TAB, false,
114 false, false, false));
115 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_RETURN, false,
116 false, false, false));
117 EXPECT_TRUE(
118 ui_test_utils::IsViewFocused(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
119
120 // Verifying that TextField will get focused when we select Enter key with
msw 2015/08/27 18:09:02 ditto nit: "// The textfield should be focused aft
Deepak 2015/08/28 04:20:20 Done.
121 // '\/' button focused in find bar.
122 ui_test_utils::FindInPage(
123 browser()->tab_strip_model()->GetActiveWebContents(), ASCIIToUTF16("b"),
124 true, false, NULL, NULL);
125 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_TAB, false,
126 false, false, false));
127 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_TAB, false,
128 false, false, false));
129 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_RETURN, false,
130 false, false, false));
131 EXPECT_TRUE(
132 ui_test_utils::IsViewFocused(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
133 }
134
93 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) 135 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
94 // TODO(erg): linux_aura bringup: http://crbug.com/163931 136 // TODO(erg): linux_aura bringup: http://crbug.com/163931
95 #define MAYBE_FocusRestore DISABLED_FocusRestore 137 #define MAYBE_FocusRestore DISABLED_FocusRestore
96 #else 138 #else
97 #define MAYBE_FocusRestore FocusRestore 139 #define MAYBE_FocusRestore FocusRestore
98 #endif 140 #endif
99 141
100 // Flaky because the test server fails to start? See: http://crbug.com/96594. 142 // Flaky because the test server fails to start? See: http://crbug.com/96594.
101 IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestore) { 143 IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestore) {
102 ASSERT_TRUE(test_server()->Start()); 144 ASSERT_TRUE(test_server()->Start());
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 ui_test_utils::UrlLoadObserver observer( 477 ui_test_utils::UrlLoadObserver observer(
436 GURL("about:blank"), content::NotificationService::AllSources()); 478 GURL("about:blank"), content::NotificationService::AllSources());
437 479
438 // Send Ctrl-Enter, should cause navigation to about:blank. 480 // Send Ctrl-Enter, should cause navigation to about:blank.
439 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( 481 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
440 browser(), ui::VKEY_RETURN, true, false, false, false)); 482 browser(), ui::VKEY_RETURN, true, false, false, false));
441 483
442 observer.Wait(); 484 observer.Wait();
443 } 485 }
444 #endif 486 #endif
OLDNEW
« 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