OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 <oleacc.h> | 5 #include <oleacc.h> |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/win/scoped_bstr.h" | 8 #include "base/win/scoped_bstr.h" |
9 #include "base/win/scoped_com_initializer.h" | 9 #include "base/win/scoped_com_initializer.h" |
10 #include "base/win/scoped_comptr.h" | 10 #include "base/win/scoped_comptr.h" |
11 #include "base/win/scoped_variant.h" | 11 #include "base/win/scoped_variant.h" |
12 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_commands.h" | 14 #include "chrome/browser/ui/browser_commands.h" |
15 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
16 #include "chrome/browser/ui/views/frame/browser_view.h" | 16 #include "chrome/browser/ui/views/frame/browser_view.h" |
17 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 17 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
18 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 18 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
19 #include "chrome/test/base/in_process_browser_test.h" | 19 #include "chrome/test/base/in_process_browser_test.h" |
20 #include "chrome/test/base/interactive_test_utils.h" | 20 #include "chrome/test/base/interactive_test_utils.h" |
21 #include "chrome/test/base/ui_test_utils.h" | 21 #include "chrome/test/base/ui_test_utils.h" |
22 #include "components/omnibox/browser/omnibox_view.h" | 22 #include "components/omnibox/browser/omnibox_view.h" |
23 #include "content/public/browser/browser_accessibility_state.h" | 23 #include "content/public/browser/browser_accessibility_state.h" |
24 #include "net/dns/mock_host_resolver.h" | 24 #include "net/dns/mock_host_resolver.h" |
| 25 #include "net/test/embedded_test_server/embedded_test_server.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
26 #include "ui/base/test/ui_controls.h" | 27 #include "ui/base/test/ui_controls.h" |
27 #include "url/gurl.h" | 28 #include "url/gurl.h" |
28 | 29 |
29 // We could move this into a utility file in the future if it ends up | 30 // We could move this into a utility file in the future if it ends up |
30 // being useful to other tests. | 31 // being useful to other tests. |
31 class WinAccessibilityEventMonitor { | 32 class WinAccessibilityEventMonitor { |
32 public: | 33 public: |
33 WinAccessibilityEventMonitor(UINT event_min, UINT event_max); | 34 WinAccessibilityEventMonitor(UINT event_min, UINT event_max); |
34 ~WinAccessibilityEventMonitor(); | 35 ~WinAccessibilityEventMonitor(); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 DISABLED_TestNavigateToNewUrl) { | 202 DISABLED_TestNavigateToNewUrl) { |
202 content::BrowserAccessibilityState::GetInstance()->EnableAccessibility(); | 203 content::BrowserAccessibilityState::GetInstance()->EnableAccessibility(); |
203 | 204 |
204 ui_test_utils::NavigateToURL(browser(), | 205 ui_test_utils::NavigateToURL(browser(), |
205 GURL("data:text/html;charset=utf-8," | 206 GURL("data:text/html;charset=utf-8," |
206 "<head><title>First Page</title></head>")); | 207 "<head><title>First Page</title></head>")); |
207 | 208 |
208 chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION); | 209 chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION); |
209 | 210 |
210 host_resolver()->AddRule("*", "127.0.0.1"); | 211 host_resolver()->AddRule("*", "127.0.0.1"); |
211 ASSERT_TRUE(test_server()->Start()); | 212 ASSERT_TRUE(embedded_test_server()->Start()); |
212 GURL main_url(test_server()->GetURL("files/english_page.html")); | 213 GURL main_url(embedded_test_server()->GetURL("/english_page.html")); |
213 | 214 |
214 OmniboxViewViews* omnibox_view = | 215 OmniboxViewViews* omnibox_view = |
215 BrowserView::GetBrowserViewForBrowser(browser())-> | 216 BrowserView::GetBrowserViewForBrowser(browser())-> |
216 toolbar()->location_bar()->omnibox_view(); | 217 toolbar()->location_bar()->omnibox_view(); |
217 omnibox_view->SetUserText(base::UTF8ToUTF16(main_url.spec()), | 218 omnibox_view->SetUserText(base::UTF8ToUTF16(main_url.spec()), |
218 base::UTF8ToUTF16(main_url.spec()), | 219 base::UTF8ToUTF16(main_url.spec()), |
219 false); | 220 false); |
220 | 221 |
221 WinAccessibilityEventMonitor monitor(EVENT_OBJECT_FOCUS, EVENT_OBJECT_FOCUS); | 222 WinAccessibilityEventMonitor monitor(EVENT_OBJECT_FOCUS, EVENT_OBJECT_FOCUS); |
222 SendKeyPress(ui::VKEY_RETURN); | 223 SendKeyPress(ui::VKEY_RETURN); |
(...skipping 25 matching lines...) Expand all Loading... |
248 // second page. | 249 // second page. |
249 EXPECT_NE("First Page", name); | 250 EXPECT_NE("First Page", name); |
250 | 251 |
251 // Finish when we get an event on the second page. | 252 // Finish when we get an event on the second page. |
252 if (name == "This page is in English") { | 253 if (name == "This page is in English") { |
253 LOG(INFO) << "Got event on second page, finishing test."; | 254 LOG(INFO) << "Got event on second page, finishing test."; |
254 break; | 255 break; |
255 } | 256 } |
256 } | 257 } |
257 } | 258 } |
OLD | NEW |