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 } | 135 } |
131 | 136 |
132 void LoadChromeVoxAndThenNavigateToURL(const GURL& url) { | |
133 // The goal of this helper function is to avoid race conditions between | |
134 // the page loading and the ChromeVox extension loading and fully | |
135 // initializing. To do this, we first load a test url that repeatedly | |
136 // asks ChromeVox to speak 'ready', then we load ChromeVox and block | |
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 } | |
160 | |
161 void PressRepeatedlyUntilUtterance(ui::KeyboardCode key, | 137 void PressRepeatedlyUntilUtterance(ui::KeyboardCode key, |
162 const std::string& expected_utterance) { | 138 const std::string& expected_utterance) { |
163 // This helper function is needed when you want to poll for something | 139 // This helper function is needed when you want to poll for something |
164 // that happens asynchronously. Keep pressing |key|, until | 140 // that happens asynchronously. Keep pressing |key|, until |
165 // the speech feedback that follows is |expected_utterance|. | 141 // the speech feedback that follows is |expected_utterance|. |
166 // Note that this doesn't work if pressing that key doesn't speak anything | 142 // Note that this doesn't work if pressing that key doesn't speak anything |
167 // at all before the asynchronous event occurred. | 143 // at all before the asynchronous event occurred. |
168 while (true) { | 144 while (true) { |
169 SendKeyPress(key); | 145 SendKeyPress(key); |
170 const std::string& utterance = speech_monitor_.GetNextUtterance(); | 146 const std::string& utterance = speech_monitor_.GetNextUtterance(); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 // AudioOutputResampler::Shutdown, see crbug.com/630031. | 278 // AudioOutputResampler::Shutdown, see crbug.com/630031. |
303 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_EnableSpokenFeedback) { | 279 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_EnableSpokenFeedback) { |
304 EnableChromeVox(); | 280 EnableChromeVox(); |
305 } | 281 } |
306 | 282 |
307 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) { | 283 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) { |
308 EnableChromeVox(); | 284 EnableChromeVox(); |
309 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); | 285 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); |
310 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance()); | 286 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance()); |
311 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 287 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 } | 288 } |
317 | 289 |
318 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) { | 290 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) { |
319 EnableChromeVox(); | 291 EnableChromeVox(); |
320 | 292 |
321 chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION); | 293 // 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); | 294 SendKeyPress(ui::VKEY_X); |
331 EXPECT_EQ("x", speech_monitor_.GetNextUtterance()); | 295 EXPECT_EQ("x", speech_monitor_.GetNextUtterance()); |
332 | 296 |
333 SendKeyPress(ui::VKEY_Y); | 297 SendKeyPress(ui::VKEY_Y); |
334 EXPECT_EQ("y", speech_monitor_.GetNextUtterance()); | 298 EXPECT_EQ("y", speech_monitor_.GetNextUtterance()); |
335 | 299 |
336 SendKeyPress(ui::VKEY_Z); | 300 SendKeyPress(ui::VKEY_Z); |
337 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); | 301 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); |
338 | 302 |
339 SendKeyPress(ui::VKEY_BACK); | 303 SendKeyPress(ui::VKEY_BACK); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 while (true) { | 395 while (true) { |
432 std::string utterance = speech_monitor_.GetNextUtterance(); | 396 std::string utterance = speech_monitor_.GetNextUtterance(); |
433 if (base::MatchPattern(utterance, "window")) | 397 if (base::MatchPattern(utterance, "window")) |
434 break; | 398 break; |
435 } | 399 } |
436 | 400 |
437 SendKeyPress(ui::VKEY_TAB); | 401 SendKeyPress(ui::VKEY_TAB); |
438 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); | 402 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); |
439 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); | 403 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); |
440 | 404 |
441 // Compat next element. | 405 // Next element. |
442 SendKeyPressWithSearchAndShift(ui::VKEY_RIGHT); | 406 SendKeyPressWithSearch(ui::VKEY_RIGHT); |
443 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); | 407 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); |
444 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); | 408 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); |
445 | 409 |
446 // Compat next button. | 410 // Next button. |
447 SendKeyPressWithSearchAndShift(ui::VKEY_N); | 411 SendKeyPressWithSearch(ui::VKEY_B); |
448 SendKeyPress(ui::VKEY_B); | |
449 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); | 412 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); |
450 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); | 413 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); |
451 | 414 |
452 // Navigate to Bluetooth sub-menu and open it. | 415 // Navigate to Bluetooth sub-menu and open it. |
453 while (true) { | 416 while (true) { |
454 SendKeyPress(ui::VKEY_TAB); | 417 SendKeyPress(ui::VKEY_TAB); |
455 std::string content = speech_monitor_.GetNextUtterance(); | 418 std::string content = speech_monitor_.GetNextUtterance(); |
456 std::string role = speech_monitor_.GetNextUtterance(); | 419 std::string role = speech_monitor_.GetNextUtterance(); |
457 if (base::MatchPattern(content, "*Bluetooth*") && | 420 if (base::MatchPattern(content, "*Bluetooth*") && |
458 base::MatchPattern(role, "Button")) | 421 base::MatchPattern(role, "Button")) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 483 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
521 } | 484 } |
522 | 485 |
523 #if defined(MEMORY_SANITIZER) | 486 #if defined(MEMORY_SANITIZER) |
524 // Fails under MemorySanitizer: http://crbug.com/472125 | 487 // Fails under MemorySanitizer: http://crbug.com/472125 |
525 #define MAYBE_ChromeVoxShiftSearch DISABLED_ChromeVoxShiftSearch | 488 #define MAYBE_ChromeVoxShiftSearch DISABLED_ChromeVoxShiftSearch |
526 #else | 489 #else |
527 #define MAYBE_ChromeVoxShiftSearch ChromeVoxShiftSearch | 490 #define MAYBE_ChromeVoxShiftSearch ChromeVoxShiftSearch |
528 #endif | 491 #endif |
529 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxShiftSearch) { | 492 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxShiftSearch) { |
530 LoadChromeVoxAndThenNavigateToURL( | 493 EnableChromeVox(); |
| 494 |
| 495 ui_test_utils::NavigateToURL( |
| 496 browser(), |
531 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>")); | 497 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>")); |
532 while (true) { | 498 while (true) { |
533 std::string utterance = speech_monitor_.GetNextUtterance(); | 499 std::string utterance = speech_monitor_.GetNextUtterance(); |
534 if (utterance == "Click me") | |
535 break; | |
536 } | |
537 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | |
538 | |
539 // Press Search+Shift+/ to enter ChromeVox's "find in page". | |
540 SendKeyPressWithSearchAndShift(ui::VKEY_OEM_2); | |
541 EXPECT_EQ("Find in page.", speech_monitor_.GetNextUtterance()); | |
542 EXPECT_EQ(",", speech_monitor_.GetNextUtterance()); | |
543 EXPECT_EQ("Enter a search query.", speech_monitor_.GetNextUtterance()); | |
544 } | |
545 | |
546 #if defined(MEMORY_SANITIZER) | |
547 // Fails under MemorySanitizer: http://crbug.com/472125 | |
548 #define MAYBE_ChromeVoxPrefixKey DISABLED_ChromeVoxPrefixKey | |
549 #else | |
550 #define MAYBE_ChromeVoxPrefixKey ChromeVoxPrefixKey | |
551 #endif | |
552 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxPrefixKey) { | |
553 LoadChromeVoxAndThenNavigateToURL( | |
554 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>")); | |
555 while (true) { | |
556 std::string utterance = speech_monitor_.GetNextUtterance(); | |
557 if (utterance == "Click me") | 500 if (utterance == "Click me") |
558 break; | 501 break; |
559 } | 502 } |
560 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 503 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
561 | 504 |
562 // Press the prefix key Ctrl+';' followed by '/' | 505 // Press Search+/ to enter ChromeVox's "find in page". |
563 // to enter ChromeVox's "find in page". | 506 SendKeyPressWithSearch(ui::VKEY_OEM_2); |
564 SendKeyPressWithControl(ui::VKEY_OEM_1); | 507 EXPECT_EQ("webView", speech_monitor_.GetNextUtterance()); |
565 SendKeyPress(ui::VKEY_OEM_2); | 508 EXPECT_EQ(", window", speech_monitor_.GetNextUtterance()); |
566 EXPECT_EQ("Find in page.", speech_monitor_.GetNextUtterance()); | 509 EXPECT_EQ("Find in page.", speech_monitor_.GetNextUtterance()); |
567 EXPECT_EQ(",", speech_monitor_.GetNextUtterance()); | |
568 EXPECT_EQ("Enter a search query.", speech_monitor_.GetNextUtterance()); | |
569 } | 510 } |
570 | 511 |
571 #if defined(MEMORY_SANITIZER) | 512 #if defined(MEMORY_SANITIZER) |
572 // Fails under MemorySanitizer: http://crbug.com/472125 | 513 // Fails under MemorySanitizer: http://crbug.com/472125 |
573 #define MAYBE_ChromeVoxNavigateAndSelect DISABLED_ChromeVoxNavigateAndSelect | 514 #define MAYBE_ChromeVoxNavigateAndSelect DISABLED_ChromeVoxNavigateAndSelect |
574 #else | 515 #else |
575 #define MAYBE_ChromeVoxNavigateAndSelect ChromeVoxNavigateAndSelect | 516 #define MAYBE_ChromeVoxNavigateAndSelect ChromeVoxNavigateAndSelect |
576 #endif | 517 #endif |
577 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxNavigateAndSelect) { | 518 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxNavigateAndSelect) { |
578 LoadChromeVoxAndThenNavigateToURL( | 519 EnableChromeVox(); |
579 GURL("data:text/html;charset=utf-8," | 520 |
580 "<h1>Title</h1>" | 521 ui_test_utils::NavigateToURL(browser(), |
581 "<button autofocus>Click me</button>")); | 522 GURL("data:text/html;charset=utf-8," |
| 523 "<h1>Title</h1>" |
| 524 "<button autofocus>Click me</button>")); |
582 while (true) { | 525 while (true) { |
583 std::string utterance = speech_monitor_.GetNextUtterance(); | 526 std::string utterance = speech_monitor_.GetNextUtterance(); |
584 if (utterance == "Click me") | 527 if (utterance == "Click me") |
585 break; | 528 break; |
586 } | 529 } |
587 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 530 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
588 | 531 |
589 // Press Search+Shift+Up to navigate to the previous item. | 532 // Press Search+Left to navigate to the previous item. |
590 SendKeyPressWithSearchAndShift(ui::VKEY_UP); | 533 SendKeyPressWithSearch(ui::VKEY_LEFT); |
591 EXPECT_EQ("Title", speech_monitor_.GetNextUtterance()); | 534 EXPECT_EQ("Title", speech_monitor_.GetNextUtterance()); |
592 EXPECT_EQ("Heading 1", speech_monitor_.GetNextUtterance()); | 535 EXPECT_EQ("Heading 1", speech_monitor_.GetNextUtterance()); |
593 | 536 |
594 // Press Search+Shift+S to select the text. | 537 // Press Search+S to select the text. |
595 SendKeyPressWithSearchAndShift(ui::VKEY_S); | 538 SendKeyPressWithSearch(ui::VKEY_S); |
596 EXPECT_EQ("Start selection", speech_monitor_.GetNextUtterance()); | |
597 EXPECT_EQ("Title", speech_monitor_.GetNextUtterance()); | 539 EXPECT_EQ("Title", speech_monitor_.GetNextUtterance()); |
598 EXPECT_EQ(", selected", speech_monitor_.GetNextUtterance()); | 540 EXPECT_EQ("selected", speech_monitor_.GetNextUtterance()); |
599 | 541 |
600 // Press again to end the selection. | 542 // Press again to end the selection. |
601 SendKeyPressWithSearchAndShift(ui::VKEY_S); | 543 SendKeyPressWithSearch(ui::VKEY_S); |
602 EXPECT_EQ("End selection", speech_monitor_.GetNextUtterance()); | 544 EXPECT_EQ("End selection", speech_monitor_.GetNextUtterance()); |
603 EXPECT_EQ("Title", speech_monitor_.GetNextUtterance()); | 545 EXPECT_EQ("Title", speech_monitor_.GetNextUtterance()); |
604 } | 546 } |
605 | 547 |
606 // http://crbug.com/628060 | 548 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxNextStickyMode) { |
607 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_ChromeVoxStickyMode) { | 549 EnableChromeVox(); |
608 LoadChromeVoxAndThenNavigateToURL( | |
609 GURL("data:text/html;charset=utf-8," | |
610 "<label>Enter your name <input autofocus></label>" | |
611 "<p>One</p>" | |
612 "<h2>Two</h2>")); | |
613 while (speech_monitor_.GetNextUtterance() != "Enter your name") { | |
614 } | |
615 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance()); | |
616 | 550 |
617 // Press the sticky-key sequence: Search Search. | 551 ui_test_utils::NavigateToURL( |
618 SendKeyPress(ui::VKEY_LWIN); | 552 browser(), |
619 | 553 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>")); |
620 // Sticky key has a minimum 100 ms check to prevent key repeat from toggling | |
621 // it. | |
622 content::BrowserThread::PostDelayedTask( | |
623 content::BrowserThread::UI, FROM_HERE, | |
624 base::Bind(&LoggedInSpokenFeedbackTest::SendKeyPress, | |
625 base::Unretained(this), ui::VKEY_LWIN), | |
626 base::TimeDelta::FromMilliseconds(200)); | |
627 | |
628 EXPECT_EQ("Sticky mode enabled", speech_monitor_.GetNextUtterance()); | |
629 | |
630 // Even once we hear "sticky mode enabled" from the ChromeVox background | |
631 // page, there's a short window of time when the content script still | |
632 // hasn't switched to sticky mode. That's why we're focused on a text box. | |
633 // Keep pressing the '/' key. If sticky mode is off, it will echo the word | |
634 // "slash". If sticky mode is on, it will open "Find in page". Keep pressing | |
635 // '/' until we get "Find in page.". | |
636 PressRepeatedlyUntilUtterance(ui::VKEY_OEM_2, "Find in page."); | |
637 while (speech_monitor_.GetNextUtterance() != "Enter a search query.") { | |
638 } | |
639 | |
640 // Press Esc to exit Find in Page mode. | |
641 SendKeyPress(ui::VKEY_ESCAPE); | |
642 EXPECT_EQ("Exited", speech_monitor_.GetNextUtterance()); | |
643 while (speech_monitor_.GetNextUtterance() != "Find in page.") { | |
644 } | |
645 } | |
646 | |
647 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxNextStickyMode) { | |
648 LoadChromeVoxAndThenNavigateToURL( | |
649 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>" | |
650 "<!-- chromevox_next_test -->")); | |
651 while ("Button" != speech_monitor_.GetNextUtterance()) { | 554 while ("Button" != speech_monitor_.GetNextUtterance()) { |
652 } | 555 } |
653 | 556 |
654 // Press the sticky-key sequence: Search Search. | 557 // Press the sticky-key sequence: Search Search. |
655 SendKeyPress(ui::VKEY_LWIN); | 558 SendKeyPress(ui::VKEY_LWIN); |
656 | 559 |
657 // Sticky key has a minimum 100 ms check to prevent key repeat from toggling | 560 // Sticky key has a minimum 100 ms check to prevent key repeat from toggling |
658 // it. | 561 // it. |
659 content::BrowserThread::PostDelayedTask( | 562 content::BrowserThread::PostDelayedTask( |
660 content::BrowserThread::UI, FROM_HERE, | 563 content::BrowserThread::UI, FROM_HERE, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 DISALLOW_COPY_AND_ASSIGN(GuestSpokenFeedbackTest); | 622 DISALLOW_COPY_AND_ASSIGN(GuestSpokenFeedbackTest); |
720 }; | 623 }; |
721 | 624 |
722 IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) { | 625 IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) { |
723 EnableChromeVox(); | 626 EnableChromeVox(); |
724 | 627 |
725 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); | 628 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); |
726 | 629 |
727 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance()); | 630 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance()); |
728 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 631 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
729 EXPECT_EQ("main", speech_monitor_.GetNextUtterance()); | |
730 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance()); | |
731 EXPECT_TRUE( | |
732 base::MatchPattern(speech_monitor_.GetNextUtterance(), "about:blank*")); | |
733 } | 632 } |
734 | 633 |
735 // | 634 // |
736 // Spoken feedback tests of the out-of-box experience. | 635 // Spoken feedback tests of the out-of-box experience. |
737 // | 636 // |
738 | 637 |
739 class OobeSpokenFeedbackTest : public LoginManagerTest { | 638 class OobeSpokenFeedbackTest : public LoginManagerTest { |
740 protected: | 639 protected: |
741 OobeSpokenFeedbackTest() : LoginManagerTest(false) {} | 640 OobeSpokenFeedbackTest() : LoginManagerTest(false) {} |
742 ~OobeSpokenFeedbackTest() override {} | 641 ~OobeSpokenFeedbackTest() override {} |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( | 684 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( |
786 window, ui::VKEY_TAB, false, true /*shift*/, false, false)); | 685 window, ui::VKEY_TAB, false, true /*shift*/, false, false)); |
787 while (speech_monitor_.GetNextUtterance() != "Select your language:") { | 686 while (speech_monitor_.GetNextUtterance() != "Select your language:") { |
788 } | 687 } |
789 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); | 688 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); |
790 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), | 689 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), |
791 "Combo box * of *")); | 690 "Combo box * of *")); |
792 } | 691 } |
793 | 692 |
794 } // namespace chromeos | 693 } // namespace chromeos |
OLD | NEW |