Chromium Code Reviews| Index: chrome/browser/ui/views/accessibility/spoken_feedback_views_browsertest.cc |
| diff --git a/chrome/browser/ui/views/accessibility/spoken_feedback_views_browsertest.cc b/chrome/browser/ui/views/accessibility/spoken_feedback_views_browsertest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8bac380df5c800bc9b9330378f970383c264b21c |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/accessibility/spoken_feedback_views_browsertest.cc |
| @@ -0,0 +1,71 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/strings/string_util.h" |
| +#include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| +#include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| +#include "chrome/browser/chromeos/accessibility/speech_monitor.h" |
| +#include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| +#include "chrome/browser/ui/views/frame/browser_view.h" |
| +#include "chrome/browser/ui/views/tabs/tab_strip.h" |
| +#include "chrome/test/base/in_process_browser_test.h" |
| + |
| +// There are spoken feedback tests in browser/chromeos/accessibility but |
| +// these tests rely on browser views, so they have been placed in this file |
| +// in the views directory. The shared function between the spoken feedback |
| +// tests that simulates the touch screen with ChromeVox is kept in the |
| +// accessiblity utils file. |
| +typedef InProcessBrowserTest SpokenFeedbackViewsTest; |
| + |
| +namespace chromeos { |
| + |
| +// These tests fetch views from the browser and triggers an accessibilty event |
|
James Cook
2014/08/08 20:26:46
One comment per test, please. When these tests fai
evy
2014/08/08 21:00:29
Done.
|
| +// on these views to ensure the correct text is being read. |
| + |
| +IN_PROC_BROWSER_TEST_F(SpokenFeedbackViewsTest, |
| + TouchExploreBookmarkBarInstructions) { |
| + ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| + SpeechMonitor monitor; |
| + AccessibilityManager::Get()->EnableSpokenFeedback( |
| + true, ash::A11Y_NOTIFICATION_NONE); |
| + EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); |
| + |
| + accessibility::SimulateTouchScreenInChromeVoxForTest(browser()->profile()); |
| + |
| + // Send an accessibility hover event on the empty bookmarks bar, which is |
| + // what we get when you tap it on a touch screen when ChromeVox is on. |
| + BrowserView* browser_view = |
| + static_cast<BrowserView*>(browser()->window()); |
| + BookmarkBarView* bookmarks_bar = browser_view->GetBookmarkBarView(); |
| + views::View* instructions = bookmarks_bar->GetBookmarkBarInstructionsView(); |
| + instructions->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); |
| + |
| + EXPECT_EQ("Bookmarks,", monitor.GetNextUtterance()); |
| + EXPECT_EQ("For quick access,", monitor.GetNextUtterance()); |
| + EXPECT_EQ("place your bookmarks here on the bookmarks bar.", |
| + monitor.GetNextUtterance()); |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_F(SpokenFeedbackViewsTest, TouchExploreTabs) { |
| + EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
|
James Cook
2014/08/08 20:26:46
ASSERT_FALSE like above
evy
2014/08/08 21:00:29
Done.
|
| + SpeechMonitor monitor; |
| + AccessibilityManager::Get()->EnableSpokenFeedback( |
| + true, ash::A11Y_NOTIFICATION_NONE); |
| + EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); |
| + |
| + accessibility::SimulateTouchScreenInChromeVoxForTest(browser()->profile()); |
| + |
| + // Send an accessibility hover event on a tab in the tap strip, which is |
| + // what we get when you tap it on a touch screen when ChromeVox is on. |
| + BrowserView* browser_view = |
| + static_cast<BrowserView*>(browser()->window()); |
| + TabStrip* tab_strip = browser_view->tabstrip(); |
| + ASSERT_EQ(tab_strip->tab_count(), 1); |
| + |
| + Tab* tab = tab_strip->tab_at(0); |
| + tab->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); |
| + EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "*, tab * of *")); |
| +} |
| + |
| +} // namespace chromeos |