| 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/common/accelerators/accelerator_controller.h" | 7 #include "ash/common/accelerators/accelerator_controller.h" |
| 8 #include "ash/common/accelerators/accelerator_table.h" | 8 #include "ash/common/accelerators/accelerator_table.h" |
| 9 #include "ash/common/accessibility_types.h" | 9 #include "ash/common/accessibility_types.h" |
| 10 #include "ash/common/system/tray/system_tray.h" | 10 #include "ash/common/system/tray/system_tray.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 void EnableChromeVox() { | 126 void EnableChromeVox() { |
| 127 // Test setup. | 127 // Test setup. |
| 128 // Enable ChromeVox, skip welcome message/notification, and disable earcons. | 128 // Enable ChromeVox, skip welcome message/notification, and disable earcons. |
| 129 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | 129 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| 130 | 130 |
| 131 AccessibilityManager::Get()->EnableSpokenFeedback( | 131 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 132 true, ash::A11Y_NOTIFICATION_NONE); | 132 true, ash::A11Y_NOTIFICATION_NONE); |
| 133 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); | 133 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); |
| 134 DisableEarcons(); | 134 DisableEarcons(); |
| 135 | |
| 136 // Ensure we skip all other startup messages by sending an additional speak | |
| 137 // call. | |
| 138 RunJavaScriptInChromeVoxBackgroundPage( | |
| 139 "cvox.ChromeVox.tts.speak('ready to test');"); | |
| 140 EXPECT_TRUE(speech_monitor_.SkipChromeVoxMessage("ready to test")); | |
| 141 } | 135 } |
| 142 | 136 |
| 143 void PressRepeatedlyUntilUtterance(ui::KeyboardCode key, | 137 void PressRepeatedlyUntilUtterance(ui::KeyboardCode key, |
| 144 const std::string& expected_utterance) { | 138 const std::string& expected_utterance) { |
| 145 // This helper function is needed when you want to poll for something | 139 // This helper function is needed when you want to poll for something |
| 146 // that happens asynchronously. Keep pressing |key|, until | 140 // that happens asynchronously. Keep pressing |key|, until |
| 147 // the speech feedback that follows is |expected_utterance|. | 141 // the speech feedback that follows is |expected_utterance|. |
| 148 // Note that this doesn't work if pressing that key doesn't speak anything | 142 // Note that this doesn't work if pressing that key doesn't speak anything |
| 149 // at all before the asynchronous event occurred. | 143 // at all before the asynchronous event occurred. |
| 150 while (true) { | 144 while (true) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 while (true) { | 197 while (true) { |
| 204 std::string utterance = speech_monitor_.GetNextUtterance(); | 198 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 205 VLOG(0) << "Got utterance: " << utterance; | 199 VLOG(0) << "Got utterance: " << utterance; |
| 206 if (utterance == "Bookmarks,") | 200 if (utterance == "Bookmarks,") |
| 207 break; | 201 break; |
| 208 } | 202 } |
| 209 EXPECT_EQ("foo,", speech_monitor_.GetNextUtterance()); | 203 EXPECT_EQ("foo,", speech_monitor_.GetNextUtterance()); |
| 210 EXPECT_EQ("button", speech_monitor_.GetNextUtterance()); | 204 EXPECT_EQ("button", speech_monitor_.GetNextUtterance()); |
| 211 } | 205 } |
| 212 | 206 |
| 213 IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest, NavigateNotificationCenter) { | 207 IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest, |
| 208 DISABLED_NavigateNotificationCenter) { |
| 214 EnableChromeVox(); | 209 EnableChromeVox(); |
| 215 | 210 |
| 216 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_MESSAGE_CENTER_BUBBLE)); | 211 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_MESSAGE_CENTER_BUBBLE)); |
| 217 | 212 |
| 218 // Tab to request the initial focus. | 213 // Tab to request the initial focus. |
| 219 SendKeyPress(ui::VKEY_TAB); | 214 SendKeyPress(ui::VKEY_TAB); |
| 220 | 215 |
| 221 // Wait for it to say "Notification Center, window". | 216 // Wait for it to say "Notification Center, window". |
| 222 while ("Notification Center, window" != speech_monitor_.GetNextUtterance()) { | 217 while ("Notification Center, window" != speech_monitor_.GetNextUtterance()) { |
| 223 } | 218 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 EnableChromeVox(); | 281 EnableChromeVox(); |
| 287 } | 282 } |
| 288 | 283 |
| 289 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) { | 284 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) { |
| 290 EnableChromeVox(); | 285 EnableChromeVox(); |
| 291 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); | 286 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); |
| 292 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance()); | 287 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance()); |
| 293 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 288 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
| 294 } | 289 } |
| 295 | 290 |
| 296 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) { | 291 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_TypeInOmnibox) { |
| 297 EnableChromeVox(); | 292 EnableChromeVox(); |
| 298 | 293 |
| 299 // Location bar has focus by default so just start typing. | 294 // Location bar has focus by default so just start typing. |
| 300 SendKeyPress(ui::VKEY_X); | 295 SendKeyPress(ui::VKEY_X); |
| 301 EXPECT_EQ("x", speech_monitor_.GetNextUtterance()); | 296 EXPECT_EQ("x", speech_monitor_.GetNextUtterance()); |
| 302 | 297 |
| 303 SendKeyPress(ui::VKEY_Y); | 298 SendKeyPress(ui::VKEY_Y); |
| 304 EXPECT_EQ("y", speech_monitor_.GetNextUtterance()); | 299 EXPECT_EQ("y", speech_monitor_.GetNextUtterance()); |
| 305 | 300 |
| 306 SendKeyPress(ui::VKEY_Z); | 301 SendKeyPress(ui::VKEY_Z); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 483 |
| 489 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OverviewMode) { | 484 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OverviewMode) { |
| 490 EnableChromeVox(); | 485 EnableChromeVox(); |
| 491 | 486 |
| 492 EXPECT_TRUE(PerformAcceleratorAction(ash::TOGGLE_OVERVIEW)); | 487 EXPECT_TRUE(PerformAcceleratorAction(ash::TOGGLE_OVERVIEW)); |
| 493 while (true) { | 488 while (true) { |
| 494 std::string utterance = speech_monitor_.GetNextUtterance(); | 489 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 495 if (base::MatchPattern(utterance, "Edit text")) | 490 if (base::MatchPattern(utterance, "Edit text")) |
| 496 break; | 491 break; |
| 497 } | 492 } |
| 498 EXPECT_EQ("Alert", speech_monitor_.GetNextUtterance()); | 493 |
| 499 EXPECT_EQ("Entered window overview mode", speech_monitor_.GetNextUtterance()); | 494 EXPECT_EQ("Entered window overview mode", speech_monitor_.GetNextUtterance()); |
| 500 | 495 |
| 501 SendKeyPress(ui::VKEY_TAB); | 496 SendKeyPress(ui::VKEY_TAB); |
| 502 // On Chrome OS accessibility title for tabbed browser windows contains app | 497 // On Chrome OS accessibility title for tabbed browser windows contains app |
| 503 // name ("Chrome" or "Chromium") in overview mode. | 498 // name ("Chrome" or "Chromium") in overview mode. |
| 504 while (true) { | 499 while (true) { |
| 505 std::string utterance = speech_monitor_.GetNextUtterance(); | 500 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 506 if (base::MatchPattern(utterance, "Chromium - about:blank")) | 501 if (base::MatchPattern(utterance, "Chromium - about:blank")) |
| 507 break; | 502 break; |
| 508 } | 503 } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( | 705 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( |
| 711 window, ui::VKEY_TAB, false, true /*shift*/, false, false)); | 706 window, ui::VKEY_TAB, false, true /*shift*/, false, false)); |
| 712 while (speech_monitor_.GetNextUtterance() != "Select your language:") { | 707 while (speech_monitor_.GetNextUtterance() != "Select your language:") { |
| 713 } | 708 } |
| 714 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); | 709 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); |
| 715 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), | 710 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), |
| 716 "Combo box * of *")); | 711 "Combo box * of *")); |
| 717 } | 712 } |
| 718 | 713 |
| 719 } // namespace chromeos | 714 } // namespace chromeos |
| OLD | NEW |