Commit a3c46feb authored by David Tseng's avatar David Tseng Committed by Commit Bot

Re-enable some SpokenFeedbackTests

General strategy:
- perform all actions (sm_.Call)
- gather pending utterances
- mix in Expect* calls between all Call actions (incrementally from the top)
- keep the tests mostly simple (limit UI interactions) to prevent flakes
- do use the async SpeechMonitor api which should be less flakey
- deleted one test who's behavior is still in flux (empty panel menu behavior)

Some tests were still failing but due to external factors. Comments left.

Change-Id: I7689880dbeeac3b31fe22a8029fae5078d975f0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2119382
Commit-Queue: David Tseng <dtseng@chromium.org>
Reviewed-by: default avatarAkihiro Ota <akihiroota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753470}
parent 071013fb
......@@ -230,6 +230,10 @@ void SpeechMonitor::Replay() {
}
void SpeechMonitor::MaybeContinueReplay() {
// This method can be called prior to Replay() being called.
if (!replay_called_)
return;
auto it = replay_queue_.begin();
while (it != replay_queue_.end()) {
if (it->first()) {
......
......@@ -140,34 +140,32 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest,
EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF));
while (sm_.GetNextUtterance() != "Press Search plus Space to activate") {
}
sm_.ExpectSpeech("Shelf");
// Press space on the launcher button in shelf, this opens peeking launcher.
SendKeyPressWithSearch(ui::VKEY_SPACE);
while (sm_.GetNextUtterance() != "Launcher, partial view") {
}
sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_SPACE); });
sm_.ExpectSpeech("Launcher, partial view");
// Send a key press to enable keyboard traversal
SendKeyPressWithSearchAndShift(ui::VKEY_TAB);
sm_.Call([this]() { SendKeyPressWithSearchAndShift(ui::VKEY_TAB); });
// Move focus to expand all apps button.
SendKeyPressWithSearchAndShift(ui::VKEY_TAB);
while (sm_.GetNextUtterance() != "Press Search plus Space to activate") {
}
sm_.Call([this]() { SendKeyPressWithSearchAndShift(ui::VKEY_TAB); });
sm_.ExpectSpeech("Expand to all apps");
// Press space on expand arrow to go to fullscreen launcher.
SendKeyPressWithSearch(ui::VKEY_SPACE);
while (sm_.GetNextUtterance() != "Launcher, all apps") {
}
sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_SPACE); });
sm_.ExpectSpeech("Launcher, all apps");
// Make sure the first traversal left is not the expand arrow button.
SendKeyPressWithSearch(ui::VKEY_LEFT);
EXPECT_NE("Expand to all apps", sm_.GetNextUtterance());
sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_LEFT); });
sm_.ExpectNextSpeechIsNot("Expand to all apps");
// Make sure the second traversal left is not the expand arrow button.
SendKeyPressWithSearch(ui::VKEY_LEFT);
EXPECT_NE("Expand to all apps", sm_.GetNextUtterance());
sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_LEFT); });
sm_.ExpectNextSpeechIsNot("Expand to all apps");
sm_.Replay();
}
IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest,
......@@ -256,61 +254,49 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest,
sm_.Replay();
}
// TODO(newcomer): reimplement this test once the AppListFocus changes are
// complete (http://crbug.com/784942).
IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest,
DISABLED_NavigateAppLauncher) {
IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest, NavigateAppLauncher) {
EnableChromeVox();
// Add one app to the applist.
PopulateApps(1);
EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF));
// Wait for it to say "Launcher", "Button", "Shelf", "Tool bar".
while (true) {
std::string utterance = sm_.GetNextUtterance();
if (base::MatchPattern(utterance, "Launcher"))
break;
}
EXPECT_EQ("Button", sm_.GetNextUtterance());
EXPECT_EQ("Shelf", sm_.GetNextUtterance());
EXPECT_EQ("Tool bar", sm_.GetNextUtterance());
sm_.ExpectSpeechPattern("Launcher");
sm_.ExpectSpeech("Button");
sm_.ExpectSpeech("Shelf");
sm_.ExpectSpeech("Tool bar");
// Click on the launcher, it brings up the app list UI.
SendKeyPress(ui::VKEY_SPACE);
while ("Search or type URL" != sm_.GetNextUtterance()) {
}
while ("Edit text" != sm_.GetNextUtterance()) {
}
sm_.Call([this]() { SendKeyPress(ui::VKEY_SPACE); });
sm_.ExpectSpeech(
"Search your device, apps, and web. Use the arrow keys to navigate your "
"apps.");
sm_.ExpectSpeech("Edit text");
// Close it and open it again.
SendKeyPress(ui::VKEY_ESCAPE);
while (true) {
std::string utterance = sm_.GetNextUtterance();
if (base::MatchPattern(utterance, "*window*"))
break;
}
sm_.Call([this]() { SendKeyPress(ui::VKEY_ESCAPE); });
sm_.ExpectSpeechPattern("*window*");
EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF));
while (true) {
std::string utterance = sm_.GetNextUtterance();
if (base::MatchPattern(utterance, "Button"))
break;
}
SendKeyPress(ui::VKEY_SPACE);
// Now type a space into the text field and wait until we hear "space".
// This makes the test more robust as it allows us to skip over other
// speech along the way.
SendKeyPress(ui::VKEY_SPACE);
while (true) {
if ("space" == sm_.GetNextUtterance())
break;
}
sm_.Call(
[this]() { EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); });
sm_.ExpectSpeechPattern("Launcher");
sm_.ExpectSpeech("Button");
sm_.Call([this]() { SendKeyPress(ui::VKEY_SPACE); });
sm_.ExpectSpeech(
"Search your device, apps, and web. Use the arrow keys to navigate your "
"apps.");
// Now press the down arrow and we should be focused on an app button
// Now press the right arrow and we should be focused on an app button
// in a dialog.
SendKeyPress(ui::VKEY_DOWN);
while ("Button" != sm_.GetNextUtterance()) {
}
// THis doesn't work though (to be done below).
// TODO(newcomer): reimplement this test once the AppListFocus changes are
// complete (http://crbug.com/784942).
sm_.Replay();
}
} // namespace chromeos
......@@ -29,6 +29,7 @@ class LoggedInSpokenFeedbackTest : public InProcessBrowserTest {
// Simulate key press event.
void SendKeyPress(ui::KeyboardCode key);
void SendKeyPressWithControl(ui::KeyboardCode key);
void SendKeyPressWithShift(ui::KeyboardCode key);
void SendKeyPressWithSearchAndShift(ui::KeyboardCode key);
void SendKeyPressWithSearch(ui::KeyboardCode key);
void SendKeyPressWithSearchAndControl(ui::KeyboardCode key);
......
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