Chromium Code Reviews| 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 56108d61276fd99d5d1131adaa82ca438a874c6d..7bc835cf23339aa07aa9dd54f4a72138a5c6aae9 100644 |
| --- a/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc |
| +++ b/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc |
| @@ -62,9 +62,28 @@ class LoggedInSpokenFeedbackTest : public InProcessBrowserTest { |
| void SendKeyPress(ui::KeyboardCode key) { |
| gfx::NativeWindow root_window = |
| ash::Shell::GetInstance()->GetPrimaryRootWindow(); |
| - ASSERT_TRUE( |
| - ui_test_utils::SendKeyPressToWindowSync( |
| - root_window, key, false, false, false, false)); |
| + ASSERT_NO_FATAL_FAILURE( |
| + ASSERT_TRUE( |
| + ui_test_utils::SendKeyPressToWindowSync( |
| + root_window, key, false, false, false, false))); |
| + } |
| + |
| + void SendKeyPressWithControl(ui::KeyboardCode key) { |
| + gfx::NativeWindow root_window = |
| + ash::Shell::GetInstance()->GetPrimaryRootWindow(); |
| + ASSERT_NO_FATAL_FAILURE( |
| + ASSERT_TRUE( |
| + ui_test_utils::SendKeyPressToWindowSync( |
| + root_window, key, true, false, false, false))); |
| + } |
| + |
| + void SendKeyPressWithSearchAndShift(ui::KeyboardCode key) { |
| + gfx::NativeWindow root_window = |
| + ash::Shell::GetInstance()->GetPrimaryRootWindow(); |
| + ASSERT_NO_FATAL_FAILURE( |
| + ASSERT_TRUE( |
| + ui_test_utils::SendKeyPressToWindowSync( |
| + root_window, key, false, true, false, true))); |
| } |
| void SimulateTouchScreenInChromeVox() { |
| @@ -224,6 +243,56 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) { |
| EXPECT_EQ("z", monitor.GetNextUtterance()); |
| } |
| +IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxShiftSearch) { |
| + EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| + |
| + 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,<button autofocus>Click me</button>")); |
| + while (true) { |
| + std::string utterance = monitor.GetNextUtterance(); |
| + if (utterance == "Click me") |
| + break; |
| + } |
| + EXPECT_EQ("Button", monitor.GetNextUtterance()); |
| + |
| + // Press Search+Shift+/ to enter ChromeVox's "find in page". |
| + SendKeyPressWithSearchAndShift(ui::VKEY_OEM_2); |
| + EXPECT_EQ("Find in page.", monitor.GetNextUtterance()); |
| + EXPECT_EQ("Enter a search query.", monitor.GetNextUtterance()); |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxPrefixKey) { |
| + EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| + |
| + 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,<button autofocus>Click me</button>")); |
| + while (true) { |
| + std::string utterance = monitor.GetNextUtterance(); |
| + if (utterance == "Click me") |
| + break; |
| + } |
| + EXPECT_EQ("Button", monitor.GetNextUtterance()); |
| + |
| + // Press the prefix key Ctrl+';' followed by '/' |
| + // to enter ChromeVox's "find in page". |
| + SendKeyPressWithControl(ui::VKEY_OEM_1); |
| + SendKeyPress(ui::VKEY_OEM_2); |
| + EXPECT_EQ("Find in page.", monitor.GetNextUtterance()); |
| + EXPECT_EQ("Enter a search query.", monitor.GetNextUtterance()); |
| +} |
|
David Tseng
2014/08/19 17:48:38
Want to also add a test for search+shift+s as disc
dmazzoni
2014/08/19 20:16:53
Done.
|
| + |
| IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) { |
| EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |