Commit e03f042d authored by plundblad's avatar plundblad Committed by Commit bot

Reenable oobe spoken feedback test.

The test was disabled because it was flaky.  This CL tries to address that
and reenables the test.

BUG=346797
R=dtseng@chromium.org

Review URL: https://codereview.chromium.org/866713002

Cr-Commit-Position: refs/heads/master@{#313467}
parent d7972b15
...@@ -73,6 +73,7 @@ std::string SpeechMonitor::error() { ...@@ -73,6 +73,7 @@ std::string SpeechMonitor::error() {
void SpeechMonitor::WillSpeakUtteranceWithVoice(const Utterance* utterance, void SpeechMonitor::WillSpeakUtteranceWithVoice(const Utterance* utterance,
const VoiceData& voice_data) { const VoiceData& voice_data) {
VLOG(0) << "Speaking " << utterance->text();
utterance_queue_.push_back(utterance->text()); utterance_queue_.push_back(utterance->text());
if (loop_runner_.get()) if (loop_runner_.get())
loop_runner_->Quit(); loop_runner_->Quit();
......
...@@ -11,8 +11,10 @@ ...@@ -11,8 +11,10 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h" #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
#include "chrome/browser/chromeos/accessibility/speech_monitor.h" #include "chrome/browser/chromeos/accessibility/speech_monitor.h"
#include "chrome/browser/chromeos/login/login_manager_test.h"
#include "chrome/browser/chromeos/login/ui/login_display_host.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h"
#include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
#include "chrome/browser/chromeos/login/ui/webui_login_view.h" #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
...@@ -62,28 +64,22 @@ class LoggedInSpokenFeedbackTest : public InProcessBrowserTest { ...@@ -62,28 +64,22 @@ class LoggedInSpokenFeedbackTest : public InProcessBrowserTest {
} }
void TearDownOnMainThread() override { void TearDownOnMainThread() override {
AccessibilityManager::SetBrailleControllerForTest(NULL); AccessibilityManager::SetBrailleControllerForTest(nullptr);
} }
void SendKeyPress(ui::KeyboardCode key) { void SendKeyPress(ui::KeyboardCode key) {
ASSERT_NO_FATAL_FAILURE( ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
ASSERT_TRUE( nullptr, key, false, false, false, false)));
ui_test_utils::SendKeyPressToWindowSync(
NULL, key, false, false, false, false)));
} }
void SendKeyPressWithControl(ui::KeyboardCode key) { void SendKeyPressWithControl(ui::KeyboardCode key) {
ASSERT_NO_FATAL_FAILURE( ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
ASSERT_TRUE( nullptr, key, true, false, false, false)));
ui_test_utils::SendKeyPressToWindowSync(
NULL, key, true, false, false, false)));
} }
void SendKeyPressWithSearchAndShift(ui::KeyboardCode key) { void SendKeyPressWithSearchAndShift(ui::KeyboardCode key) {
ASSERT_NO_FATAL_FAILURE( ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
ASSERT_TRUE( nullptr, key, false, true, false, true)));
ui_test_utils::SendKeyPressToWindowSync(
NULL, key, false, true, false, true)));
} }
void RunJavaScriptInChromeVoxBackgroundPage(const std::string& script) { void RunJavaScriptInChromeVoxBackgroundPage(const std::string& script) {
...@@ -102,7 +98,7 @@ class LoggedInSpokenFeedbackTest : public InProcessBrowserTest { ...@@ -102,7 +98,7 @@ class LoggedInSpokenFeedbackTest : public InProcessBrowserTest {
"window.ontouchstart = function() {};"); "window.ontouchstart = function() {};");
} }
bool PerformAcceleratorAction(ash::AcceleratorAction action) { bool PerformAcceleratorAction(ash::AcceleratorAction action) {
ash::AcceleratorController* controller = ash::AcceleratorController* controller =
ash::Shell::GetInstance()->accelerator_controller(); ash::Shell::GetInstance()->accelerator_controller();
return controller->PerformActionIfEnabled(action); return controller->PerformActionIfEnabled(action);
...@@ -558,20 +554,29 @@ IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) { ...@@ -558,20 +554,29 @@ IN_PROC_BROWSER_TEST_F(GuestSpokenFeedbackTest, FocusToolbar) {
// Spoken feedback tests of the out-of-box experience. // Spoken feedback tests of the out-of-box experience.
// //
class OobeSpokenFeedbackTest : public InProcessBrowserTest { class OobeSpokenFeedbackTest : public LoginManagerTest {
protected: protected:
OobeSpokenFeedbackTest() {} OobeSpokenFeedbackTest() : LoginManagerTest(false) {}
~OobeSpokenFeedbackTest() override {} ~OobeSpokenFeedbackTest() override {}
void SetUpCommandLine(base::CommandLine* command_line) override { void SetUpCommandLine(base::CommandLine* command_line) override {
command_line->AppendSwitch(chromeos::switches::kLoginManager); LoginManagerTest::SetUpCommandLine(command_line);
command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); // Many bots don't have keyboard/mice which triggers the HID detection
command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); // dialog in the OOBE. Avoid confusing the tests with that.
command_line->AppendSwitch(chromeos::switches::kDisableHIDDetectionOnOOBE);
} }
void SetUpOnMainThread() override { // Waits until the OOBE screen signals it is ready.
AccessibilityManager::Get()-> void WaitUntilJSIsReady() {
SetProfileForTest(ProfileHelper::GetSigninProfile()); LoginDisplayHostImpl* host = static_cast<LoginDisplayHostImpl*>(
LoginDisplayHostImpl::default_host());
ASSERT_NE(nullptr, host);
chromeos::OobeUI* oobe_ui = host->GetOobeUI();
ASSERT_NE(nullptr, oobe_ui);
base::RunLoop run_loop;
const bool oobe_ui_ready = oobe_ui->IsJSReady(run_loop.QuitClosure());
if (!oobe_ui_ready)
run_loop.Run();
} }
SpeechMonitor speech_monitor_; SpeechMonitor speech_monitor_;
...@@ -580,8 +585,7 @@ class OobeSpokenFeedbackTest : public InProcessBrowserTest { ...@@ -580,8 +585,7 @@ class OobeSpokenFeedbackTest : public InProcessBrowserTest {
DISALLOW_COPY_AND_ASSIGN(OobeSpokenFeedbackTest); DISALLOW_COPY_AND_ASSIGN(OobeSpokenFeedbackTest);
}; };
// Test is flaky: http://crbug.com/346797 IN_PROC_BROWSER_TEST_F(OobeSpokenFeedbackTest, SpokenFeedbackInOobe) {
IN_PROC_BROWSER_TEST_F(OobeSpokenFeedbackTest, DISABLED_SpokenFeedbackInOobe) {
ui_controls::EnableUIControls(); ui_controls::EnableUIControls();
ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
...@@ -590,18 +594,34 @@ IN_PROC_BROWSER_TEST_F(OobeSpokenFeedbackTest, DISABLED_SpokenFeedbackInOobe) { ...@@ -590,18 +594,34 @@ IN_PROC_BROWSER_TEST_F(OobeSpokenFeedbackTest, DISABLED_SpokenFeedbackInOobe) {
views::Widget* widget = web_ui_login_view->GetWidget(); views::Widget* widget = web_ui_login_view->GetWidget();
gfx::NativeWindow window = widget->GetNativeWindow(); gfx::NativeWindow window = widget->GetNativeWindow();
WaitUntilJSIsReady();
// We expect to be in the language select dropdown for this test to work,
// so fail early if that's not the case.
ASSERT_TRUE(
js_checker().GetBool("document.activeElement.id == 'language-select'"));
AccessibilityManager::Get()->EnableSpokenFeedback( AccessibilityManager::Get()->EnableSpokenFeedback(
true, ui::A11Y_NOTIFICATION_NONE); true, ui::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage()); ASSERT_TRUE(speech_monitor_.SkipChromeVoxEnabledMessage());
// There's no guarantee that ChromeVox speaks anything when injected after
EXPECT_EQ("Select your language:", speech_monitor_.GetNextUtterance()); // the page loads, which is by design. Tab forward and then backward
EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance()); // to make sure we get the right feedback from the language and keyboard
// selection fields.
ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
window, ui::VKEY_TAB, false, false, false, false));
while (speech_monitor_.GetNextUtterance() != "Select your keyboard:") {
}
EXPECT_EQ("U S", speech_monitor_.GetNextUtterance());
EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(), EXPECT_TRUE(MatchPattern(speech_monitor_.GetNextUtterance(),
"Combo box * of *")); "Combo box * of *"));
ASSERT_TRUE( ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
ui_test_utils::SendKeyPressToWindowSync( window, ui::VKEY_TAB, false, true /*shift*/, false, false));
window, ui::VKEY_TAB, false, false, false, false)); while (speech_monitor_.GetNextUtterance() != "Select your language:") {
EXPECT_EQ("Select your keyboard:", speech_monitor_.GetNextUtterance()); }
EXPECT_EQ("English ( United States)", speech_monitor_.GetNextUtterance());
EXPECT_TRUE(
MatchPattern(speech_monitor_.GetNextUtterance(), "Combo box * of *"));
} }
} // namespace chromeos } // namespace chromeos
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment