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

Side by Side Diff: chrome/browser/ui/views/find_bar_views_interactive_uitest.cc

Issue 1801313003: [M50 Merge] Disable Find-In-Page buttons when no text is entered (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 9 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/macros.h" 5 #include "base/macros.h"
6 #include "base/strings/string_util.h" 6 #include "base/strings/string_util.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 ui_test_utils::IsViewFocused(browser(), 155 ui_test_utils::IsViewFocused(browser(),
156 VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); 156 VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
157 157
158 // The textfield should be focused after clicking on any button. 158 // The textfield should be focused after clicking on any button.
159 ui_test_utils::ClickOnView(browser(), VIEW_ID_FIND_IN_PAGE_NEXT_BUTTON); 159 ui_test_utils::ClickOnView(browser(), VIEW_ID_FIND_IN_PAGE_NEXT_BUTTON);
160 EXPECT_TRUE( 160 EXPECT_TRUE(
161 ui_test_utils::IsViewFocused(browser(), 161 ui_test_utils::IsViewFocused(browser(),
162 VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); 162 VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
163 } 163 }
164 164
165 IN_PROC_BROWSER_TEST_F(FindInPageTest, ButtonsDisabledWithoutText) {
166 ASSERT_TRUE(embedded_test_server()->Start());
167 // Make sure Chrome is in the foreground, otherwise sending input
168 // won't do anything and the test will hang.
169 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
170 // First we navigate to any page.
171 ui_test_utils::NavigateToURL(browser(),
172 embedded_test_server()->GetURL(kSimplePage));
173 // Show the Find bar.
174 browser()->GetFindBarController()->Show();
175 EXPECT_TRUE(
176 ui_test_utils::IsViewFocused(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
177
178 // The buttons should be disabled as there is no text entered in the find bar
179 // and no search has been issued yet.
180 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_TAB, false,
181 false, false, false));
182 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(),
183 VIEW_ID_FIND_IN_PAGE_CLOSE_BUTTON));
184 }
185
165 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) 186 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
166 // TODO(erg): linux_aura bringup: http://crbug.com/163931 187 // TODO(erg): linux_aura bringup: http://crbug.com/163931
167 #define MAYBE_FocusRestore DISABLED_FocusRestore 188 #define MAYBE_FocusRestore DISABLED_FocusRestore
168 #else 189 #else
169 #define MAYBE_FocusRestore FocusRestore 190 #define MAYBE_FocusRestore FocusRestore
170 #endif 191 #endif
171 192
172 // Flaky because the test server fails to start? See: http://crbug.com/96594. 193 // Flaky because the test server fails to start? See: http://crbug.com/96594.
173 IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestore) { 194 IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestore) {
174 ASSERT_TRUE(embedded_test_server()->Start()); 195 ASSERT_TRUE(embedded_test_server()->Start());
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 ui_test_utils::UrlLoadObserver observer( 528 ui_test_utils::UrlLoadObserver observer(
508 GURL("about:blank"), content::NotificationService::AllSources()); 529 GURL("about:blank"), content::NotificationService::AllSources());
509 530
510 // Send Ctrl-Enter, should cause navigation to about:blank. 531 // Send Ctrl-Enter, should cause navigation to about:blank.
511 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( 532 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
512 browser(), ui::VKEY_RETURN, true, false, false, false)); 533 browser(), ui::VKEY_RETURN, true, false, false, false));
513 534
514 observer.Wait(); 535 observer.Wait();
515 } 536 }
516 #endif 537 #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