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" | |
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 // 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.
| |
24 // on these views to ensure the correct text is being read. | |
25 | |
26 IN_PROC_BROWSER_TEST_F(SpokenFeedbackViewsTest, | |
27 TouchExploreBookmarkBarInstructions) { | |
28 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); | |
29 SpeechMonitor monitor; | |
30 AccessibilityManager::Get()->EnableSpokenFeedback( | |
31 true, ash::A11Y_NOTIFICATION_NONE); | |
32 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); | |
33 | |
34 accessibility::SimulateTouchScreenInChromeVoxForTest(browser()->profile()); | |
35 | |
36 // Send an accessibility hover event on the empty bookmarks bar, which is | |
37 // what we get when you tap it on a touch screen when ChromeVox is on. | |
38 BrowserView* browser_view = | |
39 static_cast<BrowserView*>(browser()->window()); | |
40 BookmarkBarView* bookmarks_bar = browser_view->GetBookmarkBarView(); | |
41 views::View* instructions = bookmarks_bar->GetBookmarkBarInstructionsView(); | |
42 instructions->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); | |
43 | |
44 EXPECT_EQ("Bookmarks,", monitor.GetNextUtterance()); | |
45 EXPECT_EQ("For quick access,", monitor.GetNextUtterance()); | |
46 EXPECT_EQ("place your bookmarks here on the bookmarks bar.", | |
47 monitor.GetNextUtterance()); | |
48 } | |
49 | |
50 IN_PROC_BROWSER_TEST_F(SpokenFeedbackViewsTest, TouchExploreTabs) { | |
51 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.
| |
52 SpeechMonitor monitor; | |
53 AccessibilityManager::Get()->EnableSpokenFeedback( | |
54 true, ash::A11Y_NOTIFICATION_NONE); | |
55 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage()); | |
56 | |
57 accessibility::SimulateTouchScreenInChromeVoxForTest(browser()->profile()); | |
58 | |
59 // Send an accessibility hover event on a tab in the tap strip, which is | |
60 // what we get when you tap it on a touch screen when ChromeVox is on. | |
61 BrowserView* browser_view = | |
62 static_cast<BrowserView*>(browser()->window()); | |
63 TabStrip* tab_strip = browser_view->tabstrip(); | |
64 ASSERT_EQ(tab_strip->tab_count(), 1); | |
65 | |
66 Tab* tab = tab_strip->tab_at(0); | |
67 tab->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); | |
68 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "*, tab * of *")); | |
69 } | |
70 | |
71 } // namespace chromeos | |
OLD | NEW |