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/test/base/in_process_browser_test.h" | 26 #include "chrome/test/base/in_process_browser_test.h" |
27 #include "chrome/test/base/interactive_test_utils.h" | 27 #include "chrome/test/base/interactive_test_utils.h" |
28 #include "chrome/test/base/testing_profile.h" | 28 #include "chrome/test/base/testing_profile.h" |
29 #include "chrome/test/base/ui_test_utils.h" | 29 #include "chrome/test/base/ui_test_utils.h" |
30 #include "chromeos/chromeos_switches.h" | 30 #include "chromeos/chromeos_switches.h" |
31 #include "chromeos/login/user_names.h" | 31 #include "chromeos/login/user_names.h" |
32 #include "content/public/common/url_constants.h" | 32 #include "content/public/common/url_constants.h" |
33 #include "content/public/test/browser_test_utils.h" | 33 #include "content/public/test/browser_test_utils.h" |
34 #include "content/public/test/test_utils.h" | 34 #include "content/public/test/test_utils.h" |
35 #include "extensions/browser/extension_host.h" | |
36 #include "extensions/browser/process_manager.h" | |
37 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
38 #include "ui/base/test/ui_controls.h" | 36 #include "ui/base/test/ui_controls.h" |
39 #include "ui/views/widget/widget.h" | 37 #include "ui/views/widget/widget.h" |
40 | 38 |
41 using extensions::api::braille_display_private::StubBrailleController; | 39 using extensions::api::braille_display_private::StubBrailleController; |
42 | 40 |
43 namespace chromeos { | 41 namespace chromeos { |
44 | 42 |
45 // | 43 // |
46 // Spoken feedback tests only in a logged in user's window. | 44 // Spoken feedback tests only in a logged in user's window. |
(...skipping 13 matching lines...) Expand all Loading... |
60 } | 58 } |
61 | 59 |
62 void SendKeyPress(ui::KeyboardCode key) { | 60 void SendKeyPress(ui::KeyboardCode key) { |
63 gfx::NativeWindow root_window = | 61 gfx::NativeWindow root_window = |
64 ash::Shell::GetInstance()->GetPrimaryRootWindow(); | 62 ash::Shell::GetInstance()->GetPrimaryRootWindow(); |
65 ASSERT_TRUE( | 63 ASSERT_TRUE( |
66 ui_test_utils::SendKeyPressToWindowSync( | 64 ui_test_utils::SendKeyPressToWindowSync( |
67 root_window, key, false, false, false, false)); | 65 root_window, key, false, false, false, false)); |
68 } | 66 } |
69 | 67 |
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: | 68 private: |
84 StubBrailleController braille_controller_; | 69 StubBrailleController braille_controller_; |
85 DISALLOW_COPY_AND_ASSIGN(LoggedInSpokenFeedbackTest); | 70 DISALLOW_COPY_AND_ASSIGN(LoggedInSpokenFeedbackTest); |
86 }; | 71 }; |
87 | 72 |
88 // http://crbug.com/396507 | 73 // http://crbug.com/396507 |
89 IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest, DISABLED_AddBookmark) { | 74 IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest, DISABLED_AddBookmark) { |
90 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | 75 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
91 | 76 |
92 SpeechMonitor monitor; | 77 SpeechMonitor monitor; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } | 210 } |
226 | 211 |
227 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) { | 212 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) { |
228 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | 213 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
229 | 214 |
230 SpeechMonitor monitor; | 215 SpeechMonitor monitor; |
231 AccessibilityManager::Get()->EnableSpokenFeedback( | 216 AccessibilityManager::Get()->EnableSpokenFeedback( |
232 true, ash::A11Y_NOTIFICATION_NONE); | 217 true, ash::A11Y_NOTIFICATION_NONE); |
233 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); | 218 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); |
234 | 219 |
235 SimulateTouchScreenInChromeVox(); | 220 accessibility::SimulateTouchScreenInChromeVoxForTest(browser()->profile()); |
236 | 221 |
237 // Send an accessibility hover event on the system tray, which is | 222 // 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. | 223 // what we get when you tap it on a touch screen when ChromeVox is on. |
239 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); | 224 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); |
240 tray->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); | 225 tray->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); |
241 | 226 |
242 EXPECT_EQ("Status tray,", monitor.GetNextUtterance()); | 227 EXPECT_EQ("Status tray,", monitor.GetNextUtterance()); |
243 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "time*,")); | 228 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "time*,")); |
244 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Battery*,")); | 229 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Battery*,")); |
245 EXPECT_EQ("button", monitor.GetNextUtterance()); | 230 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()); | 308 EXPECT_EQ("Select your language:", monitor.GetNextUtterance()); |
324 EXPECT_EQ("English ( United States)", monitor.GetNextUtterance()); | 309 EXPECT_EQ("English ( United States)", monitor.GetNextUtterance()); |
325 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Combo box * of *")); | 310 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Combo box * of *")); |
326 ASSERT_TRUE( | 311 ASSERT_TRUE( |
327 ui_test_utils::SendKeyPressToWindowSync( | 312 ui_test_utils::SendKeyPressToWindowSync( |
328 window, ui::VKEY_TAB, false, false, false, false)); | 313 window, ui::VKEY_TAB, false, false, false, false)); |
329 EXPECT_EQ("Select your keyboard:", monitor.GetNextUtterance()); | 314 EXPECT_EQ("Select your keyboard:", monitor.GetNextUtterance()); |
330 } | 315 } |
331 | 316 |
332 } // namespace chromeos | 317 } // namespace chromeos |
OLD | NEW |