Chromium Code Reviews| 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" |
| 11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
| 12 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 12 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 13 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | |
| 13 #include "chrome/browser/chromeos/accessibility/speech_monitor.h" | 14 #include "chrome/browser/chromeos/accessibility/speech_monitor.h" |
| 14 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 15 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 15 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 16 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 16 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 17 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
| 17 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 18 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 18 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con troller.h" | 19 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con troller.h" |
| 19 #include "chrome/browser/speech/tts_controller.h" | 20 #include "chrome/browser/speech/tts_controller.h" |
| 20 #include "chrome/browser/speech/tts_platform.h" | 21 #include "chrome/browser/speech/tts_platform.h" |
| 21 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
| 22 #include "chrome/browser/ui/browser_commands.h" | 23 #include "chrome/browser/ui/browser_commands.h" |
| 23 #include "chrome/browser/ui/browser_window.h" | 24 #include "chrome/browser/ui/browser_window.h" |
| 24 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/extensions/extension_constants.h" | 26 #include "chrome/common/extensions/extension_constants.h" |
| 26 #include "chrome/test/base/in_process_browser_test.h" | 27 #include "chrome/test/base/in_process_browser_test.h" |
| 27 #include "chrome/test/base/interactive_test_utils.h" | 28 #include "chrome/test/base/interactive_test_utils.h" |
| 28 #include "chrome/test/base/testing_profile.h" | 29 #include "chrome/test/base/testing_profile.h" |
| 29 #include "chrome/test/base/ui_test_utils.h" | 30 #include "chrome/test/base/ui_test_utils.h" |
| 30 #include "chromeos/chromeos_switches.h" | 31 #include "chromeos/chromeos_switches.h" |
| 31 #include "chromeos/login/user_names.h" | 32 #include "chromeos/login/user_names.h" |
| 32 #include "content/public/common/url_constants.h" | 33 #include "content/public/common/url_constants.h" |
| 33 #include "content/public/test/browser_test_utils.h" | 34 #include "content/public/test/browser_test_utils.h" |
| 34 #include "content/public/test/test_utils.h" | 35 #include "content/public/test/test_utils.h" |
| 35 #include "extensions/browser/extension_host.h" | 36 #include "extensions/browser/extension_host.h" |
|
James Cook
2014/08/08 20:26:46
You can probably remove this #include and the one
evy
2014/08/08 21:00:29
Done.
| |
| 36 #include "extensions/browser/process_manager.h" | 37 #include "extensions/browser/process_manager.h" |
| 37 #include "testing/gtest/include/gtest/gtest.h" | 38 #include "testing/gtest/include/gtest/gtest.h" |
| 38 #include "ui/base/test/ui_controls.h" | 39 #include "ui/base/test/ui_controls.h" |
| 39 #include "ui/views/widget/widget.h" | 40 #include "ui/views/widget/widget.h" |
| 40 | 41 |
| 41 using extensions::api::braille_display_private::StubBrailleController; | 42 using extensions::api::braille_display_private::StubBrailleController; |
| 42 | 43 |
| 43 namespace chromeos { | 44 namespace chromeos { |
| 44 | 45 |
| 45 // | 46 // |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 60 } | 61 } |
| 61 | 62 |
| 62 void SendKeyPress(ui::KeyboardCode key) { | 63 void SendKeyPress(ui::KeyboardCode key) { |
| 63 gfx::NativeWindow root_window = | 64 gfx::NativeWindow root_window = |
| 64 ash::Shell::GetInstance()->GetPrimaryRootWindow(); | 65 ash::Shell::GetInstance()->GetPrimaryRootWindow(); |
| 65 ASSERT_TRUE( | 66 ASSERT_TRUE( |
| 66 ui_test_utils::SendKeyPressToWindowSync( | 67 ui_test_utils::SendKeyPressToWindowSync( |
| 67 root_window, key, false, false, false, false)); | 68 root_window, key, false, false, false, false)); |
| 68 } | 69 } |
| 69 | 70 |
| 70 void SimulateTouchScreenInChromeVox() { | |
| 71 // ChromeVox looks at whether 'ontouchstart' exists to know whether | |
| 72 // or not it should respond to hover events. Fake it so that touch | |
| 73 // exploration events get spoken. | |
| 74 extensions::ExtensionHost* host = | |
| 75 extensions::ExtensionSystem::Get(browser()->profile())-> | |
| 76 process_manager()->GetBackgroundHostForExtension( | |
| 77 extension_misc::kChromeVoxExtensionId); | |
| 78 CHECK(content::ExecuteScript( | |
| 79 host->host_contents(), | |
| 80 "window.ontouchstart = function() {};")); | |
| 81 } | |
| 82 | |
| 83 private: | 71 private: |
| 84 StubBrailleController braille_controller_; | 72 StubBrailleController braille_controller_; |
| 85 DISALLOW_COPY_AND_ASSIGN(LoggedInSpokenFeedbackTest); | 73 DISALLOW_COPY_AND_ASSIGN(LoggedInSpokenFeedbackTest); |
| 86 }; | 74 }; |
| 87 | 75 |
| 88 // http://crbug.com/396507 | 76 // http://crbug.com/396507 |
| 89 IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest, DISABLED_AddBookmark) { | 77 IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest, DISABLED_AddBookmark) { |
| 90 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | 78 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| 91 | 79 |
| 92 SpeechMonitor monitor; | 80 SpeechMonitor monitor; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 } | 213 } |
| 226 | 214 |
| 227 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) { | 215 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) { |
| 228 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | 216 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| 229 | 217 |
| 230 SpeechMonitor monitor; | 218 SpeechMonitor monitor; |
| 231 AccessibilityManager::Get()->EnableSpokenFeedback( | 219 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 232 true, ash::A11Y_NOTIFICATION_NONE); | 220 true, ash::A11Y_NOTIFICATION_NONE); |
| 233 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); | 221 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); |
| 234 | 222 |
| 235 SimulateTouchScreenInChromeVox(); | 223 accessibility::SimulateTouchScreenInChromeVoxForTest(browser()->profile()); |
| 236 | 224 |
| 237 // Send an accessibility hover event on the system tray, which is | 225 // Send an accessibility hover event on the system tray, which is |
| 238 // what we get when you tap it on a touch screen when ChromeVox is on. | 226 // what we get when you tap it on a touch screen when ChromeVox is on. |
| 239 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); | 227 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); |
| 240 tray->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); | 228 tray->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); |
| 241 | 229 |
| 242 EXPECT_EQ("Status tray,", monitor.GetNextUtterance()); | 230 EXPECT_EQ("Status tray,", monitor.GetNextUtterance()); |
| 243 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "time*,")); | 231 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "time*,")); |
| 244 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Battery*,")); | 232 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Battery*,")); |
| 245 EXPECT_EQ("button", monitor.GetNextUtterance()); | 233 EXPECT_EQ("button", monitor.GetNextUtterance()); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 EXPECT_EQ("Select your language:", monitor.GetNextUtterance()); | 311 EXPECT_EQ("Select your language:", monitor.GetNextUtterance()); |
| 324 EXPECT_EQ("English ( United States)", monitor.GetNextUtterance()); | 312 EXPECT_EQ("English ( United States)", monitor.GetNextUtterance()); |
| 325 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Combo box * of *")); | 313 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Combo box * of *")); |
| 326 ASSERT_TRUE( | 314 ASSERT_TRUE( |
| 327 ui_test_utils::SendKeyPressToWindowSync( | 315 ui_test_utils::SendKeyPressToWindowSync( |
| 328 window, ui::VKEY_TAB, false, false, false, false)); | 316 window, ui::VKEY_TAB, false, false, false, false)); |
| 329 EXPECT_EQ("Select your keyboard:", monitor.GetNextUtterance()); | 317 EXPECT_EQ("Select your keyboard:", monitor.GetNextUtterance()); |
| 330 } | 318 } |
| 331 | 319 |
| 332 } // namespace chromeos | 320 } // namespace chromeos |
| OLD | NEW |