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

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

Issue 884643003: Revert of Reenable oobe spoken feedback test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « chrome/browser/chromeos/accessibility/speech_monitor.cc ('k') | no next file » | 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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "chrome/app/chrome_command_ids.h" 13 #include "chrome/app/chrome_command_ids.h"
14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 14 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
16 #include "chrome/browser/chromeos/accessibility/speech_monitor.h" 15 #include "chrome/browser/chromeos/accessibility/speech_monitor.h"
17 #include "chrome/browser/chromeos/login/login_manager_test.h"
18 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 16 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
19 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" 17 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
20 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" 18 #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
21 #include "chrome/browser/chromeos/profiles/profile_helper.h" 19 #include "chrome/browser/chromeos/profiles/profile_helper.h"
22 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con troller.h" 20 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con troller.h"
23 #include "chrome/browser/speech/tts_controller.h" 21 #include "chrome/browser/speech/tts_controller.h"
24 #include "chrome/browser/speech/tts_platform.h" 22 #include "chrome/browser/speech/tts_platform.h"
25 #include "chrome/browser/ui/browser.h" 23 #include "chrome/browser/ui/browser.h"
26 #include "chrome/browser/ui/browser_commands.h" 24 #include "chrome/browser/ui/browser_commands.h"
27 #include "chrome/browser/ui/browser_window.h" 25 #include "chrome/browser/ui/browser_window.h"
(...skipping 29 matching lines...) Expand all
57 protected: 55 protected:
58 LoggedInSpokenFeedbackTest() 56 LoggedInSpokenFeedbackTest()
59 : animation_mode_(ui::ScopedAnimationDurationScaleMode::ZERO_DURATION) {} 57 : animation_mode_(ui::ScopedAnimationDurationScaleMode::ZERO_DURATION) {}
60 ~LoggedInSpokenFeedbackTest() override {} 58 ~LoggedInSpokenFeedbackTest() override {}
61 59
62 void SetUpInProcessBrowserTestFixture() override { 60 void SetUpInProcessBrowserTestFixture() override {
63 AccessibilityManager::SetBrailleControllerForTest(&braille_controller_); 61 AccessibilityManager::SetBrailleControllerForTest(&braille_controller_);
64 } 62 }
65 63
66 void TearDownOnMainThread() override { 64 void TearDownOnMainThread() override {
67 AccessibilityManager::SetBrailleControllerForTest(nullptr); 65 AccessibilityManager::SetBrailleControllerForTest(NULL);
68 } 66 }
69 67
70 void SendKeyPress(ui::KeyboardCode key) { 68 void SendKeyPress(ui::KeyboardCode key) {
71 ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( 69 ASSERT_NO_FATAL_FAILURE(
72 nullptr, key, false, false, false, false))); 70 ASSERT_TRUE(
71 ui_test_utils::SendKeyPressToWindowSync(
72 NULL, key, false, false, false, false)));
73 } 73 }
74 74
75 void SendKeyPressWithControl(ui::KeyboardCode key) { 75 void SendKeyPressWithControl(ui::KeyboardCode key) {
76 ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( 76 ASSERT_NO_FATAL_FAILURE(
77 nullptr, key, true, false, false, false))); 77 ASSERT_TRUE(
78 ui_test_utils::SendKeyPressToWindowSync(
79 NULL, key, true, false, false, false)));
78 } 80 }
79 81
80 void SendKeyPressWithSearchAndShift(ui::KeyboardCode key) { 82 void SendKeyPressWithSearchAndShift(ui::KeyboardCode key) {
81 ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( 83 ASSERT_NO_FATAL_FAILURE(
82 nullptr, key, false, true, false, true))); 84 ASSERT_TRUE(
85 ui_test_utils::SendKeyPressToWindowSync(
86 NULL, key, false, true, false, true)));
83 } 87 }
84 88
85 void RunJavaScriptInChromeVoxBackgroundPage(const std::string& script) { 89 void RunJavaScriptInChromeVoxBackgroundPage(const std::string& script) {
86 extensions::ExtensionHost* host = 90 extensions::ExtensionHost* host =
87 extensions::ProcessManager::Get(browser()->profile()) 91 extensions::ProcessManager::Get(browser()->profile())
88 ->GetBackgroundHostForExtension( 92 ->GetBackgroundHostForExtension(
89 extension_misc::kChromeVoxExtensionId); 93 extension_misc::kChromeVoxExtensionId);
90 CHECK(content::ExecuteScript(host->host_contents(), script)); 94 CHECK(content::ExecuteScript(host->host_contents(), script));
91 } 95 }
92 96
93 void SimulateTouchScreenInChromeVox() { 97 void SimulateTouchScreenInChromeVox() {
94 // ChromeVox looks at whether 'ontouchstart' exists to know whether 98 // ChromeVox looks at whether 'ontouchstart' exists to know whether
95 // or not it should respond to hover events. Fake it so that touch 99 // or not it should respond to hover events. Fake it so that touch
96 // exploration events get spoken. 100 // exploration events get spoken.
97 RunJavaScriptInChromeVoxBackgroundPage( 101 RunJavaScriptInChromeVoxBackgroundPage(
98 "window.ontouchstart = function() {};"); 102 "window.ontouchstart = function() {};");
99 } 103 }
100 104
101 bool PerformAcceleratorAction(ash::AcceleratorAction action) { 105 bool PerformAcceleratorAction(ash::AcceleratorAction action) {
102 ash::AcceleratorController* controller = 106 ash::AcceleratorController* controller =
103 ash::Shell::GetInstance()->accelerator_controller(); 107 ash::Shell::GetInstance()->accelerator_controller();
104 return controller->PerformActionIfEnabled(action); 108 return controller->PerformActionIfEnabled(action);
105 } 109 }
106 110
107 void DisableEarcons() { 111 void DisableEarcons() {
108 // Playing earcons from within a test is not only annoying if you're 112 // Playing earcons from within a test is not only annoying if you're
109 // running the test locally, but seems to cause crashes 113 // running the test locally, but seems to cause crashes
110 // (http://crbug.com/396507). Work around this by just telling 114 // (http://crbug.com/396507). Work around this by just telling
111 // ChromeVox to not ever play earcons (prerecorded sound effects). 115 // ChromeVox to not ever play earcons (prerecorded sound effects).
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 551
548 EXPECT_TRUE( 552 EXPECT_TRUE(
549 MatchPattern(speech_monitor_.GetNextUtterance(), 553 MatchPattern(speech_monitor_.GetNextUtterance(),
550 "about:blank*toolbar Reload Button")); 554 "about:blank*toolbar Reload Button"));
551 } 555 }
552 556
553 // 557 //
554 // Spoken feedback tests of the out-of-box experience. 558 // Spoken feedback tests of the out-of-box experience.
555 // 559 //
556 560
557 class OobeSpokenFeedbackTest : public LoginManagerTest { 561 class OobeSpokenFeedbackTest : public InProcessBrowserTest {
558 protected: 562 protected:
559 OobeSpokenFeedbackTest() : LoginManagerTest(false) {} 563 OobeSpokenFeedbackTest() {}
560 ~OobeSpokenFeedbackTest() override {} 564 ~OobeSpokenFeedbackTest() override {}
561 565
562 void SetUpCommandLine(base::CommandLine* command_line) override { 566 void SetUpCommandLine(base::CommandLine* command_line) override {
563 LoginManagerTest::SetUpCommandLine(command_line); 567 command_line->AppendSwitch(chromeos::switches::kLoginManager);
564 // Many bots don't have keyboard/mice which triggers the HID detection 568 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests);
565 // dialog in the OOBE. Avoid confusing the tests with that. 569 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user");
566 command_line->AppendSwitch(chromeos::switches::kDisableHIDDetectionOnOOBE);
567 } 570 }
568 571
569 // Waits until the OOBE screen signals it is ready. 572 void SetUpOnMainThread() override {
570 void WaitUntilJSIsReady() { 573 AccessibilityManager::Get()->
571 LoginDisplayHostImpl* host = static_cast<LoginDisplayHostImpl*>( 574 SetProfileForTest(ProfileHelper::GetSigninProfile());
572 LoginDisplayHostImpl::default_host());
573 ASSERT_NE(nullptr, host);
574 chromeos::OobeUI* oobe_ui = host->GetOobeUI();
575 ASSERT_NE(nullptr, oobe_ui);
576 base::RunLoop run_loop;
577 const bool oobe_ui_ready = oobe_ui->IsJSReady(run_loop.QuitClosure());
578 if (!oobe_ui_ready)
579 run_loop.Run();
580 } 575 }
581 576
582 SpeechMonitor speech_monitor_; 577 SpeechMonitor speech_monitor_;
583 578
584 private: 579 private:
585 DISALLOW_COPY_AND_ASSIGN(OobeSpokenFeedbackTest); 580 DISALLOW_COPY_AND_ASSIGN(OobeSpokenFeedbackTest);
586 }; 581 };
587 582
588 IN_PROC_BROWSER_TEST_F(OobeSpokenFeedbackTest, SpokenFeedbackInOobe) { 583 // Test is flaky: http://crbug.com/346797
584 IN_PROC_BROWSER_TEST_F(OobeSpokenFeedbackTest, DISABLED_SpokenFeedbackInOobe) {
589 ui_controls::EnableUIControls(); 585 ui_controls::EnableUIControls();
590 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); 586 ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
591 587
592 LoginDisplayHost* login_display_host = LoginDisplayHostImpl::default_host(); 588 LoginDisplayHost* login_display_host = LoginDisplayHostImpl::default_host();
593 WebUILoginView* web_ui_login_view = login_display_host->GetWebUILoginView(); 589 WebUILoginView* web_ui_login_view = login_display_host->GetWebUILoginView();
594 views::Widget* widget = web_ui_login_view->GetWidget(); 590 views::Widget* widget = web_ui_login_view->GetWidget();
595 gfx::NativeWindow window = widget->GetNativeWindow(); 591 gfx::NativeWindow window = widget->GetNativeWindow();
596 592
597 WaitUntilJSIsReady();
598
599 // We expect to be in the language select dropdown for this test to work,
600 // so fail early if that's not the case.
601 ASSERT_TRUE(
602 js_checker().GetBool("document.activeElement.id == 'language-select'"));
603 AccessibilityManager::Get()->EnableSpokenFeedback( 593 AccessibilityManager::Get()->EnableSpokenFeedback(
604 true, ui::A11Y_NOTIFICATION_NONE); 594 true, ui::A11Y_NOTIFICATION_NONE);
605 ASSERT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); 595 EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage());
606 // There's no guarantee that ChromeVox speaks anything when injected after
607 // the page loads, which is by design. Tab forward and then backward
608 // to make sure we get the right feedback from the language and keyboard
609 // selection fields.
610 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
611 window, ui::VKEY_TAB, false, false, false, false));
612 596
613 while (speech_monitor_.GetNextUtterance() != "Select your keyboard:") { 597 EXPECT_EQ("Select your language:", speech_monitor_.GetNextUtterance());
614 } 598 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance());
615 EXPECT_EQ("U S", speech_monitor_.GetNextUtterance());
616 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), 599 EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(),
617 "Combo box * of *")); 600 "Combo box * of *"));
618 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( 601 ASSERT_TRUE(
619 window, ui::VKEY_TAB, false, true /*shift*/, false, false)); 602 ui_test_utils::SendKeyPressToWindowSync(
620 while (speech_monitor_.GetNextUtterance() != "Select your language:") { 603 window, ui::VKEY_TAB, false, false, false, false));
621 } 604 EXPECT_EQ("Select your keyboard:", speech_monitor_.GetNextUtterance());
622 EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance());
623 EXPECT_TRUE(
624 MatchPattern(speech_monitor_.GetNextUtterance(), "Combo box * of *"));
625 } 605 }
626 606
627 } // namespace chromeos 607 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/accessibility/speech_monitor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698