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

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
« no previous file with comments | « chrome/browser/ui/views/find_bar_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 browser()->GetFindBarController()->Show();
102 EXPECT_TRUE(
103 ui_test_utils::IsViewFocused(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
104 ui_test_utils::FindInPage(
105 browser()->tab_strip_model()->GetActiveWebContents(), ASCIIToUTF16("a"),
106 true, false, NULL, NULL);
107
108 // The textfield should be focused after pressing [Enter] on the find button.
109 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_TAB, false,
110 false, false, false));
111 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_RETURN, false,
112 false, false, false));
113 EXPECT_TRUE(
114 ui_test_utils::IsViewFocused(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
115
116 // The textfield should be focused after pressing [Enter] on the find button.
117 ui_test_utils::FindInPage(
118 browser()->tab_strip_model()->GetActiveWebContents(), ASCIIToUTF16("b"),
119 true, false, NULL, NULL);
120 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_TAB, false,
121 false, false, false));
122 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_TAB, false,
123 false, false, false));
124 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_RETURN, false,
125 false, false, false));
126 EXPECT_TRUE(
127 ui_test_utils::IsViewFocused(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
128 }
129
93 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) 130 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
94 // TODO(erg): linux_aura bringup: http://crbug.com/163931 131 // TODO(erg): linux_aura bringup: http://crbug.com/163931
95 #define MAYBE_FocusRestore DISABLED_FocusRestore 132 #define MAYBE_FocusRestore DISABLED_FocusRestore
96 #else 133 #else
97 #define MAYBE_FocusRestore FocusRestore 134 #define MAYBE_FocusRestore FocusRestore
98 #endif 135 #endif
99 136
100 // Flaky because the test server fails to start? See: http://crbug.com/96594. 137 // Flaky because the test server fails to start? See: http://crbug.com/96594.
101 IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestore) { 138 IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestore) {
102 ASSERT_TRUE(test_server()->Start()); 139 ASSERT_TRUE(test_server()->Start());
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 ui_test_utils::UrlLoadObserver observer( 472 ui_test_utils::UrlLoadObserver observer(
436 GURL("about:blank"), content::NotificationService::AllSources()); 473 GURL("about:blank"), content::NotificationService::AllSources());
437 474
438 // Send Ctrl-Enter, should cause navigation to about:blank. 475 // Send Ctrl-Enter, should cause navigation to about:blank.
439 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( 476 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
440 browser(), ui::VKEY_RETURN, true, false, false, false)); 477 browser(), ui::VKEY_RETURN, true, false, false, false));
441 478
442 observer.Wait(); 479 observer.Wait();
443 } 480 }
444 #endif 481 #endif
OLDNEW
« 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