Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc

Issue 422583002: Test that simulates touch exploration on the system tray and checks speech. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove printfs Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <queue> 5 #include <queue>
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/tray/system_tray.h"
8 #include "base/command_line.h" 9 #include "base/command_line.h"
9 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
10 #include "chrome/app/chrome_command_ids.h" 11 #include "chrome/app/chrome_command_ids.h"
11 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 12 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
12 #include "chrome/browser/chromeos/accessibility/speech_monitor.h" 13 #include "chrome/browser/chromeos/accessibility/speech_monitor.h"
13 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 14 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
14 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" 15 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
15 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" 16 #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
16 #include "chrome/browser/chromeos/profiles/profile_helper.h" 17 #include "chrome/browser/chromeos/profiles/profile_helper.h"
17 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con troller.h" 18 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con troller.h"
18 #include "chrome/browser/speech/tts_controller.h" 19 #include "chrome/browser/speech/tts_controller.h"
19 #include "chrome/browser/speech/tts_platform.h" 20 #include "chrome/browser/speech/tts_platform.h"
20 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/browser_commands.h" 22 #include "chrome/browser/ui/browser_commands.h"
22 #include "chrome/browser/ui/browser_window.h" 23 #include "chrome/browser/ui/browser_window.h"
23 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
25 #include "chrome/common/extensions/extension_constants.h"
24 #include "chrome/test/base/in_process_browser_test.h" 26 #include "chrome/test/base/in_process_browser_test.h"
25 #include "chrome/test/base/interactive_test_utils.h" 27 #include "chrome/test/base/interactive_test_utils.h"
26 #include "chrome/test/base/testing_profile.h" 28 #include "chrome/test/base/testing_profile.h"
27 #include "chrome/test/base/ui_test_utils.h" 29 #include "chrome/test/base/ui_test_utils.h"
28 #include "chromeos/chromeos_switches.h" 30 #include "chromeos/chromeos_switches.h"
29 #include "chromeos/login/user_names.h" 31 #include "chromeos/login/user_names.h"
30 #include "content/public/common/url_constants.h" 32 #include "content/public/common/url_constants.h"
33 #include "content/public/test/browser_test_utils.h"
31 #include "content/public/test/test_utils.h" 34 #include "content/public/test/test_utils.h"
35 #include "extensions/browser/extension_host.h"
36 #include "extensions/browser/process_manager.h"
32 #include "testing/gtest/include/gtest/gtest.h" 37 #include "testing/gtest/include/gtest/gtest.h"
33 #include "ui/base/test/ui_controls.h" 38 #include "ui/base/test/ui_controls.h"
34 #include "ui/views/widget/widget.h" 39 #include "ui/views/widget/widget.h"
35 40
36 using extensions::api::braille_display_private::StubBrailleController; 41 using extensions::api::braille_display_private::StubBrailleController;
37 42
38 namespace chromeos { 43 namespace chromeos {
39 44
40 // 45 //
41 // Spoken feedback tests only in a logged in user's window. 46 // Spoken feedback tests only in a logged in user's window.
(...skipping 13 matching lines...) Expand all
55 } 60 }
56 61
57 void SendKeyPress(ui::KeyboardCode key) { 62 void SendKeyPress(ui::KeyboardCode key) {
58 gfx::NativeWindow root_window = 63 gfx::NativeWindow root_window =
59 ash::Shell::GetInstance()->GetPrimaryRootWindow(); 64 ash::Shell::GetInstance()->GetPrimaryRootWindow();
60 ASSERT_TRUE( 65 ASSERT_TRUE(
61 ui_test_utils::SendKeyPressToWindowSync( 66 ui_test_utils::SendKeyPressToWindowSync(
62 root_window, key, false, false, false, false)); 67 root_window, key, false, false, false, false));
63 } 68 }
64 69
70 void SimulateTouchScreenInChromeVox() {
71 // ChromeVox looks at whether 'ontouchstart' exists to know whether
72 // or not it should respond to hover events. Fake it so that touch
73 // exploration events get spoken.
74 extensions::ExtensionHost* host =
75 extensions::ExtensionSystem::Get(browser()->profile())->
76 process_manager()->GetBackgroundHostForExtension(
77 extension_misc::kChromeVoxExtensionId);
78 CHECK(content::ExecuteScript(
79 host->host_contents(),
80 "window.ontouchstart = function() {};"));
81 }
82
65 private: 83 private:
66 StubBrailleController braille_controller_; 84 StubBrailleController braille_controller_;
67 DISALLOW_COPY_AND_ASSIGN(LoggedInSpokenFeedbackTest); 85 DISALLOW_COPY_AND_ASSIGN(LoggedInSpokenFeedbackTest);
68 }; 86 };
69 87
70 // http://crbug.com/396507 88 // http://crbug.com/396507
71 IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest, DISABLED_AddBookmark) { 89 IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest, DISABLED_AddBookmark) {
72 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 90 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
73 91
74 SpeechMonitor monitor; 92 SpeechMonitor monitor;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 SendKeyPress(ui::VKEY_Y); 217 SendKeyPress(ui::VKEY_Y);
200 EXPECT_EQ("y", monitor.GetNextUtterance()); 218 EXPECT_EQ("y", monitor.GetNextUtterance());
201 219
202 SendKeyPress(ui::VKEY_Z); 220 SendKeyPress(ui::VKEY_Z);
203 EXPECT_EQ("z", monitor.GetNextUtterance()); 221 EXPECT_EQ("z", monitor.GetNextUtterance());
204 222
205 SendKeyPress(ui::VKEY_BACK); 223 SendKeyPress(ui::VKEY_BACK);
206 EXPECT_EQ("z", monitor.GetNextUtterance()); 224 EXPECT_EQ("z", monitor.GetNextUtterance());
207 } 225 }
208 226
227 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) {
228 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
229
230 SpeechMonitor monitor;
231 AccessibilityManager::Get()->EnableSpokenFeedback(
232 true, ash::A11Y_NOTIFICATION_NONE);
233 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage());
234
235 SimulateTouchScreenInChromeVox();
236
237 // Send an accessibility hover event on the system tray, which is
238 // what we get when you tap it on a touch screen when ChromeVox is on.
239 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray();
240 tray->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true);
241
242 EXPECT_EQ("Status tray,", monitor.GetNextUtterance());
243 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "time*,"));
244 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Battery*,"));
245 EXPECT_EQ("button", monitor.GetNextUtterance());
246 }
247
209 // 248 //
210 // Spoken feedback tests that run only in guest mode. 249 // Spoken feedback tests that run only in guest mode.
211 // 250 //
212 251
213 class GuestSpokenFeedbackTest : public LoggedInSpokenFeedbackTest { 252 class GuestSpokenFeedbackTest : public LoggedInSpokenFeedbackTest {
214 protected: 253 protected:
215 GuestSpokenFeedbackTest() {} 254 GuestSpokenFeedbackTest() {}
216 virtual ~GuestSpokenFeedbackTest() {} 255 virtual ~GuestSpokenFeedbackTest() {}
217 256
218 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 257 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 EXPECT_EQ("Select your language:", monitor.GetNextUtterance()); 323 EXPECT_EQ("Select your language:", monitor.GetNextUtterance());
285 EXPECT_EQ("English ( United States)", monitor.GetNextUtterance()); 324 EXPECT_EQ("English ( United States)", monitor.GetNextUtterance());
286 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Combo box * of *")); 325 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "Combo box * of *"));
287 ASSERT_TRUE( 326 ASSERT_TRUE(
288 ui_test_utils::SendKeyPressToWindowSync( 327 ui_test_utils::SendKeyPressToWindowSync(
289 window, ui::VKEY_TAB, false, false, false, false)); 328 window, ui::VKEY_TAB, false, false, false, false));
290 EXPECT_EQ("Select your keyboard:", monitor.GetNextUtterance()); 329 EXPECT_EQ("Select your keyboard:", monitor.GetNextUtterance());
291 } 330 }
292 331
293 } // namespace chromeos 332 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698