| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 void SendKeyPressWithControl(ui::KeyboardCode key) { | 80 void SendKeyPressWithControl(ui::KeyboardCode key) { |
| 81 ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( | 81 ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( |
| 82 nullptr, key, true, false, false, false))); | 82 nullptr, key, true, false, false, false))); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void SendKeyPressWithSearchAndShift(ui::KeyboardCode key) { | 85 void SendKeyPressWithSearchAndShift(ui::KeyboardCode key) { |
| 86 ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( | 86 ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( |
| 87 nullptr, key, false, true, false, true))); | 87 nullptr, key, false, true, false, true))); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void SendKeyPressWithSearch(ui::KeyboardCode key) { |
| 91 ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( |
| 92 nullptr, key, false, false, false, true))); |
| 93 } |
| 94 |
| 90 void RunJavaScriptInChromeVoxBackgroundPage(const std::string& script) { | 95 void RunJavaScriptInChromeVoxBackgroundPage(const std::string& script) { |
| 91 extensions::ExtensionHost* host = | 96 extensions::ExtensionHost* host = |
| 92 extensions::ProcessManager::Get(browser()->profile()) | 97 extensions::ProcessManager::Get(browser()->profile()) |
| 93 ->GetBackgroundHostForExtension( | 98 ->GetBackgroundHostForExtension( |
| 94 extension_misc::kChromeVoxExtensionId); | 99 extension_misc::kChromeVoxExtensionId); |
| 95 CHECK(content::ExecuteScript(host->host_contents(), script)); | 100 CHECK(content::ExecuteScript(host->host_contents(), script)); |
| 96 } | 101 } |
| 97 | 102 |
| 98 void SimulateTouchScreenInChromeVox() { | 103 void SimulateTouchScreenInChromeVox() { |
| 99 // ChromeVox looks at whether 'ontouchstart' exists to know whether | 104 // ChromeVox looks at whether 'ontouchstart' exists to know whether |
| (...skipping 13 matching lines...) Expand all Loading... |
| 113 // Playing earcons from within a test is not only annoying if you're | 118 // Playing earcons from within a test is not only annoying if you're |
| 114 // running the test locally, but seems to cause crashes | 119 // running the test locally, but seems to cause crashes |
| 115 // (http://crbug.com/396507). Work around this by just telling | 120 // (http://crbug.com/396507). Work around this by just telling |
| 116 // ChromeVox to not ever play earcons (prerecorded sound effects). | 121 // ChromeVox to not ever play earcons (prerecorded sound effects). |
| 117 RunJavaScriptInChromeVoxBackgroundPage( | 122 RunJavaScriptInChromeVoxBackgroundPage( |
| 118 "cvox.ChromeVox.earcons.playEarcon = function() {};"); | 123 "cvox.ChromeVox.earcons.playEarcon = function() {};"); |
| 119 } | 124 } |
| 120 | 125 |
| 121 void EnableChromeVox() { | 126 void EnableChromeVox() { |
| 122 // Test setup. | 127 // Test setup. |
| 123 // Enable ChromeVox, skip welcome message, and disable earcons. | 128 // Enable ChromeVox, skip welcome message/notification, and disable earcons. |
| 124 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | 129 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| 125 | 130 |
| 126 AccessibilityManager::Get()->EnableSpokenFeedback( | 131 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 127 true, ash::A11Y_NOTIFICATION_NONE); | 132 true, ash::A11Y_NOTIFICATION_NONE); |
| 128 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); | 133 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); |
| 129 DisableEarcons(); | 134 DisableEarcons(); |
| 130 } | |
| 131 | 135 |
| 132 void LoadChromeVoxAndThenNavigateToURL(const GURL& url) { | 136 // Ensure we skip all other startup messages by sending an additional speak |
| 133 // The goal of this helper function is to avoid race conditions between | 137 // call. |
| 134 // the page loading and the ChromeVox extension loading and fully | 138 RunJavaScriptInChromeVoxBackgroundPage( |
| 135 // initializing. To do this, we first load a test url that repeatedly | 139 "cvox.ChromeVox.tts.speak('ready to test');"); |
| 136 // asks ChromeVox to speak 'ready', then we load ChromeVox and block | 140 EXPECT_TRUE(speech_monitor_.SkipChromeVoxMessage("ready to test")); |
| 137 // until we get that 'ready' speech. | |
| 138 | |
| 139 ui_test_utils::NavigateToURL( | |
| 140 browser(), | |
| 141 GURL("data:text/html;charset=utf-8," | |
| 142 "<script>" | |
| 143 "window.setInterval(function() {" | |
| 144 " try {" | |
| 145 " cvox.Api.speak('ready');" | |
| 146 " } catch (e) {}" | |
| 147 "}, 100);" | |
| 148 "</script>")); | |
| 149 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | |
| 150 AccessibilityManager::Get()->EnableSpokenFeedback( | |
| 151 true, ash::A11Y_NOTIFICATION_NONE); | |
| 152 | |
| 153 // Block until we get "ready". | |
| 154 while (speech_monitor_.GetNextUtterance() != "ready") { | |
| 155 } | |
| 156 | |
| 157 // Now load the requested url. | |
| 158 ui_test_utils::NavigateToURL(browser(), url); | |
| 159 } | 141 } |
| 160 | 142 |
| 161 void PressRepeatedlyUntilUtterance(ui::KeyboardCode key, | 143 void PressRepeatedlyUntilUtterance(ui::KeyboardCode key, |
| 162 const std::string& expected_utterance) { | 144 const std::string& expected_utterance) { |
| 163 // This helper function is needed when you want to poll for something | 145 // This helper function is needed when you want to poll for something |
| 164 // that happens asynchronously. Keep pressing |key|, until | 146 // that happens asynchronously. Keep pressing |key|, until |
| 165 // the speech feedback that follows is |expected_utterance|. | 147 // the speech feedback that follows is |expected_utterance|. |
| 166 // Note that this doesn't work if pressing that key doesn't speak anything | 148 // Note that this doesn't work if pressing that key doesn't speak anything |
| 167 // at all before the asynchronous event occurred. | 149 // at all before the asynchronous event occurred. |
| 168 while (true) { | 150 while (true) { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 // AudioOutputResampler::Shutdown, see crbug.com/630031. | 284 // AudioOutputResampler::Shutdown, see crbug.com/630031. |
| 303 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_EnableSpokenFeedback) { | 285 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_EnableSpokenFeedback) { |
| 304 EnableChromeVox(); | 286 EnableChromeVox(); |
| 305 } | 287 } |
| 306 | 288 |
| 307 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) { | 289 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) { |
| 308 EnableChromeVox(); | 290 EnableChromeVox(); |
| 309 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); | 291 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); |
| 310 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance()); | 292 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance()); |
| 311 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 293 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
| 312 EXPECT_EQ("main", speech_monitor_.GetNextUtterance()); | |
| 313 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance()); | |
| 314 EXPECT_TRUE( | |
| 315 base::MatchPattern(speech_monitor_.GetNextUtterance(), "about:blank*")); | |
| 316 } | 294 } |
| 317 | 295 |
| 318 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) { | 296 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) { |
| 319 EnableChromeVox(); | 297 EnableChromeVox(); |
| 320 | 298 |
| 321 chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION); | 299 // Location bar has focus by default so just start typing. |
| 322 EXPECT_EQ("Address and search bar", speech_monitor_.GetNextUtterance()); | |
| 323 EXPECT_EQ("about:blank", speech_monitor_.GetNextUtterance()); | |
| 324 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance()); | |
| 325 EXPECT_EQ("main", speech_monitor_.GetNextUtterance()); | |
| 326 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance()); | |
| 327 EXPECT_TRUE( | |
| 328 base::MatchPattern(speech_monitor_.GetNextUtterance(), "*about:blank*")); | |
| 329 | |
| 330 SendKeyPress(ui::VKEY_X); | 300 SendKeyPress(ui::VKEY_X); |
| 331 EXPECT_EQ("x", speech_monitor_.GetNextUtterance()); | 301 EXPECT_EQ("x", speech_monitor_.GetNextUtterance()); |
| 332 | 302 |
| 333 SendKeyPress(ui::VKEY_Y); | 303 SendKeyPress(ui::VKEY_Y); |
| 334 EXPECT_EQ("y", speech_monitor_.GetNextUtterance()); | 304 EXPECT_EQ("y", speech_monitor_.GetNextUtterance()); |
| 335 | 305 |
| 336 SendKeyPress(ui::VKEY_Z); | 306 SendKeyPress(ui::VKEY_Z); |
| 337 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); | 307 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); |
| 338 | 308 |
| 339 SendKeyPress(ui::VKEY_BACK); | 309 SendKeyPress(ui::VKEY_BACK); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 break; | 414 break; |
| 445 } | 415 } |
| 446 | 416 |
| 447 SendKeyPress(ui::VKEY_TAB); | 417 SendKeyPress(ui::VKEY_TAB); |
| 448 while (true) { | 418 while (true) { |
| 449 std::string utterance = speech_monitor_.GetNextUtterance(); | 419 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 450 if (base::MatchPattern(utterance, "Button")) | 420 if (base::MatchPattern(utterance, "Button")) |
| 451 break; | 421 break; |
| 452 } | 422 } |
| 453 | 423 |
| 454 // Compat next element. | 424 // Next element. |
| 455 SendKeyPressWithSearchAndShift(ui::VKEY_RIGHT); | 425 SendKeyPressWithSearch(ui::VKEY_RIGHT); |
| 456 while (true) { | 426 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); |
| 457 std::string utterance = speech_monitor_.GetNextUtterance(); | 427 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); |
| 458 if (base::MatchPattern(utterance, "Button")) | |
| 459 break; | |
| 460 } | |
| 461 | 428 |
| 462 // Compat next button. | 429 // Next button. |
| 463 SendKeyPressWithSearchAndShift(ui::VKEY_N); | 430 SendKeyPressWithSearch(ui::VKEY_B); |
| 464 SendKeyPress(ui::VKEY_B); | 431 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); |
| 465 while (true) { | 432 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); |
| 466 std::string utterance = speech_monitor_.GetNextUtterance(); | |
| 467 if (base::MatchPattern(utterance, "Button")) | |
| 468 break; | |
| 469 } | |
| 470 | 433 |
| 471 // Navigate to Bluetooth sub-menu and open it. | 434 // Navigate to Bluetooth sub-menu and open it. |
| 472 while (true) { | 435 while (true) { |
| 473 SendKeyPress(ui::VKEY_TAB); | 436 SendKeyPress(ui::VKEY_TAB); |
| 474 std::string content = speech_monitor_.GetNextUtterance(); | 437 std::string content = speech_monitor_.GetNextUtterance(); |
| 475 std::string role = speech_monitor_.GetNextUtterance(); | 438 std::string role = speech_monitor_.GetNextUtterance(); |
| 476 if (base::MatchPattern(content, "*Bluetooth*") && | 439 if (base::MatchPattern(content, "*Bluetooth*") && |
| 477 base::MatchPattern(role, "Button")) | 440 base::MatchPattern(role, "Button")) |
| 478 break; | 441 break; |
| 479 } | 442 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 509 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
| 547 } | 510 } |
| 548 | 511 |
| 549 #if defined(MEMORY_SANITIZER) | 512 #if defined(MEMORY_SANITIZER) |
| 550 // Fails under MemorySanitizer: http://crbug.com/472125 | 513 // Fails under MemorySanitizer: http://crbug.com/472125 |
| 551 #define MAYBE_ChromeVoxShiftSearch DISABLED_ChromeVoxShiftSearch | 514 #define MAYBE_ChromeVoxShiftSearch DISABLED_ChromeVoxShiftSearch |
| 552 #else | 515 #else |
| 553 #define MAYBE_ChromeVoxShiftSearch ChromeVoxShiftSearch | 516 #define MAYBE_ChromeVoxShiftSearch ChromeVoxShiftSearch |
| 554 #endif | 517 #endif |
| 555 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxShiftSearch) { | 518 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxShiftSearch) { |
| 556 LoadChromeVoxAndThenNavigateToURL( | 519 EnableChromeVox(); |
| 520 |
| 521 ui_test_utils::NavigateToURL( |
| 522 browser(), |
| 557 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>")); | 523 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>")); |
| 558 while (true) { | 524 while (true) { |
| 559 std::string utterance = speech_monitor_.GetNextUtterance(); | 525 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 560 if (utterance == "Click me") | |
| 561 break; | |
| 562 } | |
| 563 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | |
| 564 | |
| 565 // Press Search+Shift+/ to enter ChromeVox's "find in page". | |
| 566 SendKeyPressWithSearchAndShift(ui::VKEY_OEM_2); | |
| 567 EXPECT_EQ("Find in page.", speech_monitor_.GetNextUtterance()); | |
| 568 EXPECT_EQ(",", speech_monitor_.GetNextUtterance()); | |
| 569 EXPECT_EQ("Enter a search query.", speech_monitor_.GetNextUtterance()); | |
| 570 } | |
| 571 | |
| 572 #if defined(MEMORY_SANITIZER) | |
| 573 // Fails under MemorySanitizer: http://crbug.com/472125 | |
| 574 #define MAYBE_ChromeVoxPrefixKey DISABLED_ChromeVoxPrefixKey | |
| 575 #else | |
| 576 #define MAYBE_ChromeVoxPrefixKey ChromeVoxPrefixKey | |
| 577 #endif | |
| 578 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxPrefixKey) { | |
| 579 LoadChromeVoxAndThenNavigateToURL( | |
| 580 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>")); | |
| 581 while (true) { | |
| 582 std::string utterance = speech_monitor_.GetNextUtterance(); | |
| 583 if (utterance == "Click me") | 526 if (utterance == "Click me") |
| 584 break; | 527 break; |
| 585 } | 528 } |
| 586 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 529 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
| 587 | 530 |
| 588 // Press the prefix key Ctrl+';' followed by '/' | 531 // Press Search+/ to enter ChromeVox's "find in page". |
| 589 // to enter ChromeVox's "find in page". | 532 SendKeyPressWithSearch(ui::VKEY_OEM_2); |
| 590 SendKeyPressWithControl(ui::VKEY_OEM_1); | 533 EXPECT_EQ(", window", speech_monitor_.GetNextUtterance()); |
| 591 SendKeyPress(ui::VKEY_OEM_2); | 534 EXPECT_EQ("webView", speech_monitor_.GetNextUtterance()); |
| 592 EXPECT_EQ("Find in page.", speech_monitor_.GetNextUtterance()); | 535 EXPECT_EQ("Find in page.", speech_monitor_.GetNextUtterance()); |
| 593 EXPECT_EQ(",", speech_monitor_.GetNextUtterance()); | |
| 594 EXPECT_EQ("Enter a search query.", speech_monitor_.GetNextUtterance()); | |
| 595 } | 536 } |
| 596 | 537 |
| 597 #if defined(MEMORY_SANITIZER) | 538 #if defined(MEMORY_SANITIZER) |
| 598 // Fails under MemorySanitizer: http://crbug.com/472125 | 539 // Fails under MemorySanitizer: http://crbug.com/472125 |
| 599 #define MAYBE_ChromeVoxNavigateAndSelect DISABLED_ChromeVoxNavigateAndSelect | 540 #define MAYBE_ChromeVoxNavigateAndSelect DISABLED_ChromeVoxNavigateAndSelect |
| 600 #else | 541 #else |
| 601 #define MAYBE_ChromeVoxNavigateAndSelect ChromeVoxNavigateAndSelect | 542 #define MAYBE_ChromeVoxNavigateAndSelect ChromeVoxNavigateAndSelect |
| 602 #endif | 543 #endif |
| 603 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxNavigateAndSelect) { | 544 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxNavigateAndSelect) { |
| 604 LoadChromeVoxAndThenNavigateToURL( | 545 EnableChromeVox(); |
| 605 GURL("data:text/html;charset=utf-8," | 546 |
| 606 "<h1>Title</h1>" | 547 ui_test_utils::NavigateToURL(browser(), |
| 607 "<button autofocus>Click me</button>")); | 548 GURL("data:text/html;charset=utf-8," |
| 549 "<h1>Title</h1>" |
| 550 "<button autofocus>Click me</button>")); |
| 608 while (true) { | 551 while (true) { |
| 609 std::string utterance = speech_monitor_.GetNextUtterance(); | 552 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 610 if (utterance == "Click me") | 553 if (utterance == "Click me") |
| 611 break; | 554 break; |
| 612 } | 555 } |
| 613 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 556 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
| 614 | 557 |
| 615 // Press Search+Shift+Up to navigate to the previous item. | 558 // Press Search+Left to navigate to the previous item. |
| 616 SendKeyPressWithSearchAndShift(ui::VKEY_UP); | 559 SendKeyPressWithSearch(ui::VKEY_LEFT); |
| 617 EXPECT_EQ("Title", speech_monitor_.GetNextUtterance()); | 560 EXPECT_EQ("Title", speech_monitor_.GetNextUtterance()); |
| 618 EXPECT_EQ("Heading 1", speech_monitor_.GetNextUtterance()); | 561 EXPECT_EQ("Heading 1", speech_monitor_.GetNextUtterance()); |
| 619 | 562 |
| 620 // Press Search+Shift+S to select the text. | 563 // Press Search+S to select the text. |
| 621 SendKeyPressWithSearchAndShift(ui::VKEY_S); | 564 SendKeyPressWithSearch(ui::VKEY_S); |
| 622 EXPECT_EQ("Start selection", speech_monitor_.GetNextUtterance()); | |
| 623 EXPECT_EQ("Title", speech_monitor_.GetNextUtterance()); | 565 EXPECT_EQ("Title", speech_monitor_.GetNextUtterance()); |
| 624 EXPECT_EQ(", selected", speech_monitor_.GetNextUtterance()); | 566 EXPECT_EQ("selected", speech_monitor_.GetNextUtterance()); |
| 625 | 567 |
| 626 // Press again to end the selection. | 568 // Press again to end the selection. |
| 627 SendKeyPressWithSearchAndShift(ui::VKEY_S); | 569 SendKeyPressWithSearch(ui::VKEY_S); |
| 628 EXPECT_EQ("End selection", speech_monitor_.GetNextUtterance()); | 570 EXPECT_EQ("End selection", speech_monitor_.GetNextUtterance()); |
| 629 EXPECT_EQ("Title", speech_monitor_.GetNextUtterance()); | 571 EXPECT_EQ("Title", speech_monitor_.GetNextUtterance()); |
| 630 } | 572 } |
| 631 | 573 |
| 632 // http://crbug.com/628060 | 574 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxNextStickyMode) { |
| 633 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_ChromeVoxStickyMode) { | 575 EnableChromeVox(); |
| 634 LoadChromeVoxAndThenNavigateToURL( | |
| 635 GURL("data:text/html;charset=utf-8," | |
| 636 "<label>Enter your name <input autofocus></label>" | |
| 637 "<p>One</p>" | |
| 638 "<h2>Two</h2>")); | |
| 639 while (speech_monitor_.GetNextUtterance() != "Enter your name") { | |
| 640 } | |
| 641 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance()); | |
| 642 | 576 |
| 643 // Press the sticky-key sequence: Search Search. | 577 ui_test_utils::NavigateToURL( |
| 644 SendKeyPress(ui::VKEY_LWIN); | 578 browser(), |
| 645 | 579 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>")); |
| 646 // Sticky key has a minimum 100 ms check to prevent key repeat from toggling | |
| 647 // it. | |
| 648 content::BrowserThread::PostDelayedTask( | |
| 649 content::BrowserThread::UI, FROM_HERE, | |
| 650 base::Bind(&LoggedInSpokenFeedbackTest::SendKeyPress, | |
| 651 base::Unretained(this), ui::VKEY_LWIN), | |
| 652 base::TimeDelta::FromMilliseconds(200)); | |
| 653 | |
| 654 EXPECT_EQ("Sticky mode enabled", speech_monitor_.GetNextUtterance()); | |
| 655 | |
| 656 // Even once we hear "sticky mode enabled" from the ChromeVox background | |
| 657 // page, there's a short window of time when the content script still | |
| 658 // hasn't switched to sticky mode. That's why we're focused on a text box. | |
| 659 // Keep pressing the '/' key. If sticky mode is off, it will echo the word | |
| 660 // "slash". If sticky mode is on, it will open "Find in page". Keep pressing | |
| 661 // '/' until we get "Find in page.". | |
| 662 PressRepeatedlyUntilUtterance(ui::VKEY_OEM_2, "Find in page."); | |
| 663 while (speech_monitor_.GetNextUtterance() != "Enter a search query.") { | |
| 664 } | |
| 665 | |
| 666 // Press Esc to exit Find in Page mode. | |
| 667 SendKeyPress(ui::VKEY_ESCAPE); | |
| 668 EXPECT_EQ("Exited", speech_monitor_.GetNextUtterance()); | |
| 669 while (speech_monitor_.GetNextUtterance() != "Find in page.") { | |
| 670 } | |
| 671 } | |
| 672 | |
| 673 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxNextStickyMode) { | |
| 674 LoadChromeVoxAndThenNavigateToURL( | |
| 675 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>" | |
| 676 "<!-- chromevox_next_test -->")); | |
| 677 while ("Button" != speech_monitor_.GetNextUtterance()) { | 580 while ("Button" != speech_monitor_.GetNextUtterance()) { |
| 678 } | 581 } |
| 679 | 582 |
| 680 // Press the sticky-key sequence: Search Search. | 583 // Press the sticky-key sequence: Search Search. |
| 681 SendKeyPress(ui::VKEY_LWIN); | 584 SendKeyPress(ui::VKEY_LWIN); |
| 682 | 585 |
| 683 // Sticky key has a minimum 100 ms check to prevent key repeat from toggling | 586 // Sticky key has a minimum 100 ms check to prevent key repeat from toggling |
| 684 // it. | 587 // it. |
| 685 content::BrowserThread::PostDelayedTask( | 588 content::BrowserThread::PostDelayedTask( |
| 686 content::BrowserThread::UI, FROM_HERE, | 589 content::BrowserThread::UI, FROM_HERE, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 DISALLOW_COPY_AND_ASSIGN(GuestSpokenFeedbackTest); | 648 DISALLOW_COPY_AND_ASSIGN(GuestSpokenFeedbackTest); |
| 746 }; | 649 }; |
| 747 | 650 |
| 748 IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) { | 651 IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) { |
| 749 EnableChromeVox(); | 652 EnableChromeVox(); |
| 750 | 653 |
| 751 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); | 654 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); |
| 752 | 655 |
| 753 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance()); | 656 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance()); |
| 754 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 657 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
| 755 EXPECT_EQ("main", speech_monitor_.GetNextUtterance()); | |
| 756 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance()); | |
| 757 EXPECT_TRUE( | |
| 758 base::MatchPattern(speech_monitor_.GetNextUtterance(), "about:blank*")); | |
| 759 } | 658 } |
| 760 | 659 |
| 761 // | 660 // |
| 762 // Spoken feedback tests of the out-of-box experience. | 661 // Spoken feedback tests of the out-of-box experience. |
| 763 // | 662 // |
| 764 | 663 |
| 765 class OobeSpokenFeedbackTest : public LoginManagerTest { | 664 class OobeSpokenFeedbackTest : public LoginManagerTest { |
| 766 protected: | 665 protected: |
| 767 OobeSpokenFeedbackTest() : LoginManagerTest(false) {} | 666 OobeSpokenFeedbackTest() : LoginManagerTest(false) {} |
| 768 ~OobeSpokenFeedbackTest() override {} | 667 ~OobeSpokenFeedbackTest() override {} |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( | 710 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( |
| 812 window, ui::VKEY_TAB, false, true /*shift*/, false, false)); | 711 window, ui::VKEY_TAB, false, true /*shift*/, false, false)); |
| 813 while (speech_monitor_.GetNextUtterance() != "Select your language:") { | 712 while (speech_monitor_.GetNextUtterance() != "Select your language:") { |
| 814 } | 713 } |
| 815 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); | 714 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); |
| 816 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), | 715 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), |
| 817 "Combo box * of *")); | 716 "Combo box * of *")); |
| 818 } | 717 } |
| 819 | 718 |
| 820 } // namespace chromeos | 719 } // namespace chromeos |
| OLD | NEW |