Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/strings/string_util.h" | |
| 6 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | |
|
dmazzoni
2014/08/11 08:17:09
It doesn't make sense to me that a file in chrome/
| |
| 7 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | |
| 8 #include "chrome/browser/chromeos/accessibility/speech_monitor.h" | |
| 9 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | |
| 10 #include "chrome/browser/ui/views/frame/browser_view.h" | |
| 11 #include "chrome/browser/ui/views/tabs/tab_strip.h" | |
| 12 #include "chrome/test/base/in_process_browser_test.h" | |
| 13 | |
| 14 // There are spoken feedback tests in browser/chromeos/accessibility but | |
| 15 // these tests rely on browser views, so they have been placed in this file | |
| 16 // in the views directory. The shared function between the spoken feedback | |
| 17 // tests that simulates the touch screen with ChromeVox is kept in the | |
| 18 // accessiblity utils file. | |
| 19 typedef InProcessBrowserTest SpokenFeedbackViewsTest; | |
| 20 | |
| 21 namespace chromeos { | |
| 22 | |
| 23 // Fetch the bookmark bar instructions view from the browser and trigger an | |
| 24 // accessibilty event on the view to ensure the correct text is being read. | |
| 25 IN_PROC_BROWSER_TEST_F(SpokenFeedbackViewsTest, | |
| 26 TouchExploreBookmarkBarInstructions) { | |
| 27 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | |
| 28 SpeechMonitor monitor; | |
| 29 AccessibilityManager::Get()->EnableSpokenFeedback( | |
| 30 true, ash::A11Y_NOTIFICATION_NONE); | |
| 31 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); | |
| 32 | |
| 33 accessibility::SimulateTouchScreenInChromeVoxForTest(browser()->profile()); | |
| 34 | |
| 35 // Send an accessibility hover event on the empty bookmarks bar, which is | |
| 36 // what we get when you tap it on a touch screen when ChromeVox is on. | |
| 37 BrowserView* browser_view = | |
| 38 static_cast<BrowserView*>(browser()->window()); | |
| 39 BookmarkBarView* bookmarks_bar = browser_view->GetBookmarkBarView(); | |
| 40 views::View* instructions = bookmarks_bar->GetBookmarkBarInstructionsView(); | |
| 41 instructions->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); | |
| 42 | |
| 43 EXPECT_EQ("Bookmarks,", monitor.GetNextUtterance()); | |
| 44 EXPECT_EQ("For quick access,", monitor.GetNextUtterance()); | |
| 45 EXPECT_EQ("place your bookmarks here on the bookmarks bar.", | |
| 46 monitor.GetNextUtterance()); | |
| 47 } | |
| 48 | |
| 49 // Fetch a tab view from the browser and trigger an accessibilty event on the | |
| 50 // view to ensure the correct text is being read. | |
| 51 IN_PROC_BROWSER_TEST_F(SpokenFeedbackViewsTest, TouchExploreTabs) { | |
| 52 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | |
| 53 SpeechMonitor monitor; | |
| 54 AccessibilityManager::Get()->EnableSpokenFeedback( | |
| 55 true, ash::A11Y_NOTIFICATION_NONE); | |
| 56 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); | |
| 57 | |
| 58 accessibility::SimulateTouchScreenInChromeVoxForTest(browser()->profile()); | |
| 59 | |
| 60 // Send an accessibility hover event on a tab in the tap strip, which is | |
| 61 // what we get when you tap it on a touch screen when ChromeVox is on. | |
| 62 BrowserView* browser_view = | |
| 63 static_cast<BrowserView*>(browser()->window()); | |
| 64 TabStrip* tab_strip = browser_view->tabstrip(); | |
| 65 ASSERT_EQ(tab_strip->tab_count(), 1); | |
| 66 | |
| 67 Tab* tab = tab_strip->tab_at(0); | |
| 68 tab->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); | |
| 69 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "*, tab * of *")); | |
| 70 } | |
| 71 | |
| 72 } // namespace chromeos | |
| OLD | NEW |