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..029a98b17dcb5545d6c2391886d24e314da98be9 100644 |
| --- a/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc |
| +++ b/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc |
| @@ -67,6 +67,22 @@ class LoggedInSpokenFeedbackTest : public InProcessBrowserTest { |
| root_window, key, false, false, false, false)); |
| } |
| + void SendKeyPressWithControl(ui::KeyboardCode key) { |
|
sky
2014/08/19 16:27:13
You need to wrap calls to these in ASSERT_NO_FATAL
dmazzoni
2014/08/19 16:53:55
Done.
|
| + gfx::NativeWindow root_window = |
| + ash::Shell::GetInstance()->GetPrimaryRootWindow(); |
|
sky
2014/08/19 16:27:13
Why is this sending to ash?
dmazzoni
2014/08/19 16:53:55
These are very high-level integration tests that a
sky
2014/08/19 19:47:55
If you're saying the window doesn't matter, then s
|
| + 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_TRUE( |
| + ui_test_utils::SendKeyPressToWindowSync( |
| + root_window, key, false, true, false, true)); |
| + } |
| + |
| void SimulateTouchScreenInChromeVox() { |
| // ChromeVox looks at whether 'ontouchstart' exists to know whether |
| // or not it should respond to hover events. Fake it so that touch |
| @@ -224,6 +240,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()); |
| +} |
| + |
| IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) { |
| EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |