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

Unified Diff: chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc

Issue 422583002: Test that simulates touch exploration on the system tray and checks speech. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
//
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698