| 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/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/accelerators/accelerator_table.h" | 8 #include "ash/accelerators/accelerator_table.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 RunJavaScriptInChromeVoxBackgroundPage( | 113 RunJavaScriptInChromeVoxBackgroundPage( |
| 114 "cvox.ChromeVox.earcons.playEarcon = function() {};"); | 114 "cvox.ChromeVox.earcons.playEarcon = function() {};"); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void EnableChromeVox() { | 117 void EnableChromeVox() { |
| 118 // Test setup. | 118 // Test setup. |
| 119 // Enable ChromeVox, skip welcome message, and disable earcons. | 119 // Enable ChromeVox, skip welcome message, and disable earcons. |
| 120 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | 120 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| 121 | 121 |
| 122 AccessibilityManager::Get()->EnableSpokenFeedback( | 122 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 123 true, ash::A11Y_NOTIFICATION_NONE); | 123 true, ui::A11Y_NOTIFICATION_NONE); |
| 124 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); | 124 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); |
| 125 DisableEarcons(); | 125 DisableEarcons(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void LoadChromeVoxAndThenNavigateToURL(const GURL& url) { | 128 void LoadChromeVoxAndThenNavigateToURL(const GURL& url) { |
| 129 // The goal of this helper function is to avoid race conditions between | 129 // The goal of this helper function is to avoid race conditions between |
| 130 // the page loading and the ChromeVox extension loading and fully | 130 // the page loading and the ChromeVox extension loading and fully |
| 131 // initializing. To do this, we first load a test url that repeatedly | 131 // initializing. To do this, we first load a test url that repeatedly |
| 132 // asks ChromeVox to speak 'ready', then we load ChromeVox and block | 132 // asks ChromeVox to speak 'ready', then we load ChromeVox and block |
| 133 // until we get that 'ready' speech. | 133 // until we get that 'ready' speech. |
| 134 | 134 |
| 135 ui_test_utils::NavigateToURL( | 135 ui_test_utils::NavigateToURL( |
| 136 browser(), | 136 browser(), |
| 137 GURL("data:text/html;charset=utf-8," | 137 GURL("data:text/html;charset=utf-8," |
| 138 "<script>" | 138 "<script>" |
| 139 "window.setInterval(function() {" | 139 "window.setInterval(function() {" |
| 140 " try {" | 140 " try {" |
| 141 " cvox.Api.speak('ready');" | 141 " cvox.Api.speak('ready');" |
| 142 " } catch (e) {}" | 142 " } catch (e) {}" |
| 143 "}, 100);" | 143 "}, 100);" |
| 144 "</script>")); | 144 "</script>")); |
| 145 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | 145 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| 146 AccessibilityManager::Get()->EnableSpokenFeedback( | 146 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 147 true, ash::A11Y_NOTIFICATION_NONE); | 147 true, ui::A11Y_NOTIFICATION_NONE); |
| 148 | 148 |
| 149 // Block until we get "ready". | 149 // Block until we get "ready". |
| 150 while (speech_monitor_.GetNextUtterance() != "ready") { | 150 while (speech_monitor_.GetNextUtterance() != "ready") { |
| 151 } | 151 } |
| 152 | 152 |
| 153 // Now load the requested url. | 153 // Now load the requested url. |
| 154 ui_test_utils::NavigateToURL(browser(), url); | 154 ui_test_utils::NavigateToURL(browser(), url); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void PressRepeatedlyUntilUtterance(ui::KeyboardCode key, | 157 void PressRepeatedlyUntilUtterance(ui::KeyboardCode key, |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 IN_PROC_BROWSER_TEST_F(OobeSpokenFeedbackTest, DISABLED_SpokenFeedbackInOobe) { | 485 IN_PROC_BROWSER_TEST_F(OobeSpokenFeedbackTest, DISABLED_SpokenFeedbackInOobe) { |
| 486 ui_controls::EnableUIControls(); | 486 ui_controls::EnableUIControls(); |
| 487 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | 487 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| 488 | 488 |
| 489 LoginDisplayHost* login_display_host = LoginDisplayHostImpl::default_host(); | 489 LoginDisplayHost* login_display_host = LoginDisplayHostImpl::default_host(); |
| 490 WebUILoginView* web_ui_login_view = login_display_host->GetWebUILoginView(); | 490 WebUILoginView* web_ui_login_view = login_display_host->GetWebUILoginView(); |
| 491 views::Widget* widget = web_ui_login_view->GetWidget(); | 491 views::Widget* widget = web_ui_login_view->GetWidget(); |
| 492 gfx::NativeWindow window = widget->GetNativeWindow(); | 492 gfx::NativeWindow window = widget->GetNativeWindow(); |
| 493 | 493 |
| 494 AccessibilityManager::Get()->EnableSpokenFeedback( | 494 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 495 true, ash::A11Y_NOTIFICATION_NONE); | 495 true, ui::A11Y_NOTIFICATION_NONE); |
| 496 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); | 496 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); |
| 497 | 497 |
| 498 EXPECT_EQ("Select your language:", speech_monitor_.GetNextUtterance()); | 498 EXPECT_EQ("Select your language:", speech_monitor_.GetNextUtterance()); |
| 499 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); | 499 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); |
| 500 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), | 500 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), |
| 501 "Combo box * of *")); | 501 "Combo box * of *")); |
| 502 ASSERT_TRUE( | 502 ASSERT_TRUE( |
| 503 ui_test_utils::SendKeyPressToWindowSync( | 503 ui_test_utils::SendKeyPressToWindowSync( |
| 504 window, ui::VKEY_TAB, false, false, false, false)); | 504 window, ui::VKEY_TAB, false, false, false, false)); |
| 505 EXPECT_EQ("Select your keyboard:", speech_monitor_.GetNextUtterance()); | 505 EXPECT_EQ("Select your keyboard:", speech_monitor_.GetNextUtterance()); |
| 506 } | 506 } |
| 507 | 507 |
| 508 } // namespace chromeos | 508 } // namespace chromeos |
| OLD | NEW |