OLD | NEW |
---|---|
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 Loading... | |
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 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.
| |
100 ui_test_utils::NavigateToURL(browser(), url); | |
101 // Show the Find bar. | |
102 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.
| |
103 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); | |
104 // Ensure the creation of the find bar controller. | |
105 browser()->GetFindBarController()->Show(); | |
106 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), | |
107 VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); | |
108 ui_test_utils::FindInPage( | |
msw
2015/08/26 18:44:32
Fix indentation.
Deepak
2015/08/27 05:31:04
Done.
| |
109 browser()->tab_strip_model()->GetActiveWebContents(), | |
110 ASCIIToUTF16("a"), true, false, NULL, NULL); | |
111 | |
112 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.
| |
113 browser(), ui::VKEY_TAB, false, false, false, false)); | |
114 | |
115 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | |
116 browser(), ui::VKEY_RETURN, false, false, false, false)); | |
117 | |
118 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.
| |
119 VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); | |
120 } | |
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.
| |
121 | |
93 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) | 122 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) |
94 // TODO(erg): linux_aura bringup: http://crbug.com/163931 | 123 // TODO(erg): linux_aura bringup: http://crbug.com/163931 |
95 #define MAYBE_FocusRestore DISABLED_FocusRestore | 124 #define MAYBE_FocusRestore DISABLED_FocusRestore |
96 #else | 125 #else |
97 #define MAYBE_FocusRestore FocusRestore | 126 #define MAYBE_FocusRestore FocusRestore |
98 #endif | 127 #endif |
99 | 128 |
100 // Flaky because the test server fails to start? See: http://crbug.com/96594. | 129 // Flaky because the test server fails to start? See: http://crbug.com/96594. |
101 IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestore) { | 130 IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestore) { |
102 ASSERT_TRUE(test_server()->Start()); | 131 ASSERT_TRUE(test_server()->Start()); |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
435 ui_test_utils::UrlLoadObserver observer( | 464 ui_test_utils::UrlLoadObserver observer( |
436 GURL("about:blank"), content::NotificationService::AllSources()); | 465 GURL("about:blank"), content::NotificationService::AllSources()); |
437 | 466 |
438 // Send Ctrl-Enter, should cause navigation to about:blank. | 467 // Send Ctrl-Enter, should cause navigation to about:blank. |
439 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 468 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
440 browser(), ui::VKEY_RETURN, true, false, false, false)); | 469 browser(), ui::VKEY_RETURN, true, false, false, false)); |
441 | 470 |
442 observer.Wait(); | 471 observer.Wait(); |
443 } | 472 } |
444 #endif | 473 #endif |
OLD | NEW |