Index: chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc |
diff --git a/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc b/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc |
index a359a23566698a3fcc040f6e244da47cac9f3208..be39282656d945e1255f4abb8313d3055afeb40b 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,30 @@ 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); |
+ printf("*** Skipping ChromeVox enabled message\n"); |
+ EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); |
+ printf("*** Skipped\n"); |
+ |
evy1
2014/07/25 22:02:13
Whoops - you forgot to remove your printf statemen
dmazzoni
2014/07/25 22:05:22
Done.
|
+ 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(); |
+ printf("Tray: %p\n", tray); |
+ 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. |
// |