OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/keyboard_codes.h" | 5 #include "base/keyboard_codes.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "chrome/browser/automation/ui_controls.h" | 7 #include "chrome/browser/automation/ui_controls.h" |
8 #include "chrome/browser/browser.h" | 8 #include "chrome/browser/browser.h" |
9 #include "chrome/browser/browser_window.h" | 9 #include "chrome/browser/browser_window.h" |
10 #include "chrome/browser/find_bar_controller.h" | 10 #include "chrome/browser/find_bar_controller.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 string16 GetFindBarText() { | 80 string16 GetFindBarText() { |
81 FindBarTesting* find_bar = | 81 FindBarTesting* find_bar = |
82 browser()->GetFindBarController()->find_bar()->GetFindBarTesting(); | 82 browser()->GetFindBarController()->find_bar()->GetFindBarTesting(); |
83 return find_bar->GetFindText(); | 83 return find_bar->GetFindText(); |
84 } | 84 } |
85 }; | 85 }; |
86 | 86 |
87 } // namespace | 87 } // namespace |
88 | 88 |
89 IN_PROC_BROWSER_TEST_F(FindInPageTest, CrashEscHandlers) { | 89 IN_PROC_BROWSER_TEST_F(FindInPageTest, CrashEscHandlers) { |
90 scoped_refptr<HTTPTestServer> server = | 90 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); |
91 HTTPTestServer::CreateServer(kDocRoot, NULL); | |
92 ASSERT_TRUE(NULL != server.get()); | 91 ASSERT_TRUE(NULL != server.get()); |
93 | 92 |
94 // First we navigate to our test page (tab A). | 93 // First we navigate to our test page (tab A). |
95 GURL url = server->TestServerPage(kSimplePage); | 94 GURL url = server->TestServerPage(kSimplePage); |
96 ui_test_utils::NavigateToURL(browser(), url); | 95 ui_test_utils::NavigateToURL(browser(), url); |
97 | 96 |
98 browser()->Find(); | 97 browser()->Find(); |
99 | 98 |
100 // Open another tab (tab B). | 99 // Open another tab (tab B). |
101 browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1, | 100 browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1, |
(...skipping 16 matching lines...) Expand all Loading... |
118 #endif | 117 #endif |
119 | 118 |
120 // This used to crash until bug 1303709 was fixed. | 119 // This used to crash until bug 1303709 was fixed. |
121 ui_controls::SendKeyPressNotifyWhenDone( | 120 ui_controls::SendKeyPressNotifyWhenDone( |
122 browser()->window()->GetNativeHandle(), base::VKEY_ESCAPE, | 121 browser()->window()->GetNativeHandle(), base::VKEY_ESCAPE, |
123 false, false, false, false, new MessageLoop::QuitTask()); | 122 false, false, false, false, new MessageLoop::QuitTask()); |
124 ui_test_utils::RunMessageLoop(); | 123 ui_test_utils::RunMessageLoop(); |
125 } | 124 } |
126 | 125 |
127 IN_PROC_BROWSER_TEST_F(FindInPageTest, FocusRestore) { | 126 IN_PROC_BROWSER_TEST_F(FindInPageTest, FocusRestore) { |
128 scoped_refptr<HTTPTestServer> server = | 127 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); |
129 HTTPTestServer::CreateServer(kDocRoot, NULL); | |
130 ASSERT_TRUE(NULL != server.get()); | 128 ASSERT_TRUE(NULL != server.get()); |
131 | 129 |
132 GURL url = server->TestServerPage("title1.html"); | 130 GURL url = server->TestServerPage("title1.html"); |
133 ui_test_utils::NavigateToURL(browser(), url); | 131 ui_test_utils::NavigateToURL(browser(), url); |
134 | 132 |
135 // Focus the location bar, open and close the find-in-page, focus should | 133 // Focus the location bar, open and close the find-in-page, focus should |
136 // return to the location bar. | 134 // return to the location bar. |
137 browser()->FocusLocationBar(); | 135 browser()->FocusLocationBar(); |
138 EXPECT_EQ(VIEW_ID_LOCATION_BAR, GetFocusedViewID()); | 136 EXPECT_EQ(VIEW_ID_LOCATION_BAR, GetFocusedViewID()); |
139 // Ensure the creation of the find bar controller. | 137 // Ensure the creation of the find bar controller. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // Press F3 to trigger FindNext. | 225 // Press F3 to trigger FindNext. |
228 ui_controls::SendKeyPressNotifyWhenDone(window, base::VKEY_F3, | 226 ui_controls::SendKeyPressNotifyWhenDone(window, base::VKEY_F3, |
229 false, false, false, false, // No modifiers. | 227 false, false, false, false, // No modifiers. |
230 new MessageLoop::QuitTask()); | 228 new MessageLoop::QuitTask()); |
231 ui_test_utils::RunMessageLoop(); | 229 ui_test_utils::RunMessageLoop(); |
232 | 230 |
233 // After the Find box has been reopened, it should still have no prepopulate | 231 // After the Find box has been reopened, it should still have no prepopulate |
234 // value. | 232 // value. |
235 EXPECT_EQ(string16(), GetFindBarText()); | 233 EXPECT_EQ(string16(), GetFindBarText()); |
236 } | 234 } |
OLD | NEW |