OLD | NEW |
---|---|
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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 EXPECT_EQ("Start selection", monitor.GetNextUtterance()); | 331 EXPECT_EQ("Start selection", monitor.GetNextUtterance()); |
332 EXPECT_EQ("Title", monitor.GetNextUtterance()); | 332 EXPECT_EQ("Title", monitor.GetNextUtterance()); |
333 EXPECT_EQ(", selected", monitor.GetNextUtterance()); | 333 EXPECT_EQ(", selected", monitor.GetNextUtterance()); |
334 | 334 |
335 // Press again to end the selection. | 335 // Press again to end the selection. |
336 SendKeyPressWithSearchAndShift(ui::VKEY_S); | 336 SendKeyPressWithSearchAndShift(ui::VKEY_S); |
337 EXPECT_EQ("End selection", monitor.GetNextUtterance()); | 337 EXPECT_EQ("End selection", monitor.GetNextUtterance()); |
338 EXPECT_EQ("Title", monitor.GetNextUtterance()); | 338 EXPECT_EQ("Title", monitor.GetNextUtterance()); |
339 } | 339 } |
340 | 340 |
341 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxStickyMode) { | |
342 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | |
David Tseng
2014/09/25 20:36:57
ASSERT?
dmazzoni
2014/09/25 22:49:27
Done.
| |
343 | |
344 SpeechMonitor monitor; | |
345 AccessibilityManager::Get()->EnableSpokenFeedback( | |
346 true, ash::A11Y_NOTIFICATION_NONE); | |
347 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); | |
348 | |
349 ui_test_utils::NavigateToURL( | |
350 browser(), | |
351 GURL("data:text/html;charset=utf-8," | |
352 "<label>Enter your name <input autofocus></label>" | |
353 "<p>One</p>" | |
354 "<h2>Two</h2>")); | |
355 while (monitor.GetNextUtterance() != "Enter your name") { | |
356 } | |
357 EXPECT_EQ("Edit text", monitor.GetNextUtterance()); | |
358 | |
359 // Press the sticky-key sequence: Search Search. | |
360 SendKeyPress(ui::VKEY_LWIN); | |
361 SendKeyPress(ui::VKEY_LWIN); | |
362 EXPECT_EQ("Sticky mode enabled", monitor.GetNextUtterance()); | |
363 | |
364 // Even once we hear "sticky mode enabled" from the ChromeVox background | |
365 // page, there's a short window of time when the content script still | |
366 // hasn't switched to sticky mode. That's why we're focused on a text box. | |
367 // Keep pressing the '/' key. If sticky mode is off, it will echo the word | |
368 // "slash". If sticky mode is on, it will open "Find in page". Keep pressing | |
369 // '/' until we get "Find in page.". | |
370 while (true) { | |
David Tseng
2014/09/25 20:36:57
I've had to do something similar for ChromeVox Nex
dmazzoni
2014/09/25 22:49:27
Done.
| |
371 SendKeyPress(ui::VKEY_OEM_2); | |
372 const std::string& utterance = monitor.GetNextUtterance(); | |
373 if (utterance == "Find in page.") { | |
374 break; | |
375 } else { | |
376 ASSERT_EQ("slash", utterance); | |
377 } | |
378 } | |
379 EXPECT_EQ("Enter a search query.", monitor.GetNextUtterance()); | |
380 | |
381 // Press Esc to exit Find in Page mode. | |
382 SendKeyPress(ui::VKEY_ESCAPE); | |
383 EXPECT_EQ("Exited", monitor.GetNextUtterance()); | |
384 EXPECT_EQ("Find in page.", monitor.GetNextUtterance()); | |
385 | |
386 // Press N H to jump to the next heading. Skip over speech in-between | |
387 // but make sure we end up at the heading. | |
388 SendKeyPress(ui::VKEY_N); | |
389 SendKeyPress(ui::VKEY_H); | |
390 while (monitor.GetNextUtterance() != "Two") { | |
391 } | |
392 EXPECT_EQ("Heading 2", monitor.GetNextUtterance()); | |
393 | |
394 // Press the up arrow to go to the previous element. | |
395 SendKeyPress(ui::VKEY_UP); | |
396 EXPECT_EQ("One", monitor.GetNextUtterance()); | |
397 } | |
398 | |
341 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) { | 399 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) { |
342 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | 400 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
343 | 401 |
344 SpeechMonitor monitor; | 402 SpeechMonitor monitor; |
345 AccessibilityManager::Get()->EnableSpokenFeedback( | 403 AccessibilityManager::Get()->EnableSpokenFeedback( |
346 true, ash::A11Y_NOTIFICATION_NONE); | 404 true, ash::A11Y_NOTIFICATION_NONE); |
347 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); | 405 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); |
348 DisableEarcons(); | 406 DisableEarcons(); |
349 | 407 |
350 SimulateTouchScreenInChromeVox(); | 408 SimulateTouchScreenInChromeVox(); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
439 EXPECT_EQ("Select your language:", monitor.GetNextUtterance()); | 497 EXPECT_EQ("Select your language:", monitor.GetNextUtterance()); |
440 EXPECT_EQ("English ( United States)", monitor.GetNextUtterance()); | 498 EXPECT_EQ("English ( United States)", monitor.GetNextUtterance()); |
441 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Combo box * of *")); | 499 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Combo box * of *")); |
442 ASSERT_TRUE( | 500 ASSERT_TRUE( |
443 ui_test_utils::SendKeyPressToWindowSync( | 501 ui_test_utils::SendKeyPressToWindowSync( |
444 window, ui::VKEY_TAB, false, false, false, false)); | 502 window, ui::VKEY_TAB, false, false, false, false)); |
445 EXPECT_EQ("Select your keyboard:", monitor.GetNextUtterance()); | 503 EXPECT_EQ("Select your keyboard:", monitor.GetNextUtterance()); |
446 } | 504 } |
447 | 505 |
448 } // namespace chromeos | 506 } // namespace chromeos |
OLD | NEW |