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 76ee1fe067d7992e1c61c4c561cc15cceacadafa..45731c2f93e2b397181fdef97777eba1e2892cf6 100644 |
--- a/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc |
+++ b/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc |
@@ -338,6 +338,64 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxNavigateAndSelect) { |
EXPECT_EQ("Title", monitor.GetNextUtterance()); |
} |
+IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxStickyMode) { |
+ EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
David Tseng
2014/09/25 20:36:57
ASSERT?
dmazzoni
2014/09/25 22:49:27
Done.
|
+ |
+ SpeechMonitor monitor; |
+ AccessibilityManager::Get()->EnableSpokenFeedback( |
+ true, ash::A11Y_NOTIFICATION_NONE); |
+ EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); |
+ |
+ ui_test_utils::NavigateToURL( |
+ browser(), |
+ GURL("data:text/html;charset=utf-8," |
+ "<label>Enter your name <input autofocus></label>" |
+ "<p>One</p>" |
+ "<h2>Two</h2>")); |
+ while (monitor.GetNextUtterance() != "Enter your name") { |
+ } |
+ EXPECT_EQ("Edit text", monitor.GetNextUtterance()); |
+ |
+ // Press the sticky-key sequence: Search Search. |
+ SendKeyPress(ui::VKEY_LWIN); |
+ SendKeyPress(ui::VKEY_LWIN); |
+ EXPECT_EQ("Sticky mode enabled", monitor.GetNextUtterance()); |
+ |
+ // Even once we hear "sticky mode enabled" from the ChromeVox background |
+ // page, there's a short window of time when the content script still |
+ // hasn't switched to sticky mode. That's why we're focused on a text box. |
+ // Keep pressing the '/' key. If sticky mode is off, it will echo the word |
+ // "slash". If sticky mode is on, it will open "Find in page". Keep pressing |
+ // '/' until we get "Find in page.". |
+ while (true) { |
David Tseng
2014/09/25 20:36:57
I've had to do something similar for ChromeVox Nex
dmazzoni
2014/09/25 22:49:27
Done.
|
+ SendKeyPress(ui::VKEY_OEM_2); |
+ const std::string& utterance = monitor.GetNextUtterance(); |
+ if (utterance == "Find in page.") { |
+ break; |
+ } else { |
+ ASSERT_EQ("slash", utterance); |
+ } |
+ } |
+ EXPECT_EQ("Enter a search query.", monitor.GetNextUtterance()); |
+ |
+ // Press Esc to exit Find in Page mode. |
+ SendKeyPress(ui::VKEY_ESCAPE); |
+ EXPECT_EQ("Exited", monitor.GetNextUtterance()); |
+ EXPECT_EQ("Find in page.", monitor.GetNextUtterance()); |
+ |
+ // Press N H to jump to the next heading. Skip over speech in-between |
+ // but make sure we end up at the heading. |
+ SendKeyPress(ui::VKEY_N); |
+ SendKeyPress(ui::VKEY_H); |
+ while (monitor.GetNextUtterance() != "Two") { |
+ } |
+ EXPECT_EQ("Heading 2", monitor.GetNextUtterance()); |
+ |
+ // Press the up arrow to go to the previous element. |
+ SendKeyPress(ui::VKEY_UP); |
+ EXPECT_EQ("One", monitor.GetNextUtterance()); |
+} |
+ |
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) { |
EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |