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/common/accelerators/accelerator_controller.h" | 7 #include "ash/common/accelerators/accelerator_controller.h" |
8 #include "ash/common/accelerators/accelerator_table.h" | 8 #include "ash/common/accelerators/accelerator_table.h" |
9 #include "ash/common/accessibility_types.h" | 9 #include "ash/common/accessibility_types.h" |
10 #include "ash/common/system/tray/system_tray.h" | 10 #include "ash/common/system/tray/system_tray.h" |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); | 337 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); |
338 | 338 |
339 SendKeyPress(ui::VKEY_BACK); | 339 SendKeyPress(ui::VKEY_BACK); |
340 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); | 340 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); |
341 } | 341 } |
342 | 342 |
343 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusShelf) { | 343 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusShelf) { |
344 EnableChromeVox(); | 344 EnableChromeVox(); |
345 | 345 |
346 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); | 346 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); |
347 EXPECT_EQ("Launcher", speech_monitor_.GetNextUtterance()); | 347 while (true) { |
| 348 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 349 if (base::MatchPattern(utterance, "Launcher")) |
| 350 break; |
| 351 } |
348 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 352 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
349 | 353 |
350 EXPECT_EQ("Shelf", speech_monitor_.GetNextUtterance()); | 354 EXPECT_EQ("Shelf", speech_monitor_.GetNextUtterance()); |
351 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance()); | 355 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance()); |
352 EXPECT_EQ(", window", speech_monitor_.GetNextUtterance()); | 356 EXPECT_EQ(", window", speech_monitor_.GetNextUtterance()); |
353 | 357 |
354 SendKeyPress(ui::VKEY_TAB); | 358 SendKeyPress(ui::VKEY_TAB); |
355 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); | 359 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); |
356 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); | 360 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); |
357 } | 361 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 // in a dialog. | 411 // in a dialog. |
408 SendKeyPress(ui::VKEY_DOWN); | 412 SendKeyPress(ui::VKEY_DOWN); |
409 while ("Button" != speech_monitor_.GetNextUtterance()) { | 413 while ("Button" != speech_monitor_.GetNextUtterance()) { |
410 } | 414 } |
411 } | 415 } |
412 | 416 |
413 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OpenStatusTray) { | 417 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OpenStatusTray) { |
414 EnableChromeVox(); | 418 EnableChromeVox(); |
415 | 419 |
416 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE)); | 420 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE)); |
417 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); | 421 while (true) { |
418 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); | 422 std::string utterance = speech_monitor_.GetNextUtterance(); |
419 EXPECT_TRUE( | 423 if (base::MatchPattern(utterance, "Status tray*")) |
420 base::MatchPattern(speech_monitor_.GetNextUtterance(), "Status tray*")); | 424 break; |
| 425 } |
421 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "time *")); | 426 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "time *")); |
422 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), | 427 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), |
423 "Battery is*full.,")); | 428 "Battery is*full.,")); |
424 EXPECT_EQ("window", speech_monitor_.GetNextUtterance()); | 429 EXPECT_EQ("window", speech_monitor_.GetNextUtterance()); |
425 } | 430 } |
426 | 431 |
427 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateSystemTray) { | 432 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateSystemTray) { |
428 EnableChromeVox(); | 433 EnableChromeVox(); |
429 | 434 |
430 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE)); | 435 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE)); |
431 while (true) { | 436 while (true) { |
432 std::string utterance = speech_monitor_.GetNextUtterance(); | 437 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 438 if (base::MatchPattern(utterance, "Status tray,")) |
| 439 break; |
| 440 } |
| 441 while (true) { |
| 442 std::string utterance = speech_monitor_.GetNextUtterance(); |
433 if (base::MatchPattern(utterance, "window")) | 443 if (base::MatchPattern(utterance, "window")) |
434 break; | 444 break; |
435 } | 445 } |
436 | 446 |
437 SendKeyPress(ui::VKEY_TAB); | 447 SendKeyPress(ui::VKEY_TAB); |
438 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); | 448 while (true) { |
439 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); | 449 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 450 if (base::MatchPattern(utterance, "Button")) |
| 451 break; |
| 452 } |
440 | 453 |
441 // Compat next element. | 454 // Compat next element. |
442 SendKeyPressWithSearchAndShift(ui::VKEY_RIGHT); | 455 SendKeyPressWithSearchAndShift(ui::VKEY_RIGHT); |
443 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); | 456 while (true) { |
444 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); | 457 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 458 if (base::MatchPattern(utterance, "Button")) |
| 459 break; |
| 460 } |
445 | 461 |
446 // Compat next button. | 462 // Compat next button. |
447 SendKeyPressWithSearchAndShift(ui::VKEY_N); | 463 SendKeyPressWithSearchAndShift(ui::VKEY_N); |
448 SendKeyPress(ui::VKEY_B); | 464 SendKeyPress(ui::VKEY_B); |
449 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); | 465 while (true) { |
450 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); | 466 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 467 if (base::MatchPattern(utterance, "Button")) |
| 468 break; |
| 469 } |
451 | 470 |
452 // Navigate to Bluetooth sub-menu and open it. | 471 // Navigate to Bluetooth sub-menu and open it. |
453 while (true) { | 472 while (true) { |
454 SendKeyPress(ui::VKEY_TAB); | 473 SendKeyPress(ui::VKEY_TAB); |
455 std::string content = speech_monitor_.GetNextUtterance(); | 474 std::string content = speech_monitor_.GetNextUtterance(); |
456 std::string role = speech_monitor_.GetNextUtterance(); | 475 std::string role = speech_monitor_.GetNextUtterance(); |
457 if (base::MatchPattern(content, "*Bluetooth*") && | 476 if (base::MatchPattern(content, "*Bluetooth*") && |
458 base::MatchPattern(role, "Button")) | 477 base::MatchPattern(role, "Button")) |
459 break; | 478 break; |
460 } | 479 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 EXPECT_TRUE(PerformAcceleratorAction(ash::VOLUME_UP)); | 520 EXPECT_TRUE(PerformAcceleratorAction(ash::VOLUME_UP)); |
502 EXPECT_TRUE(PerformAcceleratorAction(ash::VOLUME_UP)); | 521 EXPECT_TRUE(PerformAcceleratorAction(ash::VOLUME_UP)); |
503 EXPECT_TRUE( | 522 EXPECT_TRUE( |
504 base::MatchPattern(speech_monitor_.GetNextUtterance(), "* percent*")); | 523 base::MatchPattern(speech_monitor_.GetNextUtterance(), "* percent*")); |
505 } | 524 } |
506 | 525 |
507 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OverviewMode) { | 526 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OverviewMode) { |
508 EnableChromeVox(); | 527 EnableChromeVox(); |
509 | 528 |
510 EXPECT_TRUE(PerformAcceleratorAction(ash::TOGGLE_OVERVIEW)); | 529 EXPECT_TRUE(PerformAcceleratorAction(ash::TOGGLE_OVERVIEW)); |
511 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance()); | 530 while (true) { |
512 EXPECT_EQ(", window", speech_monitor_.GetNextUtterance()); | 531 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 532 if (base::MatchPattern(utterance, "Edit text")) |
| 533 break; |
| 534 } |
513 EXPECT_EQ("Alert", speech_monitor_.GetNextUtterance()); | 535 EXPECT_EQ("Alert", speech_monitor_.GetNextUtterance()); |
514 EXPECT_EQ("Entered window overview mode", speech_monitor_.GetNextUtterance()); | 536 EXPECT_EQ("Entered window overview mode", speech_monitor_.GetNextUtterance()); |
515 | 537 |
516 SendKeyPress(ui::VKEY_TAB); | 538 SendKeyPress(ui::VKEY_TAB); |
517 // On Chrome OS accessibility title for tabbed browser windows contains app | 539 // On Chrome OS accessibility title for tabbed browser windows contains app |
518 // name ("Chrome" or "Chromium") in overview mode. | 540 // name ("Chrome" or "Chromium") in overview mode. |
519 EXPECT_EQ("Chromium - about:blank", speech_monitor_.GetNextUtterance()); | 541 while (true) { |
| 542 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 543 if (base::MatchPattern(utterance, "Chromium - about:blank")) |
| 544 break; |
| 545 } |
520 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 546 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
521 } | 547 } |
522 | 548 |
523 #if defined(MEMORY_SANITIZER) | 549 #if defined(MEMORY_SANITIZER) |
524 // Fails under MemorySanitizer: http://crbug.com/472125 | 550 // Fails under MemorySanitizer: http://crbug.com/472125 |
525 #define MAYBE_ChromeVoxShiftSearch DISABLED_ChromeVoxShiftSearch | 551 #define MAYBE_ChromeVoxShiftSearch DISABLED_ChromeVoxShiftSearch |
526 #else | 552 #else |
527 #define MAYBE_ChromeVoxShiftSearch ChromeVoxShiftSearch | 553 #define MAYBE_ChromeVoxShiftSearch ChromeVoxShiftSearch |
528 #endif | 554 #endif |
529 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxShiftSearch) { | 555 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxShiftSearch) { |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( | 811 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( |
786 window, ui::VKEY_TAB, false, true /*shift*/, false, false)); | 812 window, ui::VKEY_TAB, false, true /*shift*/, false, false)); |
787 while (speech_monitor_.GetNextUtterance() != "Select your language:") { | 813 while (speech_monitor_.GetNextUtterance() != "Select your language:") { |
788 } | 814 } |
789 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); | 815 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); |
790 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), | 816 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), |
791 "Combo box * of *")); | 817 "Combo box * of *")); |
792 } | 818 } |
793 | 819 |
794 } // namespace chromeos | 820 } // namespace chromeos |
OLD | NEW |