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

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

Issue 1060913004: Revert of Split spoken feedback up on a per format rule basis. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js » ('j') | 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/accelerators/accelerator_controller.h" 7 #include "ash/accelerators/accelerator_controller.h"
8 #include "ash/accelerators/accelerator_table.h" 8 #include "ash/accelerators/accelerator_table.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/system/tray/system_tray.h" 10 #include "ash/system/tray/system_tray.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 ::testing::Values(kTestAsNormalUser, 256 ::testing::Values(kTestAsNormalUser,
257 kTestAsGuestUser)); 257 kTestAsGuestUser));
258 258
259 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, EnableSpokenFeedback) { 259 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, EnableSpokenFeedback) {
260 EnableChromeVox(); 260 EnableChromeVox();
261 } 261 }
262 262
263 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) { 263 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) {
264 EnableChromeVox(); 264 EnableChromeVox();
265 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); 265 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR);
266 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "about:blank*")); 266 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(),
267 EXPECT_EQ("main", speech_monitor_.GetNextUtterance()); 267 "about:blank*Tool bar Reload Button"));
268 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance());
269 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance());
270 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance());
271 } 268 }
272 269
273 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) { 270 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) {
274 EnableChromeVox(); 271 EnableChromeVox();
275 272
276 chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION); 273 chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION);
277 EXPECT_TRUE( 274 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*Edit text*"));
278 MatchPattern(speech_monitor_.GetNextUtterance(), "*about:blank*"));
279 EXPECT_EQ("main", speech_monitor_.GetNextUtterance());
280 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance());
281 EXPECT_EQ("Address and search bar", speech_monitor_.GetNextUtterance());
282 EXPECT_EQ("about:blank", speech_monitor_.GetNextUtterance());
283 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance());
284 275
285 SendKeyPress(ui::VKEY_X); 276 SendKeyPress(ui::VKEY_X);
286 EXPECT_EQ("x", speech_monitor_.GetNextUtterance()); 277 EXPECT_EQ("x", speech_monitor_.GetNextUtterance());
287 278
288 SendKeyPress(ui::VKEY_Y); 279 SendKeyPress(ui::VKEY_Y);
289 EXPECT_EQ("y", speech_monitor_.GetNextUtterance()); 280 EXPECT_EQ("y", speech_monitor_.GetNextUtterance());
290 281
291 SendKeyPress(ui::VKEY_Z); 282 SendKeyPress(ui::VKEY_Z);
292 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); 283 EXPECT_EQ("z", speech_monitor_.GetNextUtterance());
293 284
294 SendKeyPress(ui::VKEY_BACK); 285 SendKeyPress(ui::VKEY_BACK);
295 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); 286 EXPECT_EQ("z", speech_monitor_.GetNextUtterance());
296 } 287 }
297 288
298 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusShelf) { 289 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusShelf) {
299 EnableChromeVox(); 290 EnableChromeVox();
300 291
301 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); 292 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF));
302 EXPECT_EQ("Shelf", speech_monitor_.GetNextUtterance()); 293 const char* expected = app_list::switches::IsExperimentalAppListEnabled()
303 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance()); 294 ? "Shelf Tool bar Launcher Button"
304 if (app_list::switches::IsExperimentalAppListEnabled()) 295 : "Shelf Tool bar Apps Button";
305 EXPECT_EQ("Launcher", speech_monitor_.GetNextUtterance()); 296 EXPECT_EQ(expected, speech_monitor_.GetNextUtterance());
306 else
307 EXPECT_EQ("Apps", speech_monitor_.GetNextUtterance());
308 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance());
309 297
310 SendKeyPress(ui::VKEY_TAB); 298 SendKeyPress(ui::VKEY_TAB);
311 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*")); 299 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "* Button"));
312 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Button"));
313 } 300 }
314 301
315 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateAppLauncher) { 302 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateAppLauncher) {
316 EnableChromeVox(); 303 EnableChromeVox();
317 304
318 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); 305 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF));
319 while (true) { 306 while (true) {
320 std::string utterance = speech_monitor_.GetNextUtterance(); 307 std::string utterance = speech_monitor_.GetNextUtterance();
321 if (MatchPattern(utterance, "Button")) 308 if (MatchPattern(utterance, "*Button"))
322 break; 309 break;
323 } 310 }
324 311
325 SendKeyPress(ui::VKEY_RETURN); 312 SendKeyPress(ui::VKEY_RETURN);
326 313
327 EXPECT_EQ("Search or type U R L", speech_monitor_.GetNextUtterance()); 314 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(),
328 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance()); 315 "Search or type U R L Edit text"));
329 316
330 SendKeyPress(ui::VKEY_DOWN); 317 SendKeyPress(ui::VKEY_DOWN);
331 EXPECT_EQ("Dialog", speech_monitor_.GetNextUtterance()); 318 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "* Button"));
332 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*"));
333 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance());
334 } 319 }
335 320
336 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OpenStatusTray) { 321 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OpenStatusTray) {
337 EnableChromeVox(); 322 EnableChromeVox();
338 323
339 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE)); 324 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE));
340 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Status tray*")); 325 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Status tray*"));
341 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "time *")); 326 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "time *"));
342 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), 327 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(),
343 "Battery is*full.")); 328 "Battery is*full."));
344 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*")); 329 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*Button"));
345 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Button"));
346 } 330 }
347 331
348 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateSystemTray) { 332 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateSystemTray) {
349 EnableChromeVox(); 333 EnableChromeVox();
350 334
351 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE)); 335 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE));
352 while (true) { 336 while (true) {
353 std::string utterance = speech_monitor_.GetNextUtterance(); 337 std::string utterance = speech_monitor_.GetNextUtterance();
354 if (MatchPattern(utterance, "Button")) 338 if (MatchPattern(utterance, "* Button"))
355 break; 339 break;
356 } 340 }
357 341
358 // Navigate to Bluetooth sub-menu and open it. 342 // Navigate to Bluetooth sub-menu and open it.
359 while (true) { 343 while (true) {
360 SendKeyPress(ui::VKEY_TAB); 344 SendKeyPress(ui::VKEY_TAB);
361 std::string content = speech_monitor_.GetNextUtterance(); 345 std::string utterance = speech_monitor_.GetNextUtterance();
362 std::string role = speech_monitor_.GetNextUtterance(); 346 if (MatchPattern(utterance, "*Bluetooth* Button"))
363 if (MatchPattern(content, "*Bluetooth*") && MatchPattern(role, "Button"))
364 break; 347 break;
365 } 348 }
366 SendKeyPress(ui::VKEY_RETURN); 349 SendKeyPress(ui::VKEY_RETURN);
367 350
368 // Navigate to return to previous menu button and press it. 351 // Navigate to return to previous menu button and press it.
369 while (true) { 352 while (true) {
370 SendKeyPress(ui::VKEY_TAB); 353 SendKeyPress(ui::VKEY_TAB);
371 std::string utterance = speech_monitor_.GetNextUtterance(); 354 std::string utterance = speech_monitor_.GetNextUtterance();
372 if (MatchPattern(utterance, "Previous menu")) 355 if (MatchPattern(utterance, "Previous menu Button"))
373 break; 356 break;
374 } 357 }
375 SendKeyPress(ui::VKEY_RETURN); 358 SendKeyPress(ui::VKEY_RETURN);
376 359 EXPECT_TRUE(
377 while (true) { 360 MatchPattern(speech_monitor_.GetNextUtterance(), "*Bluetooth* Button"));
378 std::string utterance = speech_monitor_.GetNextUtterance();
379 if (MatchPattern(speech_monitor_.GetNextUtterance(), "Button"))
380 break;
381 }
382 } 361 }
383 362
384 // See http://crbug.com/443608 363 // See http://crbug.com/443608
385 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_ScreenBrightness) { 364 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_ScreenBrightness) {
386 EnableChromeVox(); 365 EnableChromeVox();
387 366
388 EXPECT_TRUE(PerformAcceleratorAction(ash::BRIGHTNESS_UP)); 367 EXPECT_TRUE(PerformAcceleratorAction(ash::BRIGHTNESS_UP));
389 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), 368 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(),
390 "Brightness * percent")); 369 "Brightness * percent"));
391 370
392 EXPECT_TRUE(PerformAcceleratorAction(ash::BRIGHTNESS_DOWN)); 371 EXPECT_TRUE(PerformAcceleratorAction(ash::BRIGHTNESS_DOWN));
393 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), 372 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(),
394 "Brightness * percent")); 373 "Brightness * percent"));
395 } 374 }
396 375
397 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, VolumeSlider) { 376 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, VolumeSlider) {
398 EnableChromeVox(); 377 EnableChromeVox();
399 378
400 EXPECT_TRUE(PerformAcceleratorAction(ash::VOLUME_UP)); 379 EXPECT_TRUE(PerformAcceleratorAction(ash::VOLUME_UP));
401 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "* percent*")); 380 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "* percent*"));
402 EXPECT_EQ("Volume,", speech_monitor_.GetNextUtterance()); 381 EXPECT_EQ("Volume,", speech_monitor_.GetNextUtterance());
403 EXPECT_EQ("slider", speech_monitor_.GetNextUtterance()); 382 EXPECT_EQ("slider", speech_monitor_.GetNextUtterance());
404 } 383 }
405 384
406 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OverviewMode) { 385 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OverviewMode) {
407 EnableChromeVox(); 386 EnableChromeVox();
408 387
409 EXPECT_TRUE(PerformAcceleratorAction(ash::TOGGLE_OVERVIEW)); 388 EXPECT_TRUE(PerformAcceleratorAction(ash::TOGGLE_OVERVIEW));
410 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance()); 389 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance());
411 EXPECT_EQ("Alert", speech_monitor_.GetNextUtterance()); 390 EXPECT_EQ("Alert Entered window overview mode",
412 EXPECT_EQ("Entered window overview mode", speech_monitor_.GetNextUtterance()); 391 speech_monitor_.GetNextUtterance());
413 392
414 SendKeyPress(ui::VKEY_TAB); 393 SendKeyPress(ui::VKEY_TAB);
415 EXPECT_EQ("about:blank", speech_monitor_.GetNextUtterance()); 394 EXPECT_EQ("about:blank Button", speech_monitor_.GetNextUtterance());
416 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance());
417 } 395 }
418 396
419 #if defined(MEMORY_SANITIZER) 397 #if defined(MEMORY_SANITIZER)
420 // Fails under MemorySanitizer: http://crbug.com/472125 398 // Fails under MemorySanitizer: http://crbug.com/472125
421 #define MAYBE_ChromeVoxShiftSearch DISABLED_ChromeVoxShiftSearch 399 #define MAYBE_ChromeVoxShiftSearch DISABLED_ChromeVoxShiftSearch
422 #else 400 #else
423 #define MAYBE_ChromeVoxShiftSearch ChromeVoxShiftSearch 401 #define MAYBE_ChromeVoxShiftSearch ChromeVoxShiftSearch
424 #endif 402 #endif
425 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxShiftSearch) { 403 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxShiftSearch) {
426 LoadChromeVoxAndThenNavigateToURL( 404 LoadChromeVoxAndThenNavigateToURL(
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 552
575 private: 553 private:
576 DISALLOW_COPY_AND_ASSIGN(GuestSpokenFeedbackTest); 554 DISALLOW_COPY_AND_ASSIGN(GuestSpokenFeedbackTest);
577 }; 555 };
578 556
579 IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) { 557 IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) {
580 EnableChromeVox(); 558 EnableChromeVox();
581 559
582 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); 560 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR);
583 561
584 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "about:blank*")); 562 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(),
585 EXPECT_EQ("main", speech_monitor_.GetNextUtterance()); 563 "about:blank*Tool bar Reload Button"));
586 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance());
587 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance());
588 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance());
589 } 564 }
590 565
591 // 566 //
592 // Spoken feedback tests of the out-of-box experience. 567 // Spoken feedback tests of the out-of-box experience.
593 // 568 //
594 569
595 class OobeSpokenFeedbackTest : public LoginManagerTest { 570 class OobeSpokenFeedbackTest : public LoginManagerTest {
596 protected: 571 protected:
597 OobeSpokenFeedbackTest() : LoginManagerTest(false) {} 572 OobeSpokenFeedbackTest() : LoginManagerTest(false) {}
598 ~OobeSpokenFeedbackTest() override {} 573 ~OobeSpokenFeedbackTest() override {}
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( 616 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
642 window, ui::VKEY_TAB, false, true /*shift*/, false, false)); 617 window, ui::VKEY_TAB, false, true /*shift*/, false, false));
643 while (speech_monitor_.GetNextUtterance() != "Select your language:") { 618 while (speech_monitor_.GetNextUtterance() != "Select your language:") {
644 } 619 }
645 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); 620 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance());
646 EXPECT_TRUE( 621 EXPECT_TRUE(
647 MatchPattern(speech_monitor_.GetNextUtterance(), "Combo box * of *")); 622 MatchPattern(speech_monitor_.GetNextUtterance(), "Combo box * of *"));
648 } 623 }
649 624
650 } // namespace chromeos 625 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698