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" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after 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()); |
246 } | 234 } |
247 | 235 |
236 | |
James Cook
2014/08/08 17:06:32
nit: Only one blank line between these sections
evy
2014/08/08 18:37:47
Done.
| |
237 | |
248 // | 238 // |
249 // Spoken feedback tests that run only in guest mode. | 239 // Spoken feedback tests that run only in guest mode. |
250 // | 240 // |
251 | 241 |
252 class GuestSpokenFeedbackTest : public LoggedInSpokenFeedbackTest { | 242 class GuestSpokenFeedbackTest : public LoggedInSpokenFeedbackTest { |
253 protected: | 243 protected: |
254 GuestSpokenFeedbackTest() {} | 244 GuestSpokenFeedbackTest() {} |
255 virtual ~GuestSpokenFeedbackTest() {} | 245 virtual ~GuestSpokenFeedbackTest() {} |
256 | 246 |
257 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 247 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
323 EXPECT_EQ("Select your language:", monitor.GetNextUtterance()); | 313 EXPECT_EQ("Select your language:", monitor.GetNextUtterance()); |
324 EXPECT_EQ("English ( United States)", monitor.GetNextUtterance()); | 314 EXPECT_EQ("English ( United States)", monitor.GetNextUtterance()); |
325 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Combo box * of *")); | 315 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Combo box * of *")); |
326 ASSERT_TRUE( | 316 ASSERT_TRUE( |
327 ui_test_utils::SendKeyPressToWindowSync( | 317 ui_test_utils::SendKeyPressToWindowSync( |
328 window, ui::VKEY_TAB, false, false, false, false)); | 318 window, ui::VKEY_TAB, false, false, false, false)); |
329 EXPECT_EQ("Select your keyboard:", monitor.GetNextUtterance()); | 319 EXPECT_EQ("Select your keyboard:", monitor.GetNextUtterance()); |
330 } | 320 } |
331 | 321 |
332 } // namespace chromeos | 322 } // namespace chromeos |
OLD | NEW |