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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); | 290 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); |
291 | 291 |
292 SendKeyPress(ui::VKEY_BACK); | 292 SendKeyPress(ui::VKEY_BACK); |
293 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); | 293 EXPECT_EQ("z", speech_monitor_.GetNextUtterance()); |
294 } | 294 } |
295 | 295 |
296 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusShelf) { | 296 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusShelf) { |
297 EnableChromeVox(); | 297 EnableChromeVox(); |
298 | 298 |
299 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); | 299 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); |
300 | |
301 EXPECT_EQ("Shelf,", speech_monitor_.GetNextUtterance()); | 300 EXPECT_EQ("Shelf,", speech_monitor_.GetNextUtterance()); |
302 EXPECT_EQ("Apps,", speech_monitor_.GetNextUtterance()); | 301 EXPECT_EQ("Apps,", speech_monitor_.GetNextUtterance()); |
303 EXPECT_EQ("button", speech_monitor_.GetNextUtterance()); | 302 EXPECT_EQ("button", speech_monitor_.GetNextUtterance()); |
| 303 |
| 304 SendKeyPress(ui::VKEY_TAB); |
| 305 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*, button")); |
| 306 } |
| 307 |
| 308 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateAppLauncher) { |
| 309 EnableChromeVox(); |
| 310 |
| 311 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); |
| 312 while (true) { |
| 313 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 314 if (utterance == "button") |
| 315 break; |
| 316 } |
| 317 |
| 318 SendKeyPress(ui::VKEY_RETURN); |
| 319 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Chrom*,")); |
| 320 EXPECT_EQ("text box", speech_monitor_.GetNextUtterance()); |
| 321 |
| 322 SendKeyPress(ui::VKEY_DOWN); |
| 323 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*, button")); |
| 324 } |
| 325 |
| 326 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OpenStatusTray) { |
| 327 EnableChromeVox(); |
| 328 |
| 329 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE)); |
| 330 EXPECT_EQ("Status tray,", speech_monitor_.GetNextUtterance()); |
| 331 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "time *")); |
| 332 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), |
| 333 "Battery is*full.")); |
| 334 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*, button")); |
| 335 } |
| 336 |
| 337 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateSystemTray) { |
| 338 EnableChromeVox(); |
| 339 |
| 340 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE)); |
| 341 while (true) { |
| 342 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 343 if (MatchPattern(utterance, "*, button")) |
| 344 break; |
| 345 } |
| 346 |
| 347 // Navigate to Bluetooth sub-menu and open it. |
| 348 while (true) { |
| 349 SendKeyPress(ui::VKEY_TAB); |
| 350 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 351 if (MatchPattern(utterance, "*Bluetooth*, button")) |
| 352 break; |
| 353 } |
| 354 SendKeyPress(ui::VKEY_RETURN); |
| 355 |
| 356 // Navigate to return to previous menu button and press it. |
| 357 while (true) { |
| 358 SendKeyPress(ui::VKEY_TAB); |
| 359 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 360 if (MatchPattern(utterance, "Previous menu, button")) |
| 361 break; |
| 362 } |
| 363 SendKeyPress(ui::VKEY_RETURN); |
| 364 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), |
| 365 "*Bluetooth*, button")); |
| 366 } |
| 367 |
| 368 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ScreenBrightness) { |
| 369 EnableChromeVox(); |
| 370 |
| 371 EXPECT_TRUE(PerformAcceleratorAction(ash::BRIGHTNESS_UP)); |
| 372 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), |
| 373 "Brightness * percent")); |
| 374 |
| 375 EXPECT_TRUE(PerformAcceleratorAction(ash::BRIGHTNESS_DOWN)); |
| 376 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), |
| 377 "Brightness * percent")); |
| 378 } |
| 379 |
| 380 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, VolumeSlider) { |
| 381 EnableChromeVox(); |
| 382 |
| 383 EXPECT_TRUE(PerformAcceleratorAction(ash::VOLUME_UP)); |
| 384 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*%,")); |
| 385 EXPECT_EQ("Volume,", speech_monitor_.GetNextUtterance()); |
| 386 EXPECT_EQ("slider", speech_monitor_.GetNextUtterance()); |
| 387 } |
| 388 |
| 389 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OverviewMode) { |
| 390 EnableChromeVox(); |
| 391 |
| 392 EXPECT_TRUE(PerformAcceleratorAction(ash::TOGGLE_OVERVIEW)); |
| 393 EXPECT_EQ("Alert Entered window overview mode", |
| 394 speech_monitor_.GetNextUtterance()); |
| 395 EXPECT_EQ(", text box", speech_monitor_.GetNextUtterance()); |
| 396 |
| 397 SendKeyPress(ui::VKEY_TAB); |
| 398 EXPECT_EQ("about blank, button", speech_monitor_.GetNextUtterance()); |
304 } | 399 } |
305 | 400 |
306 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxShiftSearch) { | 401 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxShiftSearch) { |
307 LoadChromeVoxAndThenNavigateToURL( | 402 LoadChromeVoxAndThenNavigateToURL( |
308 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>")); | 403 GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>")); |
309 while (true) { | 404 while (true) { |
310 std::string utterance = speech_monitor_.GetNextUtterance(); | 405 std::string utterance = speech_monitor_.GetNextUtterance(); |
311 if (utterance == "Click me") | 406 if (utterance == "Click me") |
312 break; | 407 break; |
313 } | 408 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); | 594 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); |
500 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), | 595 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), |
501 "Combo box * of *")); | 596 "Combo box * of *")); |
502 ASSERT_TRUE( | 597 ASSERT_TRUE( |
503 ui_test_utils::SendKeyPressToWindowSync( | 598 ui_test_utils::SendKeyPressToWindowSync( |
504 window, ui::VKEY_TAB, false, false, false, false)); | 599 window, ui::VKEY_TAB, false, false, false, false)); |
505 EXPECT_EQ("Select your keyboard:", speech_monitor_.GetNextUtterance()); | 600 EXPECT_EQ("Select your keyboard:", speech_monitor_.GetNextUtterance()); |
506 } | 601 } |
507 | 602 |
508 } // namespace chromeos | 603 } // namespace chromeos |
OLD | NEW |