Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc

Issue 603823002: Revert of Add test for ChromeVox keyboard commands. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/aura/test/ui_controls_factory_ozone.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/speech_monitor.h" 13 #include "chrome/browser/chromeos/accessibility/speech_monitor.h"
14 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 14 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
15 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" 15 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
16 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" 16 #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
17 #include "chrome/browser/chromeos/profiles/profile_helper.h" 17 #include "chrome/browser/chromeos/profiles/profile_helper.h"
18 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con troller.h" 18 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con troller.h"
19 #include "chrome/browser/speech/tts_controller.h" 19 #include "chrome/browser/speech/tts_controller.h"
20 #include "chrome/browser/speech/tts_platform.h" 20 #include "chrome/browser/speech/tts_platform.h"
21 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
22 #include "chrome/browser/ui/browser_commands.h" 22 #include "chrome/browser/ui/browser_commands.h"
23 #include "chrome/browser/ui/browser_window.h" 23 #include "chrome/browser/ui/browser_window.h"
24 #include "chrome/browser/ui/tabs/tab_strip_model.h"
25 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/extensions/extension_constants.h" 25 #include "chrome/common/extensions/extension_constants.h"
27 #include "chrome/test/base/in_process_browser_test.h" 26 #include "chrome/test/base/in_process_browser_test.h"
28 #include "chrome/test/base/interactive_test_utils.h" 27 #include "chrome/test/base/interactive_test_utils.h"
29 #include "chrome/test/base/testing_profile.h" 28 #include "chrome/test/base/testing_profile.h"
30 #include "chrome/test/base/ui_test_utils.h" 29 #include "chrome/test/base/ui_test_utils.h"
31 #include "chromeos/chromeos_switches.h" 30 #include "chromeos/chromeos_switches.h"
32 #include "chromeos/login/user_names.h" 31 #include "chromeos/login/user_names.h"
33 #include "content/public/common/url_constants.h" 32 #include "content/public/common/url_constants.h"
34 #include "content/public/test/browser_test_utils.h" 33 #include "content/public/test/browser_test_utils.h"
(...skipping 19 matching lines...) Expand all
54 53
55 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 54 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
56 AccessibilityManager::SetBrailleControllerForTest(&braille_controller_); 55 AccessibilityManager::SetBrailleControllerForTest(&braille_controller_);
57 } 56 }
58 57
59 virtual void TearDownOnMainThread() OVERRIDE { 58 virtual void TearDownOnMainThread() OVERRIDE {
60 AccessibilityManager::SetBrailleControllerForTest(NULL); 59 AccessibilityManager::SetBrailleControllerForTest(NULL);
61 } 60 }
62 61
63 void SendKeyPress(ui::KeyboardCode key) { 62 void SendKeyPress(ui::KeyboardCode key) {
64 ASSERT_NO_FATAL_FAILURE( 63 gfx::NativeWindow root_window =
65 ASSERT_TRUE( 64 ash::Shell::GetInstance()->GetPrimaryRootWindow();
66 ui_test_utils::SendKeyPressToWindowSync( 65 ASSERT_TRUE(
67 NULL, key, false, false, false, false))); 66 ui_test_utils::SendKeyPressToWindowSync(
68 } 67 root_window, key, false, false, false, false));
69
70 void SendKeyPressWithControl(ui::KeyboardCode key) {
71 ASSERT_NO_FATAL_FAILURE(
72 ASSERT_TRUE(
73 ui_test_utils::SendKeyPressToWindowSync(
74 NULL, key, true, false, false, false)));
75 }
76
77 void SendKeyPressWithSearchAndShift(ui::KeyboardCode key) {
78 ASSERT_NO_FATAL_FAILURE(
79 ASSERT_TRUE(
80 ui_test_utils::SendKeyPressToWindowSync(
81 NULL, key, false, true, false, true)));
82 } 68 }
83 69
84 void RunJavaScriptInChromeVoxBackgroundPage(const std::string& script) { 70 void RunJavaScriptInChromeVoxBackgroundPage(const std::string& script) {
85 extensions::ExtensionHost* host = 71 extensions::ExtensionHost* host =
86 extensions::ExtensionSystem::Get(browser()->profile())-> 72 extensions::ExtensionSystem::Get(browser()->profile())->
87 process_manager()->GetBackgroundHostForExtension( 73 process_manager()->GetBackgroundHostForExtension(
88 extension_misc::kChromeVoxExtensionId); 74 extension_misc::kChromeVoxExtensionId);
89 CHECK(content::ExecuteScript(host->host_contents(), script)); 75 CHECK(content::ExecuteScript(host->host_contents(), script));
90 } 76 }
91 77
92 void SimulateTouchScreenInChromeVox() { 78 void SimulateTouchScreenInChromeVox() {
93 // ChromeVox looks at whether 'ontouchstart' exists to know whether 79 // ChromeVox looks at whether 'ontouchstart' exists to know whether
94 // or not it should respond to hover events. Fake it so that touch 80 // or not it should respond to hover events. Fake it so that touch
95 // exploration events get spoken. 81 // exploration events get spoken.
96 RunJavaScriptInChromeVoxBackgroundPage( 82 RunJavaScriptInChromeVoxBackgroundPage(
97 "window.ontouchstart = function() {};"); 83 "window.ontouchstart = function() {};");
98 } 84 }
99 85
100 void DisableEarcons() { 86 void DisableEarcons() {
101 // Playing earcons from within a test is not only annoying if you're 87 // Playing earcons from within a test is not only annoying if you're
102 // running the test locally, but seems to cause crashes 88 // running the test locally, but seems to cause crashes
103 // (http://crbug.com/396507). Work around this by just telling 89 // (http://crbug.com/396507). Work around this by just telling
104 // ChromeVox to not ever play earcons (prerecorded sound effects). 90 // ChromeVox to not ever play earcons (prerecorded sound effects).
105 RunJavaScriptInChromeVoxBackgroundPage( 91 RunJavaScriptInChromeVoxBackgroundPage(
106 "cvox.ChromeVox.earcons.playEarcon = function() {};"); 92 "cvox.ChromeVox.earcons.playEarcon = function() {};");
107 } 93 }
108 94
109 void LoadChromeVoxAndThenNavigateToURL(const GURL& url) {
110 // The goal of this helper function is to avoid race conditions between
111 // the page loading and the ChromeVox extension loading and fully
112 // initializing. To do this, we first load a test url that repeatedly
113 // asks ChromeVox to speak 'ready', then we load ChromeVox and block
114 // until we get that 'ready' speech.
115
116 ui_test_utils::NavigateToURL(
117 browser(),
118 GURL("data:text/html;charset=utf-8,"
119 "<script>"
120 "window.setInterval(function() {"
121 " try {"
122 " cvox.Api.speak('ready');"
123 " } catch (e) {}"
124 "}, 100);"
125 "</script>"));
126 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
127 AccessibilityManager::Get()->EnableSpokenFeedback(
128 true, ash::A11Y_NOTIFICATION_NONE);
129
130 // Block until we get "ready".
131 while (speech_monitor_.GetNextUtterance() != "ready") {
132 }
133
134 // Now load the requested url.
135 ui_test_utils::NavigateToURL(browser(), url);
136 }
137
138 SpeechMonitor speech_monitor_;
139
140 private: 95 private:
141 StubBrailleController braille_controller_; 96 StubBrailleController braille_controller_;
142 DISALLOW_COPY_AND_ASSIGN(LoggedInSpokenFeedbackTest); 97 DISALLOW_COPY_AND_ASSIGN(LoggedInSpokenFeedbackTest);
143 }; 98 };
144 99
145 IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest, AddBookmark) { 100 IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest, AddBookmark) {
146 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 101 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
147 102
103 SpeechMonitor monitor;
148 AccessibilityManager::Get()->EnableSpokenFeedback( 104 AccessibilityManager::Get()->EnableSpokenFeedback(
149 true, ash::A11Y_NOTIFICATION_NONE); 105 true, ash::A11Y_NOTIFICATION_NONE);
150 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); 106 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage());
151 DisableEarcons(); 107 DisableEarcons();
152 108
153 chrome::ExecuteCommand(browser(), IDC_SHOW_BOOKMARK_BAR); 109 chrome::ExecuteCommand(browser(), IDC_SHOW_BOOKMARK_BAR);
154 110
155 // Create a bookmark with title "foo". 111 // Create a bookmark with title "foo".
156 chrome::ExecuteCommand(browser(), IDC_BOOKMARK_PAGE); 112 chrome::ExecuteCommand(browser(), IDC_BOOKMARK_PAGE);
157 EXPECT_EQ("Bookmark added!,", speech_monitor_.GetNextUtterance()); 113 EXPECT_EQ("Bookmark added!,", monitor.GetNextUtterance());
158 EXPECT_EQ("about blank,", speech_monitor_.GetNextUtterance()); 114 EXPECT_EQ("about blank,", monitor.GetNextUtterance());
159 EXPECT_EQ("Bookmark name,", speech_monitor_.GetNextUtterance()); 115 EXPECT_EQ("Bookmark name,", monitor.GetNextUtterance());
160 EXPECT_EQ("text box", speech_monitor_.GetNextUtterance()); 116 EXPECT_EQ("text box", monitor.GetNextUtterance());
161 117
162 SendKeyPress(ui::VKEY_F); 118 SendKeyPress(ui::VKEY_F);
163 EXPECT_EQ("f", speech_monitor_.GetNextUtterance()); 119 EXPECT_EQ("f", monitor.GetNextUtterance());
164 SendKeyPress(ui::VKEY_O); 120 SendKeyPress(ui::VKEY_O);
165 EXPECT_EQ("o", speech_monitor_.GetNextUtterance()); 121 EXPECT_EQ("o", monitor.GetNextUtterance());
166 SendKeyPress(ui::VKEY_O); 122 SendKeyPress(ui::VKEY_O);
167 EXPECT_EQ("o", speech_monitor_.GetNextUtterance()); 123 EXPECT_EQ("o", monitor.GetNextUtterance());
168 124
169 SendKeyPress(ui::VKEY_TAB); 125 SendKeyPress(ui::VKEY_TAB);
170 EXPECT_EQ("Bookmarks bar,", speech_monitor_.GetNextUtterance()); 126 EXPECT_EQ("Bookmarks bar,", monitor.GetNextUtterance());
171 EXPECT_EQ("Bookmark folder,", speech_monitor_.GetNextUtterance()); 127 EXPECT_EQ("Bookmark folder,", monitor.GetNextUtterance());
172 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "combo box*")); 128 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "combo box*"));
173 129
174 SendKeyPress(ui::VKEY_RETURN); 130 SendKeyPress(ui::VKEY_RETURN);
175 131
176 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*oolbar*")); 132 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "*oolbar*"));
177 // Wait for active window change to be announced to avoid interference from 133 // Wait for active window change to be announced to avoid interference from
178 // that below. 134 // that below.
179 while (speech_monitor_.GetNextUtterance() != "window about blank tab") { 135 while (monitor.GetNextUtterance() != "window about blank tab") {
180 // Do nothing. 136 // Do nothing.
181 } 137 }
182 138
183 // Focus bookmarks bar and listen for "foo". 139 // Focus bookmarks bar and listen for "foo".
184 chrome::ExecuteCommand(browser(), IDC_FOCUS_BOOKMARKS); 140 chrome::ExecuteCommand(browser(), IDC_FOCUS_BOOKMARKS);
185 while (true) { 141 while (true) {
186 std::string utterance = speech_monitor_.GetNextUtterance(); 142 std::string utterance = monitor.GetNextUtterance();
187 VLOG(0) << "Got utterance: " << utterance; 143 VLOG(0) << "Got utterance: " << utterance;
188 if (utterance == "Bookmarks,") 144 if (utterance == "Bookmarks,")
189 break; 145 break;
190 } 146 }
191 EXPECT_EQ("foo,", speech_monitor_.GetNextUtterance()); 147 EXPECT_EQ("foo,", monitor.GetNextUtterance());
192 EXPECT_EQ("button", speech_monitor_.GetNextUtterance()); 148 EXPECT_EQ("button", monitor.GetNextUtterance());
193 } 149 }
194 150
195 // 151 //
196 // Spoken feedback tests in both a logged in browser window and guest mode. 152 // Spoken feedback tests in both a logged in browser window and guest mode.
197 // 153 //
198 154
199 enum SpokenFeedbackTestVariant { 155 enum SpokenFeedbackTestVariant {
200 kTestAsNormalUser, 156 kTestAsNormalUser,
201 kTestAsGuestUser 157 kTestAsGuestUser
202 }; 158 };
(...skipping 19 matching lines...) Expand all
222 178
223 INSTANTIATE_TEST_CASE_P( 179 INSTANTIATE_TEST_CASE_P(
224 TestAsNormalAndGuestUser, 180 TestAsNormalAndGuestUser,
225 SpokenFeedbackTest, 181 SpokenFeedbackTest,
226 ::testing::Values(kTestAsNormalUser, 182 ::testing::Values(kTestAsNormalUser,
227 kTestAsGuestUser)); 183 kTestAsGuestUser));
228 184
229 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, EnableSpokenFeedback) { 185 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, EnableSpokenFeedback) {
230 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 186 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
231 187
188 SpeechMonitor monitor;
232 AccessibilityManager::Get()->EnableSpokenFeedback( 189 AccessibilityManager::Get()->EnableSpokenFeedback(
233 true, ash::A11Y_NOTIFICATION_NONE); 190 true, ash::A11Y_NOTIFICATION_NONE);
234 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); 191 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage());
235 } 192 }
236 193
237 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) { 194 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) {
238 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 195 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
239 196
197 SpeechMonitor monitor;
240 AccessibilityManager::Get()->EnableSpokenFeedback( 198 AccessibilityManager::Get()->EnableSpokenFeedback(
241 true, ash::A11Y_NOTIFICATION_NONE); 199 true, ash::A11Y_NOTIFICATION_NONE);
242 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); 200 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage());
243 DisableEarcons(); 201 DisableEarcons();
244 202
245 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); 203 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR);
246 // Might be "Google Chrome Toolbar" or "Chromium Toolbar". 204 // Might be "Google Chrome Toolbar" or "Chromium Toolbar".
247 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*oolbar*")); 205 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "*oolbar*"));
248 EXPECT_EQ("Reload,", speech_monitor_.GetNextUtterance()); 206 EXPECT_EQ("Reload,", monitor.GetNextUtterance());
249 EXPECT_EQ("button", speech_monitor_.GetNextUtterance()); 207 EXPECT_EQ("button", monitor.GetNextUtterance());
250 } 208 }
251 209
252 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) { 210 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) {
253 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 211 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
254 212
213 SpeechMonitor monitor;
255 AccessibilityManager::Get()->EnableSpokenFeedback( 214 AccessibilityManager::Get()->EnableSpokenFeedback(
256 true, ash::A11Y_NOTIFICATION_NONE); 215 true, ash::A11Y_NOTIFICATION_NONE);
257 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); 216 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage());
258 DisableEarcons(); 217 DisableEarcons();
259 218
260 // Wait for ChromeVox to finish speaking. 219 // Wait for ChromeVox to finish speaking.
261 chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION); 220 chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION);
262 while (true) { 221 while (true) {
263 std::string utterance = speech_monitor_.GetNextUtterance(); 222 std::string utterance = monitor.GetNextUtterance();
264 VLOG(0) << "Got utterance: " << utterance; 223 VLOG(0) << "Got utterance: " << utterance;
265 if (utterance == "text box") 224 if (utterance == "text box")
266 break; 225 break;
267 } 226 }
268 227
269 SendKeyPress(ui::VKEY_X); 228 SendKeyPress(ui::VKEY_X);
270 EXPECT_EQ("x", speech_monitor_.GetNextUtterance()); 229 EXPECT_EQ("x", monitor.GetNextUtterance());
271 230
272 SendKeyPress(ui::VKEY_Y); 231 SendKeyPress(ui::VKEY_Y);
273 EXPECT_EQ("y", speech_monitor_.GetNextUtterance()); 232 EXPECT_EQ("y", monitor.GetNextUtterance());
274 233
275 SendKeyPress(ui::VKEY_Z); 234 SendKeyPress(ui::VKEY_Z);
276 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); 235 EXPECT_EQ("z", monitor.GetNextUtterance());
277 236
278 SendKeyPress(ui::VKEY_BACK); 237 SendKeyPress(ui::VKEY_BACK);
279 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); 238 EXPECT_EQ("z", monitor.GetNextUtterance());
280 }
281
282 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxShiftSearch) {
283 LoadChromeVoxAndThenNavigateToURL(
284 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>"));
285 while (true) {
286 std::string utterance = speech_monitor_.GetNextUtterance();
287 if (utterance == "Click me")
288 break;
289 }
290 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance());
291
292 // Press Search+Shift+/ to enter ChromeVox's "find in page".
293 SendKeyPressWithSearchAndShift(ui::VKEY_OEM_2);
294 EXPECT_EQ("Find in page.", speech_monitor_.GetNextUtterance());
295 EXPECT_EQ("Enter a search query.", speech_monitor_.GetNextUtterance());
296 }
297
298 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxPrefixKey) {
299 LoadChromeVoxAndThenNavigateToURL(
300 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>"));
301 while (true) {
302 std::string utterance = speech_monitor_.GetNextUtterance();
303 if (utterance == "Click me")
304 break;
305 }
306 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance());
307
308 // Press the prefix key Ctrl+';' followed by '/'
309 // to enter ChromeVox's "find in page".
310 SendKeyPressWithControl(ui::VKEY_OEM_1);
311 SendKeyPress(ui::VKEY_OEM_2);
312 EXPECT_EQ("Find in page.", speech_monitor_.GetNextUtterance());
313 EXPECT_EQ("Enter a search query.", speech_monitor_.GetNextUtterance());
314 } 239 }
315 240
316 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) { 241 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) {
317 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 242 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
318 243
244 SpeechMonitor monitor;
319 AccessibilityManager::Get()->EnableSpokenFeedback( 245 AccessibilityManager::Get()->EnableSpokenFeedback(
320 true, ash::A11Y_NOTIFICATION_NONE); 246 true, ash::A11Y_NOTIFICATION_NONE);
321 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); 247 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage());
322 DisableEarcons(); 248 DisableEarcons();
323 249
324 SimulateTouchScreenInChromeVox(); 250 SimulateTouchScreenInChromeVox();
325 251
326 // Send an accessibility hover event on the system tray, which is 252 // Send an accessibility hover event on the system tray, which is
327 // what we get when you tap it on a touch screen when ChromeVox is on. 253 // what we get when you tap it on a touch screen when ChromeVox is on.
328 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); 254 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray();
329 tray->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); 255 tray->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true);
330 256
331 EXPECT_EQ("Status tray,", speech_monitor_.GetNextUtterance()); 257 EXPECT_EQ("Status tray,", monitor.GetNextUtterance());
332 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "time*,")); 258 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "time*,"));
333 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Battery*,")); 259 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Battery*,"));
334 EXPECT_EQ("button", speech_monitor_.GetNextUtterance()); 260 EXPECT_EQ("button", monitor.GetNextUtterance());
335 } 261 }
336 262
337 // 263 //
338 // Spoken feedback tests that run only in guest mode. 264 // Spoken feedback tests that run only in guest mode.
339 // 265 //
340 266
341 class GuestSpokenFeedbackTest : public LoggedInSpokenFeedbackTest { 267 class GuestSpokenFeedbackTest : public LoggedInSpokenFeedbackTest {
342 protected: 268 protected:
343 GuestSpokenFeedbackTest() {} 269 GuestSpokenFeedbackTest() {}
344 virtual ~GuestSpokenFeedbackTest() {} 270 virtual ~GuestSpokenFeedbackTest() {}
345 271
346 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 272 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
347 command_line->AppendSwitch(chromeos::switches::kGuestSession); 273 command_line->AppendSwitch(chromeos::switches::kGuestSession);
348 command_line->AppendSwitch(::switches::kIncognito); 274 command_line->AppendSwitch(::switches::kIncognito);
349 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); 275 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user");
350 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, 276 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser,
351 chromeos::login::kGuestUserName); 277 chromeos::login::kGuestUserName);
352 } 278 }
353 279
354 private: 280 private:
355 DISALLOW_COPY_AND_ASSIGN(GuestSpokenFeedbackTest); 281 DISALLOW_COPY_AND_ASSIGN(GuestSpokenFeedbackTest);
356 }; 282 };
357 283
358 IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) { 284 IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) {
359 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 285 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
360 286
287 SpeechMonitor monitor;
361 AccessibilityManager::Get()->EnableSpokenFeedback( 288 AccessibilityManager::Get()->EnableSpokenFeedback(
362 true, ash::A11Y_NOTIFICATION_NONE); 289 true, ash::A11Y_NOTIFICATION_NONE);
363 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); 290 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage());
364 DisableEarcons(); 291 DisableEarcons();
365 292
366 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); 293 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR);
367 // Might be "Google Chrome Toolbar" or "Chromium Toolbar". 294 // Might be "Google Chrome Toolbar" or "Chromium Toolbar".
368 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*oolbar*")); 295 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "*oolbar*"));
369 EXPECT_EQ("Reload,", speech_monitor_.GetNextUtterance()); 296 EXPECT_EQ("Reload,", monitor.GetNextUtterance());
370 EXPECT_EQ("button", speech_monitor_.GetNextUtterance()); 297 EXPECT_EQ("button", monitor.GetNextUtterance());
371 } 298 }
372 299
373 // 300 //
374 // Spoken feedback tests of the out-of-box experience. 301 // Spoken feedback tests of the out-of-box experience.
375 // 302 //
376 303
377 class OobeSpokenFeedbackTest : public InProcessBrowserTest { 304 class OobeSpokenFeedbackTest : public InProcessBrowserTest {
378 protected: 305 protected:
379 OobeSpokenFeedbackTest() {} 306 OobeSpokenFeedbackTest() {}
380 virtual ~OobeSpokenFeedbackTest() {} 307 virtual ~OobeSpokenFeedbackTest() {}
381 308
382 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 309 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
383 command_line->AppendSwitch(chromeos::switches::kLoginManager); 310 command_line->AppendSwitch(chromeos::switches::kLoginManager);
384 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); 311 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests);
385 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); 312 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user");
386 } 313 }
387 314
388 virtual void SetUpOnMainThread() OVERRIDE { 315 virtual void SetUpOnMainThread() OVERRIDE {
389 AccessibilityManager::Get()-> 316 AccessibilityManager::Get()->
390 SetProfileForTest(ProfileHelper::GetSigninProfile()); 317 SetProfileForTest(ProfileHelper::GetSigninProfile());
391 } 318 }
392 319
393 SpeechMonitor speech_monitor_;
394
395 private: 320 private:
396 DISALLOW_COPY_AND_ASSIGN(OobeSpokenFeedbackTest); 321 DISALLOW_COPY_AND_ASSIGN(OobeSpokenFeedbackTest);
397 }; 322 };
398 323
399 // Test is flaky: http://crbug.com/346797 324 // Test is flaky: http://crbug.com/346797
400 IN_PROC_BROWSER_TEST_F(OobeSpokenFeedbackTest, DISABLED_SpokenFeedbackInOobe) { 325 IN_PROC_BROWSER_TEST_F(OobeSpokenFeedbackTest, DISABLED_SpokenFeedbackInOobe) {
401 ui_controls::EnableUIControls(); 326 ui_controls::EnableUIControls();
402 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 327 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
403 328
404 LoginDisplayHost* login_display_host = LoginDisplayHostImpl::default_host(); 329 LoginDisplayHost* login_display_host = LoginDisplayHostImpl::default_host();
405 WebUILoginView* web_ui_login_view = login_display_host->GetWebUILoginView(); 330 WebUILoginView* web_ui_login_view = login_display_host->GetWebUILoginView();
406 views::Widget* widget = web_ui_login_view->GetWidget(); 331 views::Widget* widget = web_ui_login_view->GetWidget();
407 gfx::NativeWindow window = widget->GetNativeWindow(); 332 gfx::NativeWindow window = widget->GetNativeWindow();
408 333
334 SpeechMonitor monitor;
409 AccessibilityManager::Get()->EnableSpokenFeedback( 335 AccessibilityManager::Get()->EnableSpokenFeedback(
410 true, ash::A11Y_NOTIFICATION_NONE); 336 true, ash::A11Y_NOTIFICATION_NONE);
411 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); 337 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage());
412 338
413 EXPECT_EQ("Select your language:", speech_monitor_.GetNextUtterance()); 339 EXPECT_EQ("Select your language:", monitor.GetNextUtterance());
414 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); 340 EXPECT_EQ("English ( United States)", monitor.GetNextUtterance());
415 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), 341 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Combo box * of *"));
416 "Combo box * of *"));
417 ASSERT_TRUE( 342 ASSERT_TRUE(
418 ui_test_utils::SendKeyPressToWindowSync( 343 ui_test_utils::SendKeyPressToWindowSync(
419 window, ui::VKEY_TAB, false, false, false, false)); 344 window, ui::VKEY_TAB, false, false, false, false));
420 EXPECT_EQ("Select your keyboard:", speech_monitor_.GetNextUtterance()); 345 EXPECT_EQ("Select your keyboard:", monitor.GetNextUtterance());
421 } 346 }
422 347
423 } // namespace chromeos 348 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | ui/aura/test/ui_controls_factory_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698