| OLD | NEW |
| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 313 |
| 314 SendKeyPress(ui::VKEY_TAB); | 314 SendKeyPress(ui::VKEY_TAB); |
| 315 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); | 315 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); |
| 316 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); | 316 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); |
| 317 } | 317 } |
| 318 | 318 |
| 319 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateAppLauncher) { | 319 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateAppLauncher) { |
| 320 EnableChromeVox(); | 320 EnableChromeVox(); |
| 321 | 321 |
| 322 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); | 322 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); |
| 323 |
| 324 // Wait for it to say "Launcher", "Button". |
| 325 while (true) { |
| 326 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 327 if (base::MatchPattern(utterance, "Button")) |
| 328 break; |
| 329 } |
| 330 |
| 331 // Click on the launcher, it brings up the app list UI. |
| 332 SendKeyPress(ui::VKEY_RETURN); |
| 333 EXPECT_EQ("Search or type URL", speech_monitor_.GetNextUtterance()); |
| 334 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance()); |
| 335 |
| 336 // Close it and open it again. |
| 337 SendKeyPress(ui::VKEY_ESCAPE); |
| 338 while (true) { |
| 339 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 340 if (base::MatchPattern(utterance, "*window*")) |
| 341 break; |
| 342 } |
| 343 |
| 344 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); |
| 323 while (true) { | 345 while (true) { |
| 324 std::string utterance = speech_monitor_.GetNextUtterance(); | 346 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 325 if (base::MatchPattern(utterance, "Button")) | 347 if (base::MatchPattern(utterance, "Button")) |
| 326 break; | 348 break; |
| 327 } | 349 } |
| 328 | |
| 329 SendKeyPress(ui::VKEY_RETURN); | 350 SendKeyPress(ui::VKEY_RETURN); |
| 330 | 351 |
| 331 EXPECT_EQ("Search or type URL", speech_monitor_.GetNextUtterance()); | 352 // Now type a space into the text field and wait until we hear "space". |
| 332 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance()); | 353 // This makes the test more robust as it allows us to skip over other |
| 354 // speech along the way. |
| 355 SendKeyPress(ui::VKEY_SPACE); |
| 356 while (true) { |
| 357 if ("space" == speech_monitor_.GetNextUtterance()) |
| 358 break; |
| 359 } |
| 333 | 360 |
| 361 // Now press the down arrow and we should be focused on an app button |
| 362 // in a dialog. |
| 334 SendKeyPress(ui::VKEY_DOWN); | 363 SendKeyPress(ui::VKEY_DOWN); |
| 335 EXPECT_EQ("Dialog", speech_monitor_.GetNextUtterance()); | 364 EXPECT_EQ("Dialog", speech_monitor_.GetNextUtterance()); |
| 336 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); | 365 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); |
| 337 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 366 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
| 338 } | 367 } |
| 339 | 368 |
| 340 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OpenStatusTray) { | 369 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OpenStatusTray) { |
| 341 EnableChromeVox(); | 370 EnableChromeVox(); |
| 342 | 371 |
| 343 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE)); | 372 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE)); |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( | 723 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( |
| 695 window, ui::VKEY_TAB, false, true /*shift*/, false, false)); | 724 window, ui::VKEY_TAB, false, true /*shift*/, false, false)); |
| 696 while (speech_monitor_.GetNextUtterance() != "Select your language:") { | 725 while (speech_monitor_.GetNextUtterance() != "Select your language:") { |
| 697 } | 726 } |
| 698 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); | 727 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); |
| 699 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), | 728 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), |
| 700 "Combo box * of *")); | 729 "Combo box * of *")); |
| 701 } | 730 } |
| 702 | 731 |
| 703 } // namespace chromeos | 732 } // namespace chromeos |
| OLD | NEW |