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

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

Issue 682943002: Make chrome/browser/chromeos/accessibility compile on Athena with use_ash=0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@athena_do_not_use_ash41_scroll_end_effect
Patch Set: Created 6 years, 1 month 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
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 "ash/system/tray/system_tray.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 GURL("data:text/html;charset=utf-8," 118 GURL("data:text/html;charset=utf-8,"
119 "<script>" 119 "<script>"
120 "window.setInterval(function() {" 120 "window.setInterval(function() {"
121 " try {" 121 " try {"
122 " cvox.Api.speak('ready');" 122 " cvox.Api.speak('ready');"
123 " } catch (e) {}" 123 " } catch (e) {}"
124 "}, 100);" 124 "}, 100);"
125 "</script>")); 125 "</script>"));
126 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 126 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
127 AccessibilityManager::Get()->EnableSpokenFeedback( 127 AccessibilityManager::Get()->EnableSpokenFeedback(
128 true, ash::A11Y_NOTIFICATION_NONE); 128 true, ui::A11Y_NOTIFICATION_NONE);
129 129
130 // Block until we get "ready". 130 // Block until we get "ready".
131 while (speech_monitor_.GetNextUtterance() != "ready") { 131 while (speech_monitor_.GetNextUtterance() != "ready") {
132 } 132 }
133 133
134 // Now load the requested url. 134 // Now load the requested url.
135 ui_test_utils::NavigateToURL(browser(), url); 135 ui_test_utils::NavigateToURL(browser(), url);
136 } 136 }
137 137
138 void PressRepeatedlyUntilUtterance(ui::KeyboardCode key, 138 void PressRepeatedlyUntilUtterance(ui::KeyboardCode key,
(...skipping 15 matching lines...) Expand all
154 154
155 private: 155 private:
156 StubBrailleController braille_controller_; 156 StubBrailleController braille_controller_;
157 DISALLOW_COPY_AND_ASSIGN(LoggedInSpokenFeedbackTest); 157 DISALLOW_COPY_AND_ASSIGN(LoggedInSpokenFeedbackTest);
158 }; 158 };
159 159
160 IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest, AddBookmark) { 160 IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest, AddBookmark) {
161 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 161 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
162 162
163 AccessibilityManager::Get()->EnableSpokenFeedback( 163 AccessibilityManager::Get()->EnableSpokenFeedback(
164 true, ash::A11Y_NOTIFICATION_NONE); 164 true, ui::A11Y_NOTIFICATION_NONE);
165 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); 165 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage());
166 DisableEarcons(); 166 DisableEarcons();
167 167
168 chrome::ExecuteCommand(browser(), IDC_SHOW_BOOKMARK_BAR); 168 chrome::ExecuteCommand(browser(), IDC_SHOW_BOOKMARK_BAR);
169 169
170 // Create a bookmark with title "foo". 170 // Create a bookmark with title "foo".
171 chrome::ExecuteCommand(browser(), IDC_BOOKMARK_PAGE); 171 chrome::ExecuteCommand(browser(), IDC_BOOKMARK_PAGE);
172 EXPECT_EQ("Bookmark added!,", speech_monitor_.GetNextUtterance()); 172 EXPECT_EQ("Bookmark added!,", speech_monitor_.GetNextUtterance());
173 EXPECT_EQ("about blank,", speech_monitor_.GetNextUtterance()); 173 EXPECT_EQ("about blank,", speech_monitor_.GetNextUtterance());
174 EXPECT_EQ("Bookmark name,", speech_monitor_.GetNextUtterance()); 174 EXPECT_EQ("Bookmark name,", speech_monitor_.GetNextUtterance());
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 INSTANTIATE_TEST_CASE_P( 238 INSTANTIATE_TEST_CASE_P(
239 TestAsNormalAndGuestUser, 239 TestAsNormalAndGuestUser,
240 SpokenFeedbackTest, 240 SpokenFeedbackTest,
241 ::testing::Values(kTestAsNormalUser, 241 ::testing::Values(kTestAsNormalUser,
242 kTestAsGuestUser)); 242 kTestAsGuestUser));
243 243
244 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, EnableSpokenFeedback) { 244 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, EnableSpokenFeedback) {
245 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 245 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
246 246
247 AccessibilityManager::Get()->EnableSpokenFeedback( 247 AccessibilityManager::Get()->EnableSpokenFeedback(
248 true, ash::A11Y_NOTIFICATION_NONE); 248 true, ui::A11Y_NOTIFICATION_NONE);
249 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); 249 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage());
250 } 250 }
251 251
252 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) { 252 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) {
253 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 253 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
254 254
255 AccessibilityManager::Get()->EnableSpokenFeedback( 255 AccessibilityManager::Get()->EnableSpokenFeedback(
256 true, ash::A11Y_NOTIFICATION_NONE); 256 true, ui::A11Y_NOTIFICATION_NONE);
257 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); 257 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage());
258 DisableEarcons(); 258 DisableEarcons();
259 259
260 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); 260 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR);
261 // Might be "Google Chrome Toolbar" or "Chromium Toolbar". 261 // Might be "Google Chrome Toolbar" or "Chromium Toolbar".
262 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*oolbar*")); 262 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*oolbar*"));
263 EXPECT_EQ("Reload,", speech_monitor_.GetNextUtterance()); 263 EXPECT_EQ("Reload,", speech_monitor_.GetNextUtterance());
264 EXPECT_EQ("button", speech_monitor_.GetNextUtterance()); 264 EXPECT_EQ("button", speech_monitor_.GetNextUtterance());
265 } 265 }
266 266
267 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) { 267 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) {
268 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 268 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
269 269
270 AccessibilityManager::Get()->EnableSpokenFeedback( 270 AccessibilityManager::Get()->EnableSpokenFeedback(
271 true, ash::A11Y_NOTIFICATION_NONE); 271 true, ui::A11Y_NOTIFICATION_NONE);
272 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); 272 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage());
273 DisableEarcons(); 273 DisableEarcons();
274 274
275 // Wait for ChromeVox to finish speaking. 275 // Wait for ChromeVox to finish speaking.
276 chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION); 276 chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION);
277 while (true) { 277 while (true) {
278 std::string utterance = speech_monitor_.GetNextUtterance(); 278 std::string utterance = speech_monitor_.GetNextUtterance();
279 VLOG(0) << "Got utterance: " << utterance; 279 VLOG(0) << "Got utterance: " << utterance;
280 if (utterance == "text box") 280 if (utterance == "text box")
281 break; 281 break;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 397
398 // Press the up arrow to go to the previous element. 398 // Press the up arrow to go to the previous element.
399 SendKeyPress(ui::VKEY_UP); 399 SendKeyPress(ui::VKEY_UP);
400 EXPECT_EQ("One", speech_monitor_.GetNextUtterance()); 400 EXPECT_EQ("One", speech_monitor_.GetNextUtterance());
401 } 401 }
402 402
403 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) { 403 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) {
404 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 404 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
405 405
406 AccessibilityManager::Get()->EnableSpokenFeedback( 406 AccessibilityManager::Get()->EnableSpokenFeedback(
407 true, ash::A11Y_NOTIFICATION_NONE); 407 true, ui::A11Y_NOTIFICATION_NONE);
408 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); 408 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage());
409 DisableEarcons(); 409 DisableEarcons();
410 410
411 SimulateTouchScreenInChromeVox(); 411 SimulateTouchScreenInChromeVox();
412 412
413 // Send an accessibility hover event on the system tray, which is 413 // Send an accessibility hover event on the system tray, which is
414 // what we get when you tap it on a touch screen when ChromeVox is on. 414 // what we get when you tap it on a touch screen when ChromeVox is on.
415 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); 415 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray();
416 tray->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); 416 tray->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true);
417 417
(...skipping 21 matching lines...) Expand all
439 } 439 }
440 440
441 private: 441 private:
442 DISALLOW_COPY_AND_ASSIGN(GuestSpokenFeedbackTest); 442 DISALLOW_COPY_AND_ASSIGN(GuestSpokenFeedbackTest);
443 }; 443 };
444 444
445 IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) { 445 IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) {
446 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 446 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
447 447
448 AccessibilityManager::Get()->EnableSpokenFeedback( 448 AccessibilityManager::Get()->EnableSpokenFeedback(
449 true, ash::A11Y_NOTIFICATION_NONE); 449 true, ui::A11Y_NOTIFICATION_NONE);
450 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); 450 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage());
451 DisableEarcons(); 451 DisableEarcons();
452 452
453 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); 453 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR);
454 // Might be "Google Chrome Toolbar" or "Chromium Toolbar". 454 // Might be "Google Chrome Toolbar" or "Chromium Toolbar".
455 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*oolbar*")); 455 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*oolbar*"));
456 EXPECT_EQ("Reload,", speech_monitor_.GetNextUtterance()); 456 EXPECT_EQ("Reload,", speech_monitor_.GetNextUtterance());
457 EXPECT_EQ("button", speech_monitor_.GetNextUtterance()); 457 EXPECT_EQ("button", speech_monitor_.GetNextUtterance());
458 } 458 }
459 459
(...skipping 27 matching lines...) Expand all
487 IN_PROC_BROWSER_TEST_F(OobeSpokenFeedbackTest, DISABLED_SpokenFeedbackInOobe) { 487 IN_PROC_BROWSER_TEST_F(OobeSpokenFeedbackTest, DISABLED_SpokenFeedbackInOobe) {
488 ui_controls::EnableUIControls(); 488 ui_controls::EnableUIControls();
489 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 489 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
490 490
491 LoginDisplayHost* login_display_host = LoginDisplayHostImpl::default_host(); 491 LoginDisplayHost* login_display_host = LoginDisplayHostImpl::default_host();
492 WebUILoginView* web_ui_login_view = login_display_host->GetWebUILoginView(); 492 WebUILoginView* web_ui_login_view = login_display_host->GetWebUILoginView();
493 views::Widget* widget = web_ui_login_view->GetWidget(); 493 views::Widget* widget = web_ui_login_view->GetWidget();
494 gfx::NativeWindow window = widget->GetNativeWindow(); 494 gfx::NativeWindow window = widget->GetNativeWindow();
495 495
496 AccessibilityManager::Get()->EnableSpokenFeedback( 496 AccessibilityManager::Get()->EnableSpokenFeedback(
497 true, ash::A11Y_NOTIFICATION_NONE); 497 true, ui::A11Y_NOTIFICATION_NONE);
498 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); 498 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage());
499 499
500 EXPECT_EQ("Select your language:", speech_monitor_.GetNextUtterance()); 500 EXPECT_EQ("Select your language:", speech_monitor_.GetNextUtterance());
501 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); 501 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance());
502 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), 502 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(),
503 "Combo box * of *")); 503 "Combo box * of *"));
504 ASSERT_TRUE( 504 ASSERT_TRUE(
505 ui_test_utils::SendKeyPressToWindowSync( 505 ui_test_utils::SendKeyPressToWindowSync(
506 window, ui::VKEY_TAB, false, false, false, false)); 506 window, ui::VKEY_TAB, false, false, false, false));
507 EXPECT_EQ("Select your keyboard:", speech_monitor_.GetNextUtterance()); 507 EXPECT_EQ("Select your keyboard:", speech_monitor_.GetNextUtterance());
508 } 508 }
509 509
510 } // namespace chromeos 510 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698