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

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

Issue 1035983003: Split spoken feedback up on a per format rule basis. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 9 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
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/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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 ::testing::Values(kTestAsNormalUser, 256 ::testing::Values(kTestAsNormalUser,
257 kTestAsGuestUser)); 257 kTestAsGuestUser));
258 258
259 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, EnableSpokenFeedback) { 259 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, EnableSpokenFeedback) {
260 EnableChromeVox(); 260 EnableChromeVox();
261 } 261 }
262 262
263 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) { 263 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) {
264 EnableChromeVox(); 264 EnableChromeVox();
265 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); 265 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR);
266 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), 266 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "about:blank*"));
267 "about:blank*Tool bar Reload Button")); 267 EXPECT_EQ("main", speech_monitor_.GetNextUtterance());
268 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance());
269 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance());
270 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance());
268 } 271 }
269 272
270 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) { 273 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) {
271 EnableChromeVox(); 274 EnableChromeVox();
272 275
273 chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION); 276 chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION);
277 EXPECT_TRUE(
278 MatchPattern(speech_monitor_.GetNextUtterance(), "*about:blank*"));
279 EXPECT_EQ("main", speech_monitor_.GetNextUtterance());
280 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance());
281 EXPECT_EQ("Address and search bar", speech_monitor_.GetNextUtterance());
274 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*Edit text*")); 282 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*Edit text*"));
283 EXPECT_TRUE(
284 MatchPattern(speech_monitor_.GetNextUtterance(), "*about:blank*"));
275 285
276 SendKeyPress(ui::VKEY_X); 286 SendKeyPress(ui::VKEY_X);
277 EXPECT_EQ("x", speech_monitor_.GetNextUtterance()); 287 EXPECT_EQ("x", speech_monitor_.GetNextUtterance());
278 288
279 SendKeyPress(ui::VKEY_Y); 289 SendKeyPress(ui::VKEY_Y);
280 EXPECT_EQ("y", speech_monitor_.GetNextUtterance()); 290 EXPECT_EQ("y", speech_monitor_.GetNextUtterance());
281 291
282 SendKeyPress(ui::VKEY_Z); 292 SendKeyPress(ui::VKEY_Z);
283 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); 293 EXPECT_EQ("z", speech_monitor_.GetNextUtterance());
284 294
285 SendKeyPress(ui::VKEY_BACK); 295 SendKeyPress(ui::VKEY_BACK);
286 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); 296 EXPECT_EQ("z", speech_monitor_.GetNextUtterance());
287 } 297 }
288 298
289 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusShelf) { 299 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusShelf) {
290 EnableChromeVox(); 300 EnableChromeVox();
291 301
292 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); 302 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF));
293 const char* expected = app_list::switches::IsExperimentalAppListEnabled() 303 EXPECT_EQ("Shelf", speech_monitor_.GetNextUtterance());
294 ? "Shelf Tool bar Launcher Button" 304 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance());
295 : "Shelf Tool bar Apps Button"; 305 if (app_list::switches::IsExperimentalAppListEnabled())
296 EXPECT_EQ(expected, speech_monitor_.GetNextUtterance()); 306 EXPECT_EQ("Launcher", speech_monitor_.GetNextUtterance());
307 else
308 EXPECT_EQ("Apps", speech_monitor_.GetNextUtterance());
309 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance());
297 310
298 SendKeyPress(ui::VKEY_TAB); 311 SendKeyPress(ui::VKEY_TAB);
299 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "* Button")); 312 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*"));
313 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Button"));
300 } 314 }
301 315
302 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateAppLauncher) { 316 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateAppLauncher) {
303 EnableChromeVox(); 317 EnableChromeVox();
304 318
305 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); 319 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF));
306 while (true) { 320 while (true) {
307 std::string utterance = speech_monitor_.GetNextUtterance(); 321 std::string utterance = speech_monitor_.GetNextUtterance();
308 if (MatchPattern(utterance, "*Button")) 322 if (MatchPattern(utterance, "Button"))
309 break; 323 break;
310 } 324 }
311 325
312 SendKeyPress(ui::VKEY_RETURN); 326 SendKeyPress(ui::VKEY_RETURN);
313 327
314 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), 328 EXPECT_EQ("Search or type U R L", speech_monitor_.GetNextUtterance());
315 "Search or type U R L Edit text")); 329 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance());
316 330
317 SendKeyPress(ui::VKEY_DOWN); 331 SendKeyPress(ui::VKEY_DOWN);
318 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "* Button")); 332 EXPECT_EQ("Dialog", speech_monitor_.GetNextUtterance());
333 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*"));
334 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance());
319 } 335 }
320 336
321 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OpenStatusTray) { 337 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OpenStatusTray) {
322 EnableChromeVox(); 338 EnableChromeVox();
323 339
324 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE)); 340 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE));
325 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Status tray*")); 341 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Status tray*"));
326 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "time *")); 342 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "time *"));
327 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), 343 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(),
328 "Battery is*full.")); 344 "Battery is*full."));
329 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*Button")); 345 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*"));
346 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Button"));
330 } 347 }
331 348
332 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateSystemTray) { 349 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateSystemTray) {
333 EnableChromeVox(); 350 EnableChromeVox();
334 351
335 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE)); 352 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE));
336 while (true) { 353 while (true) {
337 std::string utterance = speech_monitor_.GetNextUtterance(); 354 std::string utterance = speech_monitor_.GetNextUtterance();
338 if (MatchPattern(utterance, "* Button")) 355 if (MatchPattern(utterance, "Button"))
339 break; 356 break;
340 } 357 }
341 358
342 // Navigate to Bluetooth sub-menu and open it. 359 // Navigate to Bluetooth sub-menu and open it.
343 while (true) { 360 while (true) {
344 SendKeyPress(ui::VKEY_TAB); 361 SendKeyPress(ui::VKEY_TAB);
345 std::string utterance = speech_monitor_.GetNextUtterance(); 362 std::string content = speech_monitor_.GetNextUtterance();
346 if (MatchPattern(utterance, "*Bluetooth* Button")) 363 std::string role = speech_monitor_.GetNextUtterance();
364 if (MatchPattern(content, "*Bluetooth*") && MatchPattern(role, "Button"))
347 break; 365 break;
348 } 366 }
349 SendKeyPress(ui::VKEY_RETURN); 367 SendKeyPress(ui::VKEY_RETURN);
350 368
369 // Skip the initial checkbox output. This test is very sensitive to output
370 // splitting.
371 speech_monitor_.GetNextUtterance();
372 speech_monitor_.GetNextUtterance();
373 speech_monitor_.GetNextUtterance();
374
351 // Navigate to return to previous menu button and press it. 375 // Navigate to return to previous menu button and press it.
352 while (true) { 376 while (true) {
353 SendKeyPress(ui::VKEY_TAB); 377 SendKeyPress(ui::VKEY_TAB);
354 std::string utterance = speech_monitor_.GetNextUtterance(); 378 std::string utterance = speech_monitor_.GetNextUtterance();
355 if (MatchPattern(utterance, "Previous menu Button")) 379 std::string role = speech_monitor_.GetNextUtterance();
380 if (MatchPattern(utterance, "Previous menu"))
356 break; 381 break;
357 } 382 }
358 SendKeyPress(ui::VKEY_RETURN); 383 SendKeyPress(ui::VKEY_RETURN);
359 EXPECT_TRUE( 384 while (true) {
360 MatchPattern(speech_monitor_.GetNextUtterance(), "*Bluetooth* Button")); 385 std::string utterance = speech_monitor_.GetNextUtterance();
386 if (MatchPattern(speech_monitor_.GetNextUtterance(), "Button"))
387 break;
388 }
361 } 389 }
362 390
363 // See http://crbug.com/443608 391 // See http://crbug.com/443608
364 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_ScreenBrightness) { 392 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_ScreenBrightness) {
365 EnableChromeVox(); 393 EnableChromeVox();
366 394
367 EXPECT_TRUE(PerformAcceleratorAction(ash::BRIGHTNESS_UP)); 395 EXPECT_TRUE(PerformAcceleratorAction(ash::BRIGHTNESS_UP));
368 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), 396 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(),
369 "Brightness * percent")); 397 "Brightness * percent"));
370 398
371 EXPECT_TRUE(PerformAcceleratorAction(ash::BRIGHTNESS_DOWN)); 399 EXPECT_TRUE(PerformAcceleratorAction(ash::BRIGHTNESS_DOWN));
372 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), 400 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(),
373 "Brightness * percent")); 401 "Brightness * percent"));
374 } 402 }
375 403
376 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, VolumeSlider) { 404 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, VolumeSlider) {
377 EnableChromeVox(); 405 EnableChromeVox();
378 406
379 EXPECT_TRUE(PerformAcceleratorAction(ash::VOLUME_UP)); 407 EXPECT_TRUE(PerformAcceleratorAction(ash::VOLUME_UP));
380 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "* percent*")); 408 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "* percent*"));
381 EXPECT_EQ("Volume,", speech_monitor_.GetNextUtterance()); 409 EXPECT_EQ("Volume,", speech_monitor_.GetNextUtterance());
382 EXPECT_EQ("slider", speech_monitor_.GetNextUtterance()); 410 EXPECT_EQ("slider", speech_monitor_.GetNextUtterance());
383 } 411 }
384 412
385 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OverviewMode) { 413 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OverviewMode) {
386 EnableChromeVox(); 414 EnableChromeVox();
387 415
388 EXPECT_TRUE(PerformAcceleratorAction(ash::TOGGLE_OVERVIEW)); 416 EXPECT_TRUE(PerformAcceleratorAction(ash::TOGGLE_OVERVIEW));
389 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance()); 417 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance());
390 EXPECT_EQ("Alert Entered window overview mode", 418 EXPECT_EQ("Alert", speech_monitor_.GetNextUtterance());
391 speech_monitor_.GetNextUtterance()); 419 EXPECT_EQ("Entered window overview mode", speech_monitor_.GetNextUtterance());
392 420
393 SendKeyPress(ui::VKEY_TAB); 421 SendKeyPress(ui::VKEY_TAB);
394 EXPECT_EQ("about:blank Button", speech_monitor_.GetNextUtterance()); 422 EXPECT_EQ("about:blank", speech_monitor_.GetNextUtterance());
423 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance());
395 } 424 }
396 425
397 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxShiftSearch) { 426 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxShiftSearch) {
398 LoadChromeVoxAndThenNavigateToURL( 427 LoadChromeVoxAndThenNavigateToURL(
399 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>")); 428 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>"));
400 while (true) { 429 while (true) {
401 std::string utterance = speech_monitor_.GetNextUtterance(); 430 std::string utterance = speech_monitor_.GetNextUtterance();
402 if (utterance == "Click me") 431 if (utterance == "Click me")
403 break; 432 break;
404 } 433 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 563
535 private: 564 private:
536 DISALLOW_COPY_AND_ASSIGN(GuestSpokenFeedbackTest); 565 DISALLOW_COPY_AND_ASSIGN(GuestSpokenFeedbackTest);
537 }; 566 };
538 567
539 IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) { 568 IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) {
540 EnableChromeVox(); 569 EnableChromeVox();
541 570
542 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); 571 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR);
543 572
544 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), 573 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "about:blank*"));
545 "about:blank*Tool bar Reload Button")); 574 EXPECT_EQ("main", speech_monitor_.GetNextUtterance());
575 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance());
576 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance());
577 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance());
546 } 578 }
547 579
548 // 580 //
549 // Spoken feedback tests of the out-of-box experience. 581 // Spoken feedback tests of the out-of-box experience.
550 // 582 //
551 583
552 class OobeSpokenFeedbackTest : public LoginManagerTest { 584 class OobeSpokenFeedbackTest : public LoginManagerTest {
553 protected: 585 protected:
554 OobeSpokenFeedbackTest() : LoginManagerTest(false) {} 586 OobeSpokenFeedbackTest() : LoginManagerTest(false) {}
555 ~OobeSpokenFeedbackTest() override {} 587 ~OobeSpokenFeedbackTest() override {}
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( 630 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
599 window, ui::VKEY_TAB, false, true /*shift*/, false, false)); 631 window, ui::VKEY_TAB, false, true /*shift*/, false, false));
600 while (speech_monitor_.GetNextUtterance() != "Select your language:") { 632 while (speech_monitor_.GetNextUtterance() != "Select your language:") {
601 } 633 }
602 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); 634 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance());
603 EXPECT_TRUE( 635 EXPECT_TRUE(
604 MatchPattern(speech_monitor_.GetNextUtterance(), "Combo box * of *")); 636 MatchPattern(speech_monitor_.GetNextUtterance(), "Combo box * of *"));
605 } 637 }
606 638
607 } // namespace chromeos 639 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698