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

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

Issue 261013009: Add test of ChromeVox in guest mode so we can't accidentally break it again. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
11 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 11 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
12 #include "chrome/browser/chromeos/accessibility/speech_monitor.h" 12 #include "chrome/browser/chromeos/accessibility/speech_monitor.h"
13 #include "chrome/browser/chromeos/login/login_display_host.h" 13 #include "chrome/browser/chromeos/login/login_display_host.h"
14 #include "chrome/browser/chromeos/login/login_display_host_impl.h" 14 #include "chrome/browser/chromeos/login/login_display_host_impl.h"
15 #include "chrome/browser/chromeos/login/user_manager.h" 15 #include "chrome/browser/chromeos/login/user_manager.h"
16 #include "chrome/browser/chromeos/login/webui_login_view.h" 16 #include "chrome/browser/chromeos/login/webui_login_view.h"
17 #include "chrome/browser/chromeos/profiles/profile_helper.h" 17 #include "chrome/browser/chromeos/profiles/profile_helper.h"
18 #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"
19 #include "chrome/browser/speech/tts_controller.h" 19 #include "chrome/browser/speech/tts_controller.h"
20 #include "chrome/browser/speech/tts_platform.h" 20 #include "chrome/browser/speech/tts_platform.h"
21 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
22 #include "chrome/browser/ui/browser_commands.h" 22 #include "chrome/browser/ui/browser_commands.h"
23 #include "chrome/browser/ui/browser_window.h" 23 #include "chrome/browser/ui/browser_window.h"
24 #include "chrome/common/chrome_switches.h"
24 #include "chrome/test/base/in_process_browser_test.h" 25 #include "chrome/test/base/in_process_browser_test.h"
25 #include "chrome/test/base/testing_profile.h" 26 #include "chrome/test/base/testing_profile.h"
26 #include "chrome/test/base/ui_test_utils.h" 27 #include "chrome/test/base/ui_test_utils.h"
27 #include "chromeos/chromeos_switches.h" 28 #include "chromeos/chromeos_switches.h"
28 #include "content/public/common/url_constants.h" 29 #include "content/public/common/url_constants.h"
29 #include "content/public/test/test_utils.h" 30 #include "content/public/test/test_utils.h"
30 #include "testing/gtest/include/gtest/gtest.h" 31 #include "testing/gtest/include/gtest/gtest.h"
31 #include "ui/base/test/ui_controls.h" 32 #include "ui/base/test/ui_controls.h"
32 #include "ui/views/widget/widget.h" 33 #include "ui/views/widget/widget.h"
33 34
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 EXPECT_EQ("y", monitor.GetNextUtterance()); 105 EXPECT_EQ("y", monitor.GetNextUtterance());
105 106
106 ui_controls::SendKeyPress(window, ui::VKEY_Z, false, false, false, false); 107 ui_controls::SendKeyPress(window, ui::VKEY_Z, false, false, false, false);
107 EXPECT_EQ("z", monitor.GetNextUtterance()); 108 EXPECT_EQ("z", monitor.GetNextUtterance());
108 109
109 ui_controls::SendKeyPress(window, ui::VKEY_BACK, false, false, false, false); 110 ui_controls::SendKeyPress(window, ui::VKEY_BACK, false, false, false, false);
110 EXPECT_EQ("z", monitor.GetNextUtterance()); 111 EXPECT_EQ("z", monitor.GetNextUtterance());
111 } 112 }
112 113
113 // 114 //
115 // Spoken feedback tests that run in guest mode.
116 //
117
118 class GuestSpokenFeedbackTest : public SpokenFeedbackTest {
119 protected:
120 GuestSpokenFeedbackTest() {}
121 virtual ~GuestSpokenFeedbackTest() {}
122
123 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
124 command_line->AppendSwitch(chromeos::switches::kGuestSession);
125 command_line->AppendSwitch(::switches::kIncognito);
126 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user");
127 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser,
128 chromeos::UserManager::kGuestUserName);
129 }
130
131 private:
132 DISALLOW_COPY_AND_ASSIGN(GuestSpokenFeedbackTest);
133 };
134
135 IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) {
Peter Lundblad 2014/05/06 16:40:40 Did you consider parameterizing the test on user s
136 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
137
138 SpeechMonitor monitor;
139 AccessibilityManager::Get()->EnableSpokenFeedback(
140 true, ash::A11Y_NOTIFICATION_NONE);
141 EXPECT_TRUE(monitor.SkipChromeVoxEnabledMessage());
142
143 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR);
144 // Might be "Google Chrome Toolbar" or "Chromium Toolbar".
145 EXPECT_TRUE(MatchPattern(monitor.GetNextUtterance(), "*oolbar*"));
146 EXPECT_EQ("Reload,", monitor.GetNextUtterance());
147 EXPECT_EQ("button", monitor.GetNextUtterance());
148 }
149
150 //
114 // Spoken feedback tests of the out-of-box experience. 151 // Spoken feedback tests of the out-of-box experience.
115 // 152 //
116 153
117 class OobeSpokenFeedbackTest : public InProcessBrowserTest { 154 class OobeSpokenFeedbackTest : public InProcessBrowserTest {
118 protected: 155 protected:
119 OobeSpokenFeedbackTest() {} 156 OobeSpokenFeedbackTest() {}
120 virtual ~OobeSpokenFeedbackTest() {} 157 virtual ~OobeSpokenFeedbackTest() {}
121 158
122 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 159 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
123 command_line->AppendSwitch(chromeos::switches::kLoginManager); 160 command_line->AppendSwitch(chromeos::switches::kLoginManager);
(...skipping 29 matching lines...) Expand all
153 ui_controls::SendKeyPress(window, ui::VKEY_TAB, false, false, false, false); 190 ui_controls::SendKeyPress(window, ui::VKEY_TAB, false, false, false, false);
154 } while (monitor.GetNextUtterance() != "Continue"); 191 } while (monitor.GetNextUtterance() != "Continue");
155 192
156 // If we keep tabbing, we should eventually reach the Shut Down button too. 193 // If we keep tabbing, we should eventually reach the Shut Down button too.
157 do { 194 do {
158 ui_controls::SendKeyPress(window, ui::VKEY_TAB, false, false, false, false); 195 ui_controls::SendKeyPress(window, ui::VKEY_TAB, false, false, false, false);
159 } while (monitor.GetNextUtterance() != "Shut down"); 196 } while (monitor.GetNextUtterance() != "Shut down");
160 } 197 }
161 198
162 } // namespace chromeos 199 } // 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