| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/strings/pattern.h" |
| 12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 13 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
| 14 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 15 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 16 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 16 #include "chrome/browser/chromeos/accessibility/speech_monitor.h" | 17 #include "chrome/browser/chromeos/accessibility/speech_monitor.h" |
| 17 #include "chrome/browser/chromeos/login/login_manager_test.h" | 18 #include "chrome/browser/chromeos/login/login_manager_test.h" |
| 18 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 19 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 19 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 20 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 20 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 21 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
| 21 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 22 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 EXPECT_EQ("o", speech_monitor_.GetNextUtterance()); | 197 EXPECT_EQ("o", speech_monitor_.GetNextUtterance()); |
| 197 SendKeyPress(ui::VKEY_O); | 198 SendKeyPress(ui::VKEY_O); |
| 198 EXPECT_EQ("o", speech_monitor_.GetNextUtterance()); | 199 EXPECT_EQ("o", speech_monitor_.GetNextUtterance()); |
| 199 | 200 |
| 200 SendKeyPress(ui::VKEY_TAB); | 201 SendKeyPress(ui::VKEY_TAB); |
| 201 EXPECT_EQ("Bookmark folder combo Box Bookmarks bar", | 202 EXPECT_EQ("Bookmark folder combo Box Bookmarks bar", |
| 202 speech_monitor_.GetNextUtterance()); | 203 speech_monitor_.GetNextUtterance()); |
| 203 | 204 |
| 204 SendKeyPress(ui::VKEY_RETURN); | 205 SendKeyPress(ui::VKEY_RETURN); |
| 205 | 206 |
| 206 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*oolbar*")); | 207 EXPECT_TRUE( |
| 208 base::MatchPattern(speech_monitor_.GetNextUtterance(), "*oolbar*")); |
| 207 // Wait for active window change to be announced to avoid interference from | 209 // Wait for active window change to be announced to avoid interference from |
| 208 // that below. | 210 // that below. |
| 209 while (speech_monitor_.GetNextUtterance() != "window about blank tab") { | 211 while (speech_monitor_.GetNextUtterance() != "window about blank tab") { |
| 210 // Do nothing. | 212 // Do nothing. |
| 211 } | 213 } |
| 212 | 214 |
| 213 // Focus bookmarks bar and listen for "foo". | 215 // Focus bookmarks bar and listen for "foo". |
| 214 chrome::ExecuteCommand(browser(), IDC_FOCUS_BOOKMARKS); | 216 chrome::ExecuteCommand(browser(), IDC_FOCUS_BOOKMARKS); |
| 215 while (true) { | 217 while (true) { |
| 216 std::string utterance = speech_monitor_.GetNextUtterance(); | 218 std::string utterance = speech_monitor_.GetNextUtterance(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 ::testing::Values(kTestAsNormalUser, | 258 ::testing::Values(kTestAsNormalUser, |
| 257 kTestAsGuestUser)); | 259 kTestAsGuestUser)); |
| 258 | 260 |
| 259 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, EnableSpokenFeedback) { | 261 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, EnableSpokenFeedback) { |
| 260 EnableChromeVox(); | 262 EnableChromeVox(); |
| 261 } | 263 } |
| 262 | 264 |
| 263 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) { | 265 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) { |
| 264 EnableChromeVox(); | 266 EnableChromeVox(); |
| 265 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); | 267 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); |
| 266 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "about:blank*")); | 268 EXPECT_TRUE( |
| 269 base::MatchPattern(speech_monitor_.GetNextUtterance(), "about:blank*")); |
| 267 EXPECT_EQ("main", speech_monitor_.GetNextUtterance()); | 270 EXPECT_EQ("main", speech_monitor_.GetNextUtterance()); |
| 268 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance()); | 271 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance()); |
| 269 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance()); | 272 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance()); |
| 270 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 273 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
| 271 } | 274 } |
| 272 | 275 |
| 273 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) { | 276 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) { |
| 274 EnableChromeVox(); | 277 EnableChromeVox(); |
| 275 | 278 |
| 276 chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION); | 279 chrome::ExecuteCommand(browser(), IDC_FOCUS_LOCATION); |
| 277 EXPECT_TRUE( | 280 EXPECT_TRUE( |
| 278 MatchPattern(speech_monitor_.GetNextUtterance(), "*about:blank*")); | 281 base::MatchPattern(speech_monitor_.GetNextUtterance(), "*about:blank*")); |
| 279 EXPECT_EQ("main", speech_monitor_.GetNextUtterance()); | 282 EXPECT_EQ("main", speech_monitor_.GetNextUtterance()); |
| 280 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance()); | 283 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance()); |
| 281 EXPECT_EQ("Address and search bar", speech_monitor_.GetNextUtterance()); | 284 EXPECT_EQ("Address and search bar", speech_monitor_.GetNextUtterance()); |
| 282 EXPECT_EQ("about:blank", speech_monitor_.GetNextUtterance()); | 285 EXPECT_EQ("about:blank", speech_monitor_.GetNextUtterance()); |
| 283 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance()); | 286 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance()); |
| 284 | 287 |
| 285 SendKeyPress(ui::VKEY_X); | 288 SendKeyPress(ui::VKEY_X); |
| 286 EXPECT_EQ("x", speech_monitor_.GetNextUtterance()); | 289 EXPECT_EQ("x", speech_monitor_.GetNextUtterance()); |
| 287 | 290 |
| 288 SendKeyPress(ui::VKEY_Y); | 291 SendKeyPress(ui::VKEY_Y); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 301 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); | 304 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); |
| 302 EXPECT_EQ("Shelf", speech_monitor_.GetNextUtterance()); | 305 EXPECT_EQ("Shelf", speech_monitor_.GetNextUtterance()); |
| 303 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance()); | 306 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance()); |
| 304 if (app_list::switches::IsExperimentalAppListEnabled()) | 307 if (app_list::switches::IsExperimentalAppListEnabled()) |
| 305 EXPECT_EQ("Launcher", speech_monitor_.GetNextUtterance()); | 308 EXPECT_EQ("Launcher", speech_monitor_.GetNextUtterance()); |
| 306 else | 309 else |
| 307 EXPECT_EQ("Apps", speech_monitor_.GetNextUtterance()); | 310 EXPECT_EQ("Apps", speech_monitor_.GetNextUtterance()); |
| 308 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 311 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
| 309 | 312 |
| 310 SendKeyPress(ui::VKEY_TAB); | 313 SendKeyPress(ui::VKEY_TAB); |
| 311 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*")); | 314 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); |
| 312 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); | 315 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); |
| 313 } | 316 } |
| 314 | 317 |
| 315 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateAppLauncher) { | 318 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateAppLauncher) { |
| 316 EnableChromeVox(); | 319 EnableChromeVox(); |
| 317 | 320 |
| 318 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); | 321 EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); |
| 319 while (true) { | 322 while (true) { |
| 320 std::string utterance = speech_monitor_.GetNextUtterance(); | 323 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 321 if (MatchPattern(utterance, "Button")) | 324 if (base::MatchPattern(utterance, "Button")) |
| 322 break; | 325 break; |
| 323 } | 326 } |
| 324 | 327 |
| 325 SendKeyPress(ui::VKEY_RETURN); | 328 SendKeyPress(ui::VKEY_RETURN); |
| 326 | 329 |
| 327 EXPECT_EQ("Search or type U R L", speech_monitor_.GetNextUtterance()); | 330 EXPECT_EQ("Search or type U R L", speech_monitor_.GetNextUtterance()); |
| 328 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance()); | 331 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance()); |
| 329 | 332 |
| 330 SendKeyPress(ui::VKEY_DOWN); | 333 SendKeyPress(ui::VKEY_DOWN); |
| 331 EXPECT_EQ("Dialog", speech_monitor_.GetNextUtterance()); | 334 EXPECT_EQ("Dialog", speech_monitor_.GetNextUtterance()); |
| 332 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*")); | 335 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); |
| 333 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 336 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
| 334 } | 337 } |
| 335 | 338 |
| 336 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OpenStatusTray) { | 339 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OpenStatusTray) { |
| 337 EnableChromeVox(); | 340 EnableChromeVox(); |
| 338 | 341 |
| 339 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE)); | 342 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE)); |
| 340 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Status tray*")); | 343 EXPECT_TRUE( |
| 341 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "time *")); | 344 base::MatchPattern(speech_monitor_.GetNextUtterance(), "Status tray*")); |
| 342 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), | 345 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "time *")); |
| 343 "Battery is*full.")); | 346 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), |
| 344 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*")); | 347 "Battery is*full.")); |
| 345 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); | 348 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); |
| 349 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); |
| 346 } | 350 } |
| 347 | 351 |
| 348 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateSystemTray) { | 352 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateSystemTray) { |
| 349 EnableChromeVox(); | 353 EnableChromeVox(); |
| 350 | 354 |
| 351 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE)); | 355 EXPECT_TRUE(PerformAcceleratorAction(ash::SHOW_SYSTEM_TRAY_BUBBLE)); |
| 352 while (true) { | 356 while (true) { |
| 353 std::string utterance = speech_monitor_.GetNextUtterance(); | 357 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 354 if (MatchPattern(utterance, "Button")) | 358 if (base::MatchPattern(utterance, "Button")) |
| 355 break; | 359 break; |
| 356 } | 360 } |
| 357 | 361 |
| 358 SendKeyPress(ui::VKEY_TAB); | 362 SendKeyPress(ui::VKEY_TAB); |
| 359 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*")); | 363 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); |
| 360 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); | 364 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); |
| 361 | 365 |
| 362 // Compat next element. | 366 // Compat next element. |
| 363 SendKeyPressWithSearchAndShift(ui::VKEY_RIGHT); | 367 SendKeyPressWithSearchAndShift(ui::VKEY_RIGHT); |
| 364 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*")); | 368 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); |
| 365 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); | 369 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); |
| 366 | 370 |
| 367 // Compat next button. | 371 // Compat next button. |
| 368 SendKeyPressWithSearchAndShift(ui::VKEY_N); | 372 SendKeyPressWithSearchAndShift(ui::VKEY_N); |
| 369 SendKeyPressWithSearchAndShift(ui::VKEY_B); | 373 SendKeyPressWithSearchAndShift(ui::VKEY_B); |
| 370 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "*")); | 374 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "*")); |
| 371 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); | 375 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "Button")); |
| 372 | 376 |
| 373 // Navigate to Bluetooth sub-menu and open it. | 377 // Navigate to Bluetooth sub-menu and open it. |
| 374 while (true) { | 378 while (true) { |
| 375 SendKeyPress(ui::VKEY_TAB); | 379 SendKeyPress(ui::VKEY_TAB); |
| 376 std::string content = speech_monitor_.GetNextUtterance(); | 380 std::string content = speech_monitor_.GetNextUtterance(); |
| 377 std::string role = speech_monitor_.GetNextUtterance(); | 381 std::string role = speech_monitor_.GetNextUtterance(); |
| 378 if (MatchPattern(content, "*Bluetooth*") && MatchPattern(role, "Button")) | 382 if (base::MatchPattern(content, "*Bluetooth*") && |
| 383 base::MatchPattern(role, "Button")) |
| 379 break; | 384 break; |
| 380 } | 385 } |
| 381 SendKeyPress(ui::VKEY_RETURN); | 386 SendKeyPress(ui::VKEY_RETURN); |
| 382 | 387 |
| 383 // Navigate to return to previous menu button and press it. | 388 // Navigate to return to previous menu button and press it. |
| 384 while (true) { | 389 while (true) { |
| 385 SendKeyPress(ui::VKEY_TAB); | 390 SendKeyPress(ui::VKEY_TAB); |
| 386 std::string utterance = speech_monitor_.GetNextUtterance(); | 391 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 387 if (MatchPattern(utterance, "Previous menu")) | 392 if (base::MatchPattern(utterance, "Previous menu")) |
| 388 break; | 393 break; |
| 389 } | 394 } |
| 390 SendKeyPress(ui::VKEY_RETURN); | 395 SendKeyPress(ui::VKEY_RETURN); |
| 391 | 396 |
| 392 while (true) { | 397 while (true) { |
| 393 std::string utterance = speech_monitor_.GetNextUtterance(); | 398 std::string utterance = speech_monitor_.GetNextUtterance(); |
| 394 if (MatchPattern(speech_monitor_.GetNextUtterance(), "*Bluetooth")) | 399 if (base::MatchPattern(speech_monitor_.GetNextUtterance(), "*Bluetooth")) |
| 395 break; | 400 break; |
| 396 } | 401 } |
| 397 } | 402 } |
| 398 | 403 |
| 399 // See http://crbug.com/443608 | 404 // See http://crbug.com/443608 |
| 400 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_ScreenBrightness) { | 405 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_ScreenBrightness) { |
| 401 EnableChromeVox(); | 406 EnableChromeVox(); |
| 402 | 407 |
| 403 EXPECT_TRUE(PerformAcceleratorAction(ash::BRIGHTNESS_UP)); | 408 EXPECT_TRUE(PerformAcceleratorAction(ash::BRIGHTNESS_UP)); |
| 404 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), | 409 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), |
| 405 "Brightness * percent")); | 410 "Brightness * percent")); |
| 406 | 411 |
| 407 EXPECT_TRUE(PerformAcceleratorAction(ash::BRIGHTNESS_DOWN)); | 412 EXPECT_TRUE(PerformAcceleratorAction(ash::BRIGHTNESS_DOWN)); |
| 408 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), | 413 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), |
| 409 "Brightness * percent")); | 414 "Brightness * percent")); |
| 410 } | 415 } |
| 411 | 416 |
| 412 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, VolumeSlider) { | 417 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, VolumeSlider) { |
| 413 EnableChromeVox(); | 418 EnableChromeVox(); |
| 414 | 419 |
| 415 EXPECT_TRUE(PerformAcceleratorAction(ash::VOLUME_UP)); | 420 EXPECT_TRUE(PerformAcceleratorAction(ash::VOLUME_UP)); |
| 416 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "* percent*")); | 421 EXPECT_TRUE( |
| 422 base::MatchPattern(speech_monitor_.GetNextUtterance(), "* percent*")); |
| 417 EXPECT_EQ("Volume,", speech_monitor_.GetNextUtterance()); | 423 EXPECT_EQ("Volume,", speech_monitor_.GetNextUtterance()); |
| 418 EXPECT_EQ("slider", speech_monitor_.GetNextUtterance()); | 424 EXPECT_EQ("slider", speech_monitor_.GetNextUtterance()); |
| 419 } | 425 } |
| 420 | 426 |
| 421 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OverviewMode) { | 427 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OverviewMode) { |
| 422 EnableChromeVox(); | 428 EnableChromeVox(); |
| 423 | 429 |
| 424 EXPECT_TRUE(PerformAcceleratorAction(ash::TOGGLE_OVERVIEW)); | 430 EXPECT_TRUE(PerformAcceleratorAction(ash::TOGGLE_OVERVIEW)); |
| 425 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance()); | 431 EXPECT_EQ("Edit text", speech_monitor_.GetNextUtterance()); |
| 426 EXPECT_EQ("Alert", speech_monitor_.GetNextUtterance()); | 432 EXPECT_EQ("Alert", speech_monitor_.GetNextUtterance()); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) { | 564 IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) { |
| 559 EnableChromeVox(); | 565 EnableChromeVox(); |
| 560 SimulateTouchScreenInChromeVox(); | 566 SimulateTouchScreenInChromeVox(); |
| 561 | 567 |
| 562 // Send an accessibility hover event on the system tray, which is | 568 // Send an accessibility hover event on the system tray, which is |
| 563 // what we get when you tap it on a touch screen when ChromeVox is on. | 569 // what we get when you tap it on a touch screen when ChromeVox is on. |
| 564 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); | 570 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); |
| 565 tray->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); | 571 tray->NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); |
| 566 | 572 |
| 567 EXPECT_EQ("Status tray,", speech_monitor_.GetNextUtterance()); | 573 EXPECT_EQ("Status tray,", speech_monitor_.GetNextUtterance()); |
| 568 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "time*,")); | 574 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), "time*,")); |
| 569 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "Battery*")); | 575 EXPECT_TRUE( |
| 576 base::MatchPattern(speech_monitor_.GetNextUtterance(), "Battery*")); |
| 570 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 577 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
| 571 } | 578 } |
| 572 | 579 |
| 573 // | 580 // |
| 574 // Spoken feedback tests that run only in guest mode. | 581 // Spoken feedback tests that run only in guest mode. |
| 575 // | 582 // |
| 576 | 583 |
| 577 class GuestSpokenFeedbackTest : public LoggedInSpokenFeedbackTest { | 584 class GuestSpokenFeedbackTest : public LoggedInSpokenFeedbackTest { |
| 578 protected: | 585 protected: |
| 579 GuestSpokenFeedbackTest() {} | 586 GuestSpokenFeedbackTest() {} |
| 580 ~GuestSpokenFeedbackTest() override {} | 587 ~GuestSpokenFeedbackTest() override {} |
| 581 | 588 |
| 582 void SetUpCommandLine(base::CommandLine* command_line) override { | 589 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 583 command_line->AppendSwitch(chromeos::switches::kGuestSession); | 590 command_line->AppendSwitch(chromeos::switches::kGuestSession); |
| 584 command_line->AppendSwitch(::switches::kIncognito); | 591 command_line->AppendSwitch(::switches::kIncognito); |
| 585 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); | 592 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); |
| 586 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, | 593 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, |
| 587 chromeos::login::kGuestUserName); | 594 chromeos::login::kGuestUserName); |
| 588 } | 595 } |
| 589 | 596 |
| 590 private: | 597 private: |
| 591 DISALLOW_COPY_AND_ASSIGN(GuestSpokenFeedbackTest); | 598 DISALLOW_COPY_AND_ASSIGN(GuestSpokenFeedbackTest); |
| 592 }; | 599 }; |
| 593 | 600 |
| 594 IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) { | 601 IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) { |
| 595 EnableChromeVox(); | 602 EnableChromeVox(); |
| 596 | 603 |
| 597 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); | 604 chrome::ExecuteCommand(browser(), IDC_FOCUS_TOOLBAR); |
| 598 | 605 |
| 599 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), "about:blank*")); | 606 EXPECT_TRUE( |
| 607 base::MatchPattern(speech_monitor_.GetNextUtterance(), "about:blank*")); |
| 600 EXPECT_EQ("main", speech_monitor_.GetNextUtterance()); | 608 EXPECT_EQ("main", speech_monitor_.GetNextUtterance()); |
| 601 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance()); | 609 EXPECT_EQ("Tool bar", speech_monitor_.GetNextUtterance()); |
| 602 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance()); | 610 EXPECT_EQ("Reload", speech_monitor_.GetNextUtterance()); |
| 603 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); | 611 EXPECT_EQ("Button", speech_monitor_.GetNextUtterance()); |
| 604 } | 612 } |
| 605 | 613 |
| 606 // | 614 // |
| 607 // Spoken feedback tests of the out-of-box experience. | 615 // Spoken feedback tests of the out-of-box experience. |
| 608 // | 616 // |
| 609 | 617 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 // There's no guarantee that ChromeVox speaks anything when injected after | 652 // There's no guarantee that ChromeVox speaks anything when injected after |
| 645 // the page loads, which is by design. Tab forward and then backward | 653 // the page loads, which is by design. Tab forward and then backward |
| 646 // to make sure we get the right feedback from the language and keyboard | 654 // to make sure we get the right feedback from the language and keyboard |
| 647 // selection fields. | 655 // selection fields. |
| 648 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( | 656 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( |
| 649 window, ui::VKEY_TAB, false, false, false, false)); | 657 window, ui::VKEY_TAB, false, false, false, false)); |
| 650 | 658 |
| 651 while (speech_monitor_.GetNextUtterance() != "Select your keyboard:") { | 659 while (speech_monitor_.GetNextUtterance() != "Select your keyboard:") { |
| 652 } | 660 } |
| 653 EXPECT_EQ("U S", speech_monitor_.GetNextUtterance()); | 661 EXPECT_EQ("U S", speech_monitor_.GetNextUtterance()); |
| 654 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), | 662 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), |
| 655 "Combo box * of *")); | 663 "Combo box * of *")); |
| 656 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( | 664 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( |
| 657 window, ui::VKEY_TAB, false, true /*shift*/, false, false)); | 665 window, ui::VKEY_TAB, false, true /*shift*/, false, false)); |
| 658 while (speech_monitor_.GetNextUtterance() != "Select your language:") { | 666 while (speech_monitor_.GetNextUtterance() != "Select your language:") { |
| 659 } | 667 } |
| 660 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); | 668 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); |
| 661 EXPECT_TRUE( | 669 EXPECT_TRUE(base::MatchPattern(speech_monitor_.GetNextUtterance(), |
| 662 MatchPattern(speech_monitor_.GetNextUtterance(), "Combo box * of *")); | 670 "Combo box * of *")); |
| 663 } | 671 } |
| 664 | 672 |
| 665 } // namespace chromeos | 673 } // namespace chromeos |
| OLD | NEW |