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