diff options
author | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-26 23:23:08 +0000 |
---|---|---|
committer | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-26 23:23:08 +0000 |
commit | cd85890e155f6ece542db21ecdfc10608aa6d012 (patch) | |
tree | 80632a3050e9e3f5a28adcc6041c326c4334f4df /chrome/browser/chromeos/accessibility | |
parent | 5b14d57302f3443f8d55b2ffa67d827365b402dc (diff) | |
download | chromium_src-cd85890e155f6ece542db21ecdfc10608aa6d012.zip chromium_src-cd85890e155f6ece542db21ecdfc10608aa6d012.tar.gz chromium_src-cd85890e155f6ece542db21ecdfc10608aa6d012.tar.bz2 |
Test that simulates touch exploration on the system tray and checks speech.
BUG=392666
Review URL: https://codereview.chromium.org/422583002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285817 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/accessibility')
-rw-r--r-- | chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc b/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc index 44c1884..56108d6 100644 --- a/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc +++ b/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc @@ -5,6 +5,7 @@ #include <queue> #include "ash/shell.h" +#include "ash/system/tray/system_tray.h" #include "base/command_line.h" #include "base/strings/string_util.h" #include "chrome/app/chrome_command_ids.h" @@ -21,6 +22,7 @@ #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/extension_constants.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/testing_profile.h" @@ -28,7 +30,10 @@ #include "chromeos/chromeos_switches.h" #include "chromeos/login/user_names.h" #include "content/public/common/url_constants.h" +#include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" +#include "extensions/browser/extension_host.h" +#include "extensions/browser/process_manager.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/test/ui_controls.h" #include "ui/views/widget/widget.h" @@ -62,6 +67,19 @@ class LoggedInSpokenFeedbackTest : public InProcessBrowserTest { root_window, key, false, false, false, false)); } + void SimulateTouchScreenInChromeVox() { + // ChromeVox looks at whether 'ontouchstart' exists to know whether + // or not it should respond to hover events. Fake it so that touch + // exploration events get spoken. + extensions::ExtensionHost* host = + extensions::ExtensionSystem::Get(browser()->profile())-> + process_manager()->GetBackgroundHostForExtension( + extension_misc::kChromeVoxExtensionId); + CHECK(content::ExecuteScript( + host->host_contents(), + "window.ontouchstart = function() {};")); + } + private: StubBrailleController braille_controller_; DISALLOW_COPY_AND_ASSIGN(LoggedInSpokenFeedbackTest); @@ -206,6 +224,27 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) { EXPECT_EQ("z", monitor.GetNextUtterance()); } +IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) { + EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); + + SpeechMonitor monitor; + AccessibilityManager::Get()->EnableSpokenFeedback( + true, ash::A11Y_NOTIFICATION_NONE); + EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); + + SimulateTouchScreenInChromeVox(); + + // Send an accessibility hover event on the system tray, which is + // what we get when you tap it on a touch screen when ChromeVox is on. + ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); + tray->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); + + EXPECT_EQ("Status tray,", monitor.GetNextUtterance()); + EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "time*,")); + EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Battery*,")); + EXPECT_EQ("button", monitor.GetNextUtterance()); +} + // // Spoken feedback tests that run only in guest mode. // |