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

Side by Side Diff: chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc

Issue 535283004: Revert of Add test for ChromeVox keyboard commands. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/aura/test/ui_controls_factory_aurax11.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <queue> 5 #include <queue>
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/tray/system_tray.h" 8 #include "ash/system/tray/system_tray.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 54 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
55 AccessibilityManager::SetBrailleControllerForTest(&braille_controller_); 55 AccessibilityManager::SetBrailleControllerForTest(&braille_controller_);
56 } 56 }
57 57
58 virtual void TearDownOnMainThread() OVERRIDE { 58 virtual void TearDownOnMainThread() OVERRIDE {
59 AccessibilityManager::SetBrailleControllerForTest(NULL); 59 AccessibilityManager::SetBrailleControllerForTest(NULL);
60 } 60 }
61 61
62 void SendKeyPress(ui::KeyboardCode key) { 62 void SendKeyPress(ui::KeyboardCode key) {
63 ASSERT_NO_FATAL_FAILURE( 63 gfx::NativeWindow root_window =
64 ASSERT_TRUE( 64 ash::Shell::GetInstance()->GetPrimaryRootWindow();
65 ui_test_utils::SendKeyPressToWindowSync( 65 ASSERT_TRUE(
66 NULL, key, false, false, false, false))); 66 ui_test_utils::SendKeyPressToWindowSync(
67 } 67 root_window, key, false, false, false, false));
68
69 void SendKeyPressWithControl(ui::KeyboardCode key) {
70 ASSERT_NO_FATAL_FAILURE(
71 ASSERT_TRUE(
72 ui_test_utils::SendKeyPressToWindowSync(
73 NULL, key, true, false, false, false)));
74 }
75
76 void SendKeyPressWithSearchAndShift(ui::KeyboardCode key) {
77 ASSERT_NO_FATAL_FAILURE(
78 ASSERT_TRUE(
79 ui_test_utils::SendKeyPressToWindowSync(
80 NULL, key, false, true, false, true)));
81 } 68 }
82 69
83 void RunJavaScriptInChromeVoxBackgroundPage(const std::string& script) { 70 void RunJavaScriptInChromeVoxBackgroundPage(const std::string& script) {
84 extensions::ExtensionHost* host = 71 extensions::ExtensionHost* host =
85 extensions::ExtensionSystem::Get(browser()->profile())-> 72 extensions::ExtensionSystem::Get(browser()->profile())->
86 process_manager()->GetBackgroundHostForExtension( 73 process_manager()->GetBackgroundHostForExtension(
87 extension_misc::kChromeVoxExtensionId); 74 extension_misc::kChromeVoxExtensionId);
88 CHECK(content::ExecuteScript(host->host_contents(), script)); 75 CHECK(content::ExecuteScript(host->host_contents(), script));
89 } 76 }
90 77
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 SendKeyPress(ui::VKEY_Y); 231 SendKeyPress(ui::VKEY_Y);
245 EXPECT_EQ("y", monitor.GetNextUtterance()); 232 EXPECT_EQ("y", monitor.GetNextUtterance());
246 233
247 SendKeyPress(ui::VKEY_Z); 234 SendKeyPress(ui::VKEY_Z);
248 EXPECT_EQ("z", monitor.GetNextUtterance()); 235 EXPECT_EQ("z", monitor.GetNextUtterance());
249 236
250 SendKeyPress(ui::VKEY_BACK); 237 SendKeyPress(ui::VKEY_BACK);
251 EXPECT_EQ("z", monitor.GetNextUtterance()); 238 EXPECT_EQ("z", monitor.GetNextUtterance());
252 } 239 }
253 240
254 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxShiftSearch) {
255 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
256
257 SpeechMonitor monitor;
258 AccessibilityManager::Get()->EnableSpokenFeedback(
259 true, ash::A11Y_NOTIFICATION_NONE);
260 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage());
261
262 ui_test_utils::NavigateToURL(
263 browser(),
264 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>"));
265 while (true) {
266 std::string utterance = monitor.GetNextUtterance();
267 if (utterance == "Click me")
268 break;
269 }
270 EXPECT_EQ("Button", monitor.GetNextUtterance());
271
272 // Press Search+Shift+/ to enter ChromeVox's "find in page".
273 SendKeyPressWithSearchAndShift(ui::VKEY_OEM_2);
274 EXPECT_EQ("Find in page.", monitor.GetNextUtterance());
275 EXPECT_EQ("Enter a search query.", monitor.GetNextUtterance());
276 }
277
278 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxPrefixKey) {
279 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
280
281 SpeechMonitor monitor;
282 AccessibilityManager::Get()->EnableSpokenFeedback(
283 true, ash::A11Y_NOTIFICATION_NONE);
284 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage());
285
286 ui_test_utils::NavigateToURL(
287 browser(),
288 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>"));
289 while (true) {
290 std::string utterance = monitor.GetNextUtterance();
291 if (utterance == "Click me")
292 break;
293 }
294 EXPECT_EQ("Button", monitor.GetNextUtterance());
295
296 // Press the prefix key Ctrl+';' followed by '/'
297 // to enter ChromeVox's "find in page".
298 SendKeyPressWithControl(ui::VKEY_OEM_1);
299 SendKeyPress(ui::VKEY_OEM_2);
300 EXPECT_EQ("Find in page.", monitor.GetNextUtterance());
301 EXPECT_EQ("Enter a search query.", monitor.GetNextUtterance());
302 }
303
304 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxNavigateAndSelect) {
305 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
306
307 SpeechMonitor monitor;
308 AccessibilityManager::Get()->EnableSpokenFeedback(
309 true, ash::A11Y_NOTIFICATION_NONE);
310 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage());
311
312 ui_test_utils::NavigateToURL(
313 browser(),
314 GURL("data:text/html;charset=utf-8,"
315 "<h1>Title</h1>"
316 "<button autofocus>Click me</button>"));
317 while (true) {
318 std::string utterance = monitor.GetNextUtterance();
319 if (utterance == "Click me")
320 break;
321 }
322 EXPECT_EQ("Button", monitor.GetNextUtterance());
323
324 // Press Search+Shift+Up to navigate to the previous item.
325 SendKeyPressWithSearchAndShift(ui::VKEY_UP);
326 EXPECT_EQ("Title", monitor.GetNextUtterance());
327 EXPECT_EQ("Heading 1", monitor.GetNextUtterance());
328
329 // Press Search+Shift+S to select the text.
330 SendKeyPressWithSearchAndShift(ui::VKEY_S);
331 EXPECT_EQ("Start selection", monitor.GetNextUtterance());
332 EXPECT_EQ("Title", monitor.GetNextUtterance());
333 EXPECT_EQ(", selected", monitor.GetNextUtterance());
334
335 // Press again to end the selection.
336 SendKeyPressWithSearchAndShift(ui::VKEY_S);
337 EXPECT_EQ("End selection", monitor.GetNextUtterance());
338 EXPECT_EQ("Title", monitor.GetNextUtterance());
339 }
340
341 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) { 241 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) {
342 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 242 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
343 243
344 SpeechMonitor monitor; 244 SpeechMonitor monitor;
345 AccessibilityManager::Get()->EnableSpokenFeedback( 245 AccessibilityManager::Get()->EnableSpokenFeedback(
346 true, ash::A11Y_NOTIFICATION_NONE); 246 true, ash::A11Y_NOTIFICATION_NONE);
347 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); 247 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage());
348 DisableEarcons(); 248 DisableEarcons();
349 249
350 SimulateTouchScreenInChromeVox(); 250 SimulateTouchScreenInChromeVox();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 EXPECT_EQ("Select your language:", monitor.GetNextUtterance()); 339 EXPECT_EQ("Select your language:", monitor.GetNextUtterance());
440 EXPECT_EQ("English ( United States)", monitor.GetNextUtterance()); 340 EXPECT_EQ("English ( United States)", monitor.GetNextUtterance());
441 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Combo box * of *")); 341 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Combo box * of *"));
442 ASSERT_TRUE( 342 ASSERT_TRUE(
443 ui_test_utils::SendKeyPressToWindowSync( 343 ui_test_utils::SendKeyPressToWindowSync(
444 window, ui::VKEY_TAB, false, false, false, false)); 344 window, ui::VKEY_TAB, false, false, false, false));
445 EXPECT_EQ("Select your keyboard:", monitor.GetNextUtterance()); 345 EXPECT_EQ("Select your keyboard:", monitor.GetNextUtterance());
446 } 346 }
447 347
448 } // namespace chromeos 348 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | ui/aura/test/ui_controls_factory_aurax11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698