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

Side by Side Diff: chrome/browser/ui/views/accessibility/navigation_accessibility_uitest_win.cc

Issue 2851103002: Update some host_resolver()->AddRules in chrome/browser. (Closed)
Patch Set: fix Created 3 years, 7 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
OLDNEW
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/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/win/scoped_bstr.h" 9 #include "base/win/scoped_bstr.h"
10 #include "base/win/scoped_com_initializer.h" 10 #include "base/win/scoped_com_initializer.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 instance_->OnWinEventHook(handle, event, hwnd, obj_id, child_id, 175 instance_->OnWinEventHook(handle, event, hwnd, obj_id, child_id,
176 event_thread, event_time); 176 event_thread, event_time);
177 } 177 }
178 } 178 }
179 179
180 class NavigationAccessibilityTest : public InProcessBrowserTest { 180 class NavigationAccessibilityTest : public InProcessBrowserTest {
181 protected: 181 protected:
182 NavigationAccessibilityTest() {} 182 NavigationAccessibilityTest() {}
183 ~NavigationAccessibilityTest() override {} 183 ~NavigationAccessibilityTest() override {}
184 184
185 void SetUpOnMainThread() override {
186 host_resolver()->AddRule("*", "127.0.0.1");
187 }
188
185 void SendKeyPress(ui::KeyboardCode key) { 189 void SendKeyPress(ui::KeyboardCode key) {
186 gfx::NativeWindow native_window = browser()->window()->GetNativeWindow(); 190 gfx::NativeWindow native_window = browser()->window()->GetNativeWindow();
187 ASSERT_NO_FATAL_FAILURE( 191 ASSERT_NO_FATAL_FAILURE(
188 ASSERT_TRUE( 192 ASSERT_TRUE(
189 ui_test_utils::SendKeyPressToWindowSync( 193 ui_test_utils::SendKeyPressToWindowSync(
190 native_window, key, false, false, false, false))); 194 native_window, key, false, false, false, false)));
191 } 195 }
192 196
193 private: 197 private:
194 base::win::ScopedCOMInitializer com_initializer_; 198 base::win::ScopedCOMInitializer com_initializer_;
195 199
196 DISALLOW_COPY_AND_ASSIGN(NavigationAccessibilityTest); 200 DISALLOW_COPY_AND_ASSIGN(NavigationAccessibilityTest);
197 }; 201 };
198 202
199 // Tests that when focus is in the omnibox and the user types a url and 203 // Tests that when focus is in the omnibox and the user types a url and
200 // presses enter, no focus events are sent on the old document. 204 // presses enter, no focus events are sent on the old document.
201 // TODO(dmazzoni): enable this test. http://crbug.com/421116 205 // TODO(dmazzoni): enable this test. http://crbug.com/421116
202 IN_PROC_BROWSER_TEST_F(NavigationAccessibilityTest, 206 IN_PROC_BROWSER_TEST_F(NavigationAccessibilityTest,
203 DISABLED_TestNavigateToNewUrl) { 207 DISABLED_TestNavigateToNewUrl) {
204 content::BrowserAccessibilityState::GetInstance()->EnableAccessibility(); 208 content::BrowserAccessibilityState::GetInstance()->EnableAccessibility();
205 209
206 ui_test_utils::NavigateToURL(browser(), 210 ui_test_utils::NavigateToURL(browser(),
207 GURL("data:text/html;charset=utf-8," 211 GURL("data:text/html;charset=utf-8,"
208 "<head><title>First Page</title></head>")); 212 "<head><title>First Page</title></head>"));
209 213
210 chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION); 214 chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION);
211 215
212 host_resolver()->AddRule("*", "127.0.0.1");
213 ASSERT_TRUE(embedded_test_server()->Start()); 216 ASSERT_TRUE(embedded_test_server()->Start());
214 GURL main_url(embedded_test_server()->GetURL("/english_page.html")); 217 GURL main_url(embedded_test_server()->GetURL("/english_page.html"));
215 218
216 OmniboxViewViews* omnibox_view = 219 OmniboxViewViews* omnibox_view =
217 BrowserView::GetBrowserViewForBrowser(browser())-> 220 BrowserView::GetBrowserViewForBrowser(browser())->
218 toolbar()->location_bar()->omnibox_view(); 221 toolbar()->location_bar()->omnibox_view();
219 omnibox_view->SetUserText(base::UTF8ToUTF16(main_url.spec()), 222 omnibox_view->SetUserText(base::UTF8ToUTF16(main_url.spec()),
220 false); 223 false);
221 224
222 WinAccessibilityEventMonitor monitor(EVENT_OBJECT_FOCUS, EVENT_OBJECT_FOCUS); 225 WinAccessibilityEventMonitor monitor(EVENT_OBJECT_FOCUS, EVENT_OBJECT_FOCUS);
(...skipping 26 matching lines...) Expand all
249 // second page. 252 // second page.
250 EXPECT_NE("First Page", name); 253 EXPECT_NE("First Page", name);
251 254
252 // Finish when we get an event on the second page. 255 // Finish when we get an event on the second page.
253 if (name == "This page is in English") { 256 if (name == "This page is in English") {
254 LOG(INFO) << "Got event on second page, finishing test."; 257 LOG(INFO) << "Got event on second page, finishing test.";
255 break; 258 break;
256 } 259 }
257 } 260 }
258 } 261 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698