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

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

Issue 2123973004: Define a minimum time for double tap in ChromeVox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. Created 4 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/common/key_util.js » ('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/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/common/accessibility_types.h" 9 #include "ash/common/accessibility_types.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 19 matching lines...) Expand all
30 #include "chrome/browser/ui/tabs/tab_strip_model.h" 30 #include "chrome/browser/ui/tabs/tab_strip_model.h"
31 #include "chrome/common/chrome_switches.h" 31 #include "chrome/common/chrome_switches.h"
32 #include "chrome/common/extensions/extension_constants.h" 32 #include "chrome/common/extensions/extension_constants.h"
33 #include "chrome/test/base/in_process_browser_test.h" 33 #include "chrome/test/base/in_process_browser_test.h"
34 #include "chrome/test/base/interactive_test_utils.h" 34 #include "chrome/test/base/interactive_test_utils.h"
35 #include "chrome/test/base/testing_profile.h" 35 #include "chrome/test/base/testing_profile.h"
36 #include "chrome/test/base/ui_test_utils.h" 36 #include "chrome/test/base/ui_test_utils.h"
37 #include "chromeos/chromeos_switches.h" 37 #include "chromeos/chromeos_switches.h"
38 #include "chromeos/login/user_names.h" 38 #include "chromeos/login/user_names.h"
39 #include "components/signin/core/account_id/account_id.h" 39 #include "components/signin/core/account_id/account_id.h"
40 #include "content/public/browser/browser_thread.h"
40 #include "content/public/common/url_constants.h" 41 #include "content/public/common/url_constants.h"
41 #include "content/public/test/browser_test_utils.h" 42 #include "content/public/test/browser_test_utils.h"
42 #include "content/public/test/test_utils.h" 43 #include "content/public/test/test_utils.h"
43 #include "extensions/browser/extension_host.h" 44 #include "extensions/browser/extension_host.h"
44 #include "extensions/browser/process_manager.h" 45 #include "extensions/browser/process_manager.h"
45 #include "testing/gtest/include/gtest/gtest.h" 46 #include "testing/gtest/include/gtest/gtest.h"
46 #include "ui/app_list/app_list_switches.h" 47 #include "ui/app_list/app_list_switches.h"
47 #include "ui/base/test/ui_controls.h" 48 #include "ui/base/test/ui_controls.h"
48 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 49 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
49 #include "ui/views/widget/widget.h" 50 #include "ui/views/widget/widget.h"
50 51
51 using extensions::api::braille_display_private::StubBrailleController; 52 using extensions::api::braille_display_private::StubBrailleController;
52 53
53 namespace chromeos { 54 namespace chromeos {
54 55
55 // 56 //
56 // Spoken feedback tests only in a logged in user's window. 57 // Spoken feedback tests only in a logged in user's window.
57 // 58 //
58 59
59 class LoggedInSpokenFeedbackTest : public InProcessBrowserTest { 60 class LoggedInSpokenFeedbackTest : public InProcessBrowserTest {
60 protected: 61 public:
61 LoggedInSpokenFeedbackTest() 62 LoggedInSpokenFeedbackTest()
62 : animation_mode_(ui::ScopedAnimationDurationScaleMode::ZERO_DURATION) {} 63 : animation_mode_(ui::ScopedAnimationDurationScaleMode::ZERO_DURATION) {}
63 ~LoggedInSpokenFeedbackTest() override {} 64 ~LoggedInSpokenFeedbackTest() override {}
64 65
65 void SetUpInProcessBrowserTestFixture() override { 66 void SetUpInProcessBrowserTestFixture() override {
66 AccessibilityManager::SetBrailleControllerForTest(&braille_controller_); 67 AccessibilityManager::SetBrailleControllerForTest(&braille_controller_);
67 } 68 }
68 69
69 void TearDownOnMainThread() override { 70 void TearDownOnMainThread() override {
70 AccessibilityManager::SetBrailleControllerForTest(nullptr); 71 AccessibilityManager::SetBrailleControllerForTest(nullptr);
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 GURL("data:text/html;charset=utf-8," 572 GURL("data:text/html;charset=utf-8,"
572 "<label>Enter your name <input autofocus></label>" 573 "<label>Enter your name <input autofocus></label>"
573 "<p>One</p>" 574 "<p>One</p>"
574 "<h2>Two</h2>")); 575 "<h2>Two</h2>"));
575 while (speech_monitor_.GetNextUtterance() != "Enter your name") { 576 while (speech_monitor_.GetNextUtterance() != "Enter your name") {
576 } 577 }
577 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance()); 578 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance());
578 579
579 // Press the sticky-key sequence: Search Search. 580 // Press the sticky-key sequence: Search Search.
580 SendKeyPress(ui::VKEY_LWIN); 581 SendKeyPress(ui::VKEY_LWIN);
581 SendKeyPress(ui::VKEY_LWIN); 582
583 // Sticky key has a minimum 100 ms check to prevent key repeat from toggling
584 // it.
585 content::BrowserThread::PostDelayedTask(
586 content::BrowserThread::UI, FROM_HERE,
587 base::Bind(&LoggedInSpokenFeedbackTest::SendKeyPress,
588 base::Unretained(this), ui::VKEY_LWIN),
589 base::TimeDelta::FromMilliseconds(200));
590
582 EXPECT_EQ("Sticky mode enabled", speech_monitor_.GetNextUtterance()); 591 EXPECT_EQ("Sticky mode enabled", speech_monitor_.GetNextUtterance());
583 592
584 // Even once we hear "sticky mode enabled" from the ChromeVox background 593 // Even once we hear "sticky mode enabled" from the ChromeVox background
585 // page, there's a short window of time when the content script still 594 // page, there's a short window of time when the content script still
586 // hasn't switched to sticky mode. That's why we're focused on a text box. 595 // hasn't switched to sticky mode. That's why we're focused on a text box.
587 // Keep pressing the '/' key. If sticky mode is off, it will echo the word 596 // Keep pressing the '/' key. If sticky mode is off, it will echo the word
588 // "slash". If sticky mode is on, it will open "Find in page". Keep pressing 597 // "slash". If sticky mode is on, it will open "Find in page". Keep pressing
589 // '/' until we get "Find in page.". 598 // '/' until we get "Find in page.".
590 PressRepeatedlyUntilUtterance(ui::VKEY_OEM_2, "Find in page."); 599 PressRepeatedlyUntilUtterance(ui::VKEY_OEM_2, "Find in page.");
591 while (speech_monitor_.GetNextUtterance() != "Enter a search query.") { 600 while (speech_monitor_.GetNextUtterance() != "Enter a search query.") {
592 } 601 }
593 602
594 // Press Esc to exit Find in Page mode. 603 // Press Esc to exit Find in Page mode.
595 SendKeyPress(ui::VKEY_ESCAPE); 604 SendKeyPress(ui::VKEY_ESCAPE);
596 EXPECT_EQ("Exited", speech_monitor_.GetNextUtterance()); 605 EXPECT_EQ("Exited", speech_monitor_.GetNextUtterance());
597 while (speech_monitor_.GetNextUtterance() != "Find in page.") { 606 while (speech_monitor_.GetNextUtterance() != "Find in page.") {
598 } 607 }
599 } 608 }
600 609
601 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxNextStickyMode) { 610 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxNextStickyMode) {
602 LoadChromeVoxAndThenNavigateToURL( 611 LoadChromeVoxAndThenNavigateToURL(
603 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>" 612 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>"
604 "<!-- chromevox_next_test -->")); 613 "<!-- chromevox_next_test -->"));
605 while ("Button" != speech_monitor_.GetNextUtterance()) { 614 while ("Button" != speech_monitor_.GetNextUtterance()) {
606 } 615 }
607 616
608 // Press the sticky-key sequence: Search Search. 617 // Press the sticky-key sequence: Search Search.
609 SendKeyPress(ui::VKEY_LWIN); 618 SendKeyPress(ui::VKEY_LWIN);
610 SendKeyPress(ui::VKEY_LWIN); 619
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
611 EXPECT_EQ("Sticky mode enabled", speech_monitor_.GetNextUtterance()); 628 EXPECT_EQ("Sticky mode enabled", speech_monitor_.GetNextUtterance());
612 629
613 SendKeyPress(ui::VKEY_H); 630 SendKeyPress(ui::VKEY_H);
614 while ("No next heading." != speech_monitor_.GetNextUtterance()) { 631 while ("No next heading." != speech_monitor_.GetNextUtterance()) {
615 } 632 }
616 633
617 SendKeyPress(ui::VKEY_LWIN); 634 SendKeyPress(ui::VKEY_LWIN);
618 SendKeyPress(ui::VKEY_LWIN); 635
636 // Sticky key has a minimum 100 ms check to prevent key repeat from toggling
637 // it.
638 content::BrowserThread::PostDelayedTask(
639 content::BrowserThread::UI, FROM_HERE,
640 base::Bind(&LoggedInSpokenFeedbackTest::SendKeyPress,
641 base::Unretained(this), ui::VKEY_LWIN),
642 base::TimeDelta::FromMilliseconds(200));
643
619 while ("Sticky mode disabled" != speech_monitor_.GetNextUtterance()) { 644 while ("Sticky mode disabled" != speech_monitor_.GetNextUtterance()) {
620 } 645 }
621 } 646 }
622 647
623 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) { 648 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) {
624 EnableChromeVox(); 649 EnableChromeVox();
625 SimulateTouchScreenInChromeVox(); 650 SimulateTouchScreenInChromeVox();
626 651
627 // Send an accessibility hover event on the system tray, which is 652 // Send an accessibility hover event on the system tray, which is
628 // what we get when you tap it on a touch screen when ChromeVox is on. 653 // what we get when you tap it on a touch screen when ChromeVox is on.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( 748 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
724 window, ui::VKEY_TAB, false, true /*shift*/, false, false)); 749 window, ui::VKEY_TAB, false, true /*shift*/, false, false));
725 while (speech_monitor_.GetNextUtterance() != "Select your language:") { 750 while (speech_monitor_.GetNextUtterance() != "Select your language:") {
726 } 751 }
727 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); 752 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance());
728 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), 753 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(),
729 "Combo box * of *")); 754 "Combo box * of *"));
730 } 755 }
731 756
732 } // namespace chromeos 757 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/common/key_util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698