Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
|
James Cook
2014/08/08 17:06:32
I steered you wrong. This should be spoken_feedbac
evy
2014/08/08 18:37:47
Done.
| |
| 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" | |
| 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 typedef InProcessBrowserTest SpokenFeedbackViewsTest; | |
|
James Cook
2014/08/08 17:06:32
Add a brief comment about why this lives in c/b/ui
evy
2014/08/08 18:37:47
Done.
| |
| 15 | |
| 16 namespace chromeos { | |
| 17 | |
| 18 IN_PROC_BROWSER_TEST_F(SpokenFeedbackViewsTest, | |
|
James Cook
2014/08/08 17:06:32
Add a brief comment explaining what you are testin
evy
2014/08/08 18:37:47
Done.
| |
| 19 TouchExploreBookmarkBarInstructions) { | |
| 20 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | |
|
James Cook
2014/08/08 17:06:32
I would ASSERT_FALSE, as this is a precondition fo
evy
2014/08/08 18:37:47
Done.
| |
| 21 SpeechMonitor monitor; | |
| 22 AccessibilityManager::Get()->EnableSpokenFeedback( | |
| 23 true, ash::A11Y_NOTIFICATION_NONE); | |
| 24 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); | |
| 25 | |
| 26 accessibility::SimulateTouchScreenInChromeVoxForTest(browser()->profile()); | |
| 27 | |
| 28 // Send an accessibility hover event on the empty bookmarks bar, which is | |
| 29 // what we get when you tap it on a touch screen when ChromeVox is on. | |
| 30 BrowserView* browser_view = | |
| 31 static_cast<BrowserView*>(browser()->window()); | |
| 32 BookmarkBarView* bookmarks_bar = browser_view->GetBookmarkBarView(); | |
| 33 views::View* instructions = bookmarks_bar->GetBookmarkBarInstructionsView(); | |
| 34 instructions->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); | |
| 35 | |
| 36 EXPECT_EQ("Bookmarks,", monitor.GetNextUtterance()); | |
| 37 EXPECT_EQ("For quick access,", monitor.GetNextUtterance()); | |
|
aboxhall
2014/08/08 17:16:01
Possibly consider expressing this in terms of inst
evy
2014/08/08 18:37:47
I thought a bit about that, and I'm glad you broug
aboxhall
2014/08/08 20:01:52
I think on balance it'd probably be over-engineeri
evy
2014/08/08 21:00:28
Acknowledged.
| |
| 38 EXPECT_EQ("place your bookmarks here on the bookmarks bar.", | |
| 39 monitor.GetNextUtterance()); | |
| 40 } | |
| 41 | |
| 42 IN_PROC_BROWSER_TEST_F(SpokenFeedbackViewsTest, TouchExploreTabs) { | |
| 43 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | |
| 44 SpeechMonitor monitor; | |
| 45 AccessibilityManager::Get()->EnableSpokenFeedback( | |
| 46 true, ash::A11Y_NOTIFICATION_NONE); | |
| 47 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); | |
| 48 | |
| 49 accessibility::SimulateTouchScreenInChromeVoxForTest(browser()->profile()); | |
| 50 | |
| 51 // Send an accessibility hover event on a tab in the tap strip, which is | |
| 52 // what we get when you tap it on a touch screen when ChromeVox is on. | |
| 53 BrowserView* browser_view = | |
| 54 static_cast<BrowserView*>(browser()->window()); | |
| 55 TabStrip* tab_strip = browser_view->tabstrip(); | |
| 56 ASSERT_EQ(tab_strip->tab_count(), 1); | |
| 57 | |
| 58 Tab* tab = tab_strip->tab_at(0); | |
| 59 tab->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); | |
| 60 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "*, tab * of *")); | |
| 61 } | |
| 62 | |
| 63 } // namespace chromeos | |
| OLD | NEW |