Commit 18e2d4a0 authored by Trent Apted's avatar Trent Apted Committed by Commit Bot

Revert "Re-enable some SpokenFeedbackTests"

This reverts commit a3c46feb.

Reason for revert: Landed on top of https://chromium-review.googlesource.com/c/chromium/src/+/2120741 which needs to be reverted

Original change's description:
> 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: Akihiro Ota <akihiroota@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#753470}

TBR=dmazzoni@chromium.org,dtseng@chromium.org,akihiroota@chromium.org

Change-Id: I01288031b7aab5694da31522da5393bf25ff2018
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2121636Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753517}
parent 6bd49e08
......@@ -230,10 +230,6 @@ 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,32 +140,34 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest,
EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF));
sm_.ExpectSpeech("Shelf");
while (sm_.GetNextUtterance() != "Press Search plus Space to activate") {
}
// Press space on the launcher button in shelf, this opens peeking launcher.
sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_SPACE); });
sm_.ExpectSpeech("Launcher, partial view");
SendKeyPressWithSearch(ui::VKEY_SPACE);
while (sm_.GetNextUtterance() != "Launcher, partial view") {
}
// Send a key press to enable keyboard traversal
sm_.Call([this]() { SendKeyPressWithSearchAndShift(ui::VKEY_TAB); });
SendKeyPressWithSearchAndShift(ui::VKEY_TAB);
// Move focus to expand all apps button.
sm_.Call([this]() { SendKeyPressWithSearchAndShift(ui::VKEY_TAB); });
sm_.ExpectSpeech("Expand to all apps");
SendKeyPressWithSearchAndShift(ui::VKEY_TAB);
while (sm_.GetNextUtterance() != "Press Search plus Space to activate") {
}
// Press space on expand arrow to go to fullscreen launcher.
sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_SPACE); });
sm_.ExpectSpeech("Launcher, all apps");
SendKeyPressWithSearch(ui::VKEY_SPACE);
while (sm_.GetNextUtterance() != "Launcher, all apps") {
}
// Make sure the first traversal left is not the expand arrow button.
sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_LEFT); });
sm_.ExpectNextSpeechIsNot("Expand to all apps");
SendKeyPressWithSearch(ui::VKEY_LEFT);
EXPECT_NE("Expand to all apps", sm_.GetNextUtterance());
// Make sure the second traversal left is not the expand arrow button.
sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_LEFT); });
sm_.ExpectNextSpeechIsNot("Expand to all apps");
sm_.Replay();
SendKeyPressWithSearch(ui::VKEY_LEFT);
EXPECT_NE("Expand to all apps", sm_.GetNextUtterance());
}
IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest,
......@@ -254,49 +256,61 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest,
sm_.Replay();
}
IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest, NavigateAppLauncher) {
// TODO(newcomer): reimplement this test once the AppListFocus changes are
// complete (http://crbug.com/784942).
IN_PROC_BROWSER_TEST_P(SpokenFeedbackAppListTest,
DISABLED_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".
sm_.ExpectSpeechPattern("Launcher");
sm_.ExpectSpeech("Button");
sm_.ExpectSpeech("Shelf");
sm_.ExpectSpeech("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());
// Click on the launcher, it brings up the app list UI.
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");
SendKeyPress(ui::VKEY_SPACE);
while ("Search or type URL" != sm_.GetNextUtterance()) {
}
while ("Edit text" != sm_.GetNextUtterance()) {
}
// Close it and open it again.
sm_.Call([this]() { SendKeyPress(ui::VKEY_ESCAPE); });
sm_.ExpectSpeechPattern("*window*");
sm_.Call(
[this]() { EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF)); });
sm_.ExpectSpeechPattern("Launcher");
sm_.ExpectSpeech("Button");
SendKeyPress(ui::VKEY_ESCAPE);
while (true) {
std::string utterance = sm_.GetNextUtterance();
if (base::MatchPattern(utterance, "*window*"))
break;
}
sm_.Call([this]() { SendKeyPress(ui::VKEY_SPACE); });
sm_.ExpectSpeech(
"Search your device, apps, and web. Use the arrow keys to navigate your "
"apps.");
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;
}
// Now press the right arrow and we should be focused on an app button
// Now press the down arrow and we should be focused on an app button
// in a dialog.
// 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();
SendKeyPress(ui::VKEY_DOWN);
while ("Button" != sm_.GetNextUtterance()) {
}
}
} // namespace chromeos
......@@ -89,11 +89,6 @@ void LoggedInSpokenFeedbackTest::SendKeyPressWithControl(ui::KeyboardCode key) {
nullptr, key, true, false, false, false)));
}
void LoggedInSpokenFeedbackTest::SendKeyPressWithShift(ui::KeyboardCode key) {
ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
nullptr, key, false, true, false, false)));
}
void LoggedInSpokenFeedbackTest::SendKeyPressWithSearchAndShift(
ui::KeyboardCode key) {
ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
......@@ -179,75 +174,85 @@ void LoggedInSpokenFeedbackTest::PressRepeatedlyUntilUtterance(
}
}
IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest, AddBookmark) {
// This test is very flakey with ChromeVox Next since we generate a lot more
// utterances for text fields.
// TODO(dtseng): Fix properly.
IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest, DISABLED_AddBookmark) {
EnableChromeVox();
chrome::ExecuteCommand(browser(), IDC_SHOW_BOOKMARK_BAR);
// Create a bookmark with title "foo".
chrome::ExecuteCommand(browser(), IDC_BOOKMARK_THIS_TAB);
EXPECT_EQ("Bookmark added! dialog Bookmark name about:blank Edit text",
sm_.GetNextUtterance());
EXPECT_EQ("about:blank", sm_.GetNextUtterance());
sm_.ExpectSpeech("Bookmark name");
sm_.ExpectSpeech("about:blank");
sm_.ExpectSpeech("selected");
sm_.ExpectSpeech("Edit text");
sm_.ExpectSpeech("Bookmark added");
sm_.ExpectSpeech("Dialog");
sm_.ExpectSpeech("Bookmark added, window");
sm_.Call([this]() {
SendKeyPress(ui::VKEY_F);
SendKeyPress(ui::VKEY_O);
SendKeyPress(ui::VKEY_O);
});
sm_.ExpectSpeech("F");
sm_.ExpectSpeech("O");
sm_.ExpectSpeech("O");
sm_.Call([this]() { SendKeyPress(ui::VKEY_TAB); });
sm_.ExpectSpeech("Bookmark folder");
sm_.ExpectSpeech("Bookmarks bar");
sm_.ExpectSpeech("Button");
sm_.ExpectSpeech("has pop up");
sm_.Call([this]() { SendKeyPress(ui::VKEY_TAB); });
sm_.ExpectSpeech("More…");
SendKeyPress(ui::VKEY_F);
EXPECT_EQ("f", sm_.GetNextUtterance());
SendKeyPress(ui::VKEY_O);
EXPECT_EQ("o", sm_.GetNextUtterance());
SendKeyPress(ui::VKEY_O);
EXPECT_EQ("o", sm_.GetNextUtterance());
sm_.Call([this]() { SendKeyPress(ui::VKEY_TAB); });
sm_.ExpectSpeech("Remove");
SendKeyPress(ui::VKEY_TAB);
EXPECT_EQ("Bookmark folder combo Box Bookmarks bar", sm_.GetNextUtterance());
sm_.Call([this]() { SendKeyPress(ui::VKEY_TAB); });
sm_.ExpectSpeech("Done");
SendKeyPress(ui::VKEY_RETURN);
sm_.Call([this]() { SendKeyPress(ui::VKEY_RETURN); });
// Focus goes back to window.
sm_.ExpectSpeechPattern("about:blank*");
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "*oolbar*"));
// Wait for active window change to be announced to avoid interference from
// that below.
while (sm_.GetNextUtterance() != "window about blank tab") {
// Do nothing.
}
// Focus bookmarks bar and listen for "foo".
sm_.Call(
[this]() { chrome::ExecuteCommand(browser(), IDC_FOCUS_BOOKMARKS); });
sm_.ExpectSpeech("foo");
sm_.ExpectSpeech("Button");
sm_.ExpectSpeech("Bookmarks");
sm_.ExpectSpeech("Tool bar");
sm_.Replay();
chrome::ExecuteCommand(browser(), IDC_FOCUS_BOOKMARKS);
while (true) {
std::string utterance = sm_.GetNextUtterance();
VLOG(0) << "Got utterance: " << utterance;
if (utterance == "Bookmarks,")
break;
}
EXPECT_EQ("foo,", sm_.GetNextUtterance());
EXPECT_EQ("button", sm_.GetNextUtterance());
}
IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest, NavigateNotificationCenter) {
IN_PROC_BROWSER_TEST_F(LoggedInSpokenFeedbackTest,
DISABLED_NavigateNotificationCenter) {
EnableChromeVox();
EXPECT_TRUE(PerformAcceleratorAction(ash::TOGGLE_MESSAGE_CENTER_BUBBLE));
sm_.ExpectSpeech(
"Quick Settings, Press search plus left to access the notification "
"center., window");
sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_LEFT); });
// If you are hitting this in the course of changing the UI, please fix. This
// item needs a label.
sm_.ExpectSpeech("List item");
// Tab to request the initial focus.
SendKeyPress(ui::VKEY_TAB);
// Furthermore, navigation is generally broken using Search+Left.
// Wait for it to say "Notification Center, window".
while ("Notification Center, window" != sm_.GetNextUtterance()) {
}
sm_.Replay();
// Tab until we get to the Do Not Disturb button.
SendKeyPress(ui::VKEY_TAB);
do {
std::string ut = sm_.GetNextUtterance();
if (ut == "Do not disturb")
break;
else if (ut == "Button")
SendKeyPress(ui::VKEY_TAB);
} while (true);
EXPECT_EQ("Button", sm_.GetNextUtterance());
EXPECT_EQ("Not pressed", sm_.GetNextUtterance());
SendKeyPress(ui::VKEY_SPACE);
EXPECT_EQ("Do not disturb", sm_.GetNextUtterance());
EXPECT_EQ("Button", sm_.GetNextUtterance());
EXPECT_EQ("Pressed", sm_.GetNextUtterance());
SendKeyPress(ui::VKEY_SPACE);
EXPECT_EQ("Do not disturb", sm_.GetNextUtterance());
EXPECT_EQ("Button", sm_.GetNextUtterance());
EXPECT_EQ("Not pressed", sm_.GetNextUtterance());
}
//
......@@ -280,7 +285,9 @@ INSTANTIATE_TEST_SUITE_P(TestAsNormalAndGuestUser,
::testing::Values(kTestAsNormalUser,
kTestAsGuestUser));
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, EnableSpokenFeedback) {
// TODO(tommi): Flakily hitting HasOneRef DCHECK in
// AudioOutputResampler::Shutdown, see crbug.com/630031.
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_EnableSpokenFeedback) {
EnableChromeVox();
}
......@@ -292,37 +299,21 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusToolbar) {
EXPECT_EQ("Button", sm_.GetNextUtterance());
}
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TypeInOmnibox) {
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_TypeInOmnibox) {
EnableChromeVox();
ui_test_utils::NavigateToURL(
browser(), GURL("data:text/html;charset=utf-8,<p>unused</p>"));
sm_.Call([this]() { SendKeyPressWithControl(ui::VKEY_L); });
sm_.ExpectSpeech("Address and search bar");
sm_.Call([this]() {
// Select all the text.
SendKeyPressWithControl(ui::VKEY_A);
// Type x, y, and z.
SendKeyPress(ui::VKEY_X);
SendKeyPress(ui::VKEY_Y);
SendKeyPress(ui::VKEY_Z);
});
sm_.ExpectSpeech("X");
sm_.ExpectSpeech("Y");
sm_.ExpectSpeech("Z");
// Location bar has focus by default so just start typing.
SendKeyPress(ui::VKEY_X);
EXPECT_EQ("x", sm_.GetNextUtterance());
sm_.Call([this]() { SendKeyPress(ui::VKEY_BACK); });
sm_.ExpectSpeech("Z");
SendKeyPress(ui::VKEY_Y);
EXPECT_EQ("y", sm_.GetNextUtterance());
// Auto completions.
sm_.ExpectSpeech("xy search");
sm_.ExpectSpeech("List item");
sm_.ExpectSpeech("1 of 1");
SendKeyPress(ui::VKEY_Z);
EXPECT_EQ("z", sm_.GetNextUtterance());
sm_.Replay();
SendKeyPress(ui::VKEY_BACK);
EXPECT_EQ("z", sm_.GetNextUtterance());
}
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusShelf) {
......@@ -348,7 +339,9 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, FocusShelf) {
// Verifies that pressing right arrow button with search button should move
// focus to the next ShelfItem instead of the last one
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ShelfIconFocusForward) {
// (see https://crbug.com/947683).
// This test is flaky, see http://crbug.com/997628
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_ShelfIconFocusForward) {
const std::string title("MockApp");
ChromeLauncherController* controller = ChromeLauncherController::instance();
......@@ -360,31 +353,41 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ShelfIconFocusForward) {
ash::ShelfID("FakeApp"), controller->shelf_model()->item_count(),
base::ASCIIToUTF16(title));
// Wait for the change on ShelfModel to reach ash.
base::RunLoop().RunUntilIdle();
// Focus on the shelf.
sm_.Call([this]() { PerformAcceleratorAction(ash::FOCUS_SHELF); });
sm_.ExpectSpeech("Launcher");
sm_.ExpectSpeech("Button");
sm_.ExpectSpeech("Shelf");
sm_.ExpectSpeech("Tool bar");
EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF));
while (true) {
std::string utterance = sm_.GetNextUtterance();
if (base::MatchPattern(utterance, "Launcher"))
break;
}
ASSERT_EQ("Button", sm_.GetNextUtterance());
ASSERT_EQ("Shelf", sm_.GetNextUtterance());
ASSERT_EQ("Tool bar", sm_.GetNextUtterance());
ASSERT_EQ(", window", sm_.GetNextUtterance());
ASSERT_EQ("Press Search plus Space to activate", sm_.GetNextUtterance());
// Verifies that pressing right key with search key should move the focus of
// ShelfItem correctly.
sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_RIGHT); });
// Chromium or Google Chrome button here (not being tested).
sm_.ExpectSpeech("Button");
sm_.ExpectSpeech("Shelf");
sm_.ExpectSpeech("Tool bar");
sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_RIGHT); });
sm_.ExpectSpeech("MockApp");
sm_.ExpectSpeech("Button");
sm_.Replay();
SendKeyPressWithSearch(ui::VKEY_RIGHT);
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "*"));
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "Button"));
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "*"));
SendKeyPressWithSearch(ui::VKEY_RIGHT);
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), title));
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "Button"));
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "*"));
}
// Verifies that speaking text under mouse works for Shelf button and voice
// announcements should not be stacked when mouse goes over many Shelf buttons
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, SpeakingTextUnderMouseForShelfItem) {
// (see https://crbug.com/958120 and https://crbug.com/921182).
// TODO(crbug.com/921182): Fix test correctness/reliability and re-enable.
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest,
DISABLED_SpeakingTextUnderMouseForShelfItem) {
// Add the ShelfItem to the ShelfModel after enabling the ChromeVox. Because
// when an extension is enabled, the ShelfItems which are not recorded as
// pinned apps in user preference will be removed.
......@@ -402,6 +405,7 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, SpeakingTextUnderMouseForShelfItem) {
controller->CreateAppShortcutLauncherItem(
ash::ShelfID(app_id), base_index + i, base::ASCIIToUTF16(app_title));
}
base::RunLoop().RunUntilIdle();
// Enable the function of speaking text under mouse.
ash::EventRewriterController::Get()->SetSendMouseEventsToDelegate(true);
......@@ -409,26 +413,45 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, SpeakingTextUnderMouseForShelfItem) {
// Focus on the Shelf because voice text for focusing on Shelf is fixed. Wait
// until voice announcements are finished.
EXPECT_TRUE(PerformAcceleratorAction(ash::FOCUS_SHELF));
sm_.ExpectSpeechPattern("Launcher");
while (true) {
std::string utterance = sm_.GetNextUtterance();
if (base::MatchPattern(utterance, "Launcher"))
break;
}
ASSERT_EQ("Button", sm_.GetNextUtterance());
ASSERT_EQ("Shelf", sm_.GetNextUtterance());
ASSERT_EQ("Tool bar", sm_.GetNextUtterance());
ASSERT_EQ(", window", sm_.GetNextUtterance());
ASSERT_EQ("Press Search plus Space to activate", sm_.GetNextUtterance());
// Hover mouse on the Shelf button. Verifies that text under mouse is spoken.
sm_.Call([this]() {
ash::ShelfView* shelf_view =
ash::Shelf::ForWindow(ash::Shell::Get()->GetPrimaryRootWindow())
->shelf_widget()
->shelf_view_for_testing();
const int first_app_index =
shelf_view->model()->GetItemIndexForType(ash::TYPE_PINNED_APP);
SendMouseMoveTo(shelf_view->view_model()
->view_at(first_app_index)
->GetBoundsInScreen()
.CenterPoint());
});
sm_.ExpectSpeechPattern("MockApp*");
sm_.ExpectSpeech("Button");
ash::ShelfView* shelf_view =
ash::Shelf::ForWindow(ash::Shell::Get()->GetPrimaryRootWindow())
->shelf_widget()
->shelf_view_for_testing();
const int first_app_index =
shelf_view->model()->GetItemIndexForType(ash::TYPE_PINNED_APP);
SendMouseMoveTo(shelf_view->view_model()
->view_at(first_app_index)
->GetBoundsInScreen()
.CenterPoint());
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "MockApp0"));
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "Button"));
sm_.Replay();
// Move mouse to the third Shelf button through the second one. Verifies that
// only the last Shelf button is announced by ChromeVox.
const int second_app_index = first_app_index + 1;
SendMouseMoveTo(shelf_view->view_model()
->view_at(second_app_index)
->GetBoundsInScreen()
.CenterPoint());
const int third_app_index = first_app_index + 2;
SendMouseMoveTo(shelf_view->view_model()
->view_at(third_app_index)
->GetBoundsInScreen()
.CenterPoint());
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "MockApp2"));
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "Button"));
}
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OpenStatusTray) {
......@@ -447,54 +470,88 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OpenStatusTray) {
// Fails on ASAN. See http://crbug.com/776308 . (Note MAYBE_ doesn't work well
// with parameterized tests).
#if !defined(ADDRESS_SANITIZER)
#if !defined(ADDRESS_SANITIZER) && !defined(OS_CHROMEOS)
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, NavigateSystemTray) {
EnableChromeVox();
sm_.Call(
[this]() { (PerformAcceleratorAction(ash::TOGGLE_SYSTEM_TRAY_BUBBLE)); });
sm_.ExpectSpeechPattern(
"Quick Settings, Press search plus left to access the notification "
"center., window");
EXPECT_TRUE(PerformAcceleratorAction(ash::TOGGLE_SYSTEM_TRAY_BUBBLE));
while (true) {
std::string utterance = sm_.GetNextUtterance();
if (base::MatchPattern(utterance, "Status tray,"))
break;
}
while (true) {
std::string utterance = sm_.GetNextUtterance();
if (base::MatchPattern(utterance, "*window"))
break;
}
sm_.Call([this]() { SendKeyPress(ui::VKEY_TAB); });
sm_.ExpectSpeech(GetParam() == kTestAsGuestUser ? "Exit guest" : "Sign out");
sm_.ExpectSpeech("Button");
SendKeyPress(ui::VKEY_TAB);
while (true) {
std::string utterance = sm_.GetNextUtterance();
if (base::MatchPattern(utterance, "Button"))
break;
}
// Next element.
SendKeyPressWithSearch(ui::VKEY_RIGHT);
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "*"));
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "Button"));
// Next button.
sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_B); });
sm_.ExpectSpeech("Shut down");
sm_.ExpectSpeech("Button");
SendKeyPressWithSearch(ui::VKEY_B);
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "*"));
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "Button"));
sm_.Replay();
// Navigate to Bluetooth sub-menu and open it.
while (true) {
SendKeyPress(ui::VKEY_TAB);
std::string content = sm_.GetNextUtterance();
std::string role = sm_.GetNextUtterance();
if (base::MatchPattern(content, "*Bluetooth*") &&
base::MatchPattern(role, "Button"))
break;
}
SendKeyPress(ui::VKEY_RETURN);
// Navigate to return to previous menu button and press it.
while (true) {
std::string utterance = sm_.GetNextUtterance();
if (base::MatchPattern(utterance, "Previous menu"))
break;
SendKeyPress(ui::VKEY_TAB);
}
SendKeyPress(ui::VKEY_RETURN);
while (true) {
std::string utterance = sm_.GetNextUtterance();
if (base::MatchPattern(utterance, "Bluetooth*"))
break;
}
}
#endif // !defined(ADDRESS_SANITIZER)
#endif // !defined(ADDRESS_SANITIZER) && !defined(OS_CHROMEOS)
// TODO: these brightness announcements are actually not made.
// https://crbug.com/1064788
// See http://crbug.com/443608
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_ScreenBrightness) {
EnableChromeVox();
sm_.Call([this]() { (PerformAcceleratorAction(ash::BRIGHTNESS_UP)); });
sm_.ExpectSpeechPattern("Brightness * percent");
sm_.Call([this]() { (PerformAcceleratorAction(ash::BRIGHTNESS_DOWN)); });
sm_.ExpectSpeechPattern("Brightness * percent");
EXPECT_TRUE(PerformAcceleratorAction(ash::BRIGHTNESS_UP));
EXPECT_TRUE(
base::MatchPattern(sm_.GetNextUtterance(), "Brightness * percent"));
sm_.Replay();
EXPECT_TRUE(PerformAcceleratorAction(ash::BRIGHTNESS_DOWN));
EXPECT_TRUE(
base::MatchPattern(sm_.GetNextUtterance(), "Brightness * percent"));
}
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, VolumeSlider) {
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_VolumeSlider) {
EnableChromeVox();
sm_.Call([this]() {
// Volume slider does not fire valueChanged event on first key press because
// it has no widget.
PerformAcceleratorAction(ash::VOLUME_UP);
PerformAcceleratorAction(ash::VOLUME_UP);
});
sm_.ExpectSpeechPattern("* percent*");
sm_.Replay();
// Volume slider does not fire valueChanged event on first key press because
// it has no widget.
EXPECT_TRUE(PerformAcceleratorAction(ash::VOLUME_UP));
EXPECT_TRUE(PerformAcceleratorAction(ash::VOLUME_UP));
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "* percent*"));
}
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OverviewMode) {
......@@ -519,108 +576,129 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OverviewMode) {
}
}
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxFindInPage) {
#if defined(MEMORY_SANITIZER) || defined(OS_CHROMEOS)
// Fails under MemorySanitizer: http://crbug.com/472125
// Test is flaky under ChromeOS: http://crbug.com/897249
#define MAYBE_ChromeVoxShiftSearch DISABLED_ChromeVoxShiftSearch
#else
#define MAYBE_ChromeVoxShiftSearch ChromeVoxShiftSearch
#endif
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxShiftSearch) {
EnableChromeVox();
ui_test_utils::NavigateToURL(
browser(),
GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>"));
sm_.ExpectSpeech("Click me");
while (true) {
std::string utterance = sm_.GetNextUtterance();
if (utterance == "Click me")
break;
}
// Press Search+/ to enter ChromeVox's "find in page".
SendKeyPressWithSearch(ui::VKEY_OEM_2);
sm_.ExpectSpeech("Find in page");
sm_.Replay();
while (true) {
std::string utterance = sm_.GetNextUtterance();
if (utterance == "Find in page")
break;
}
}
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxNavigateAndSelect) {
#if defined(MEMORY_SANITIZER) || defined(OS_CHROMEOS)
// Fails under MemorySanitizer: http://crbug.com/472125
// TODO(crbug.com/721475): Flaky on CrOS.
#define MAYBE_ChromeVoxNavigateAndSelect DISABLED_ChromeVoxNavigateAndSelect
#else
#define MAYBE_ChromeVoxNavigateAndSelect ChromeVoxNavigateAndSelect
#endif
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxNavigateAndSelect) {
EnableChromeVox();
ui_test_utils::NavigateToURL(browser(),
GURL("data:text/html;charset=utf-8,"
"<h1>Title</h1>"
"<button autofocus>Click me</button>"));
sm_.ExpectSpeech("Click me");
while (true) {
std::string utterance = sm_.GetNextUtterance();
if (utterance == "Click me")
break;
}
EXPECT_EQ("Button", sm_.GetNextUtterance());
// Press Search+Left to navigate to the previous item.
sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_LEFT); });
sm_.ExpectSpeech("Title");
sm_.ExpectSpeech("Heading 1");
SendKeyPressWithSearch(ui::VKEY_LEFT);
EXPECT_EQ("Title", sm_.GetNextUtterance());
EXPECT_EQ("Heading 1", sm_.GetNextUtterance());
// Press Search+S to select the text.
sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_S); });
sm_.ExpectSpeech("Title");
sm_.ExpectSpeech("selected");
SendKeyPressWithSearch(ui::VKEY_S);
EXPECT_EQ("Title", sm_.GetNextUtterance());
EXPECT_EQ("selected", sm_.GetNextUtterance());
// Press again to end the selection.
sm_.Call([this]() { SendKeyPressWithSearch(ui::VKEY_S); });
sm_.ExpectSpeech("End selection");
sm_.Replay();
SendKeyPressWithSearch(ui::VKEY_S);
EXPECT_EQ("End selection", sm_.GetNextUtterance());
EXPECT_EQ("Title", sm_.GetNextUtterance());
}
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxStickyMode) {
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_ChromeVoxNextStickyMode) {
EnableChromeVox();
ui_test_utils::NavigateToURL(
browser(),
GURL("data:text/html;charset=utf-8,<button autofocus>Click me</button>"));
sm_.ExpectSpeech("Click me");
while ("Button" != sm_.GetNextUtterance()) {
}
// Press the sticky-key sequence: Search Search.
sm_.Call([this]() {
SendKeyPress(ui::VKEY_LWIN);
// Sticky key has a minimum 100 ms check to prevent key repeat from toggling
// it.
base::PostDelayedTask(
FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(&LoggedInSpokenFeedbackTest::SendKeyPress,
base::Unretained(this), ui::VKEY_LWIN),
base::TimeDelta::FromMilliseconds(200));
});
SendKeyPress(ui::VKEY_LWIN);
sm_.ExpectSpeech("Sticky mode enabled");
// Sticky key has a minimum 100 ms check to prevent key repeat from toggling
// it.
base::PostDelayedTask(
FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(&LoggedInSpokenFeedbackTest::SendKeyPress,
base::Unretained(this), ui::VKEY_LWIN),
base::TimeDelta::FromMilliseconds(200));
sm_.Call([this]() { SendKeyPress(ui::VKEY_H); });
sm_.ExpectSpeech("No next heading");
EXPECT_EQ("Sticky mode enabled", sm_.GetNextUtterance());
sm_.Call([this]() {
SendKeyPress(ui::VKEY_LWIN);
// Sticky key has a minimum 100 ms check to prevent key repeat from toggling
// it.
base::PostDelayedTask(
FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(&LoggedInSpokenFeedbackTest::SendKeyPress,
base::Unretained(this), ui::VKEY_LWIN),
base::TimeDelta::FromMilliseconds(200));
});
sm_.ExpectSpeech("Sticky mode disabled");
SendKeyPress(ui::VKEY_H);
while ("No next heading" != sm_.GetNextUtterance()) {
}
sm_.Replay();
SendKeyPress(ui::VKEY_LWIN);
// Sticky key has a minimum 100 ms check to prevent key repeat from toggling
// it.
base::PostDelayedTask(
FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(&LoggedInSpokenFeedbackTest::SendKeyPress,
base::Unretained(this), ui::VKEY_LWIN),
base::TimeDelta::FromMilliseconds(200));
while ("Sticky mode disabled" != sm_.GetNextUtterance()) {
}
}
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreStatusTray) {
// Flaky on Linux ChromiumOS MSan Tests. https://crbug.com/752427
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, DISABLED_TouchExploreStatusTray) {
EnableChromeVox();
SimulateTouchScreenInChromeVox();
// Send an accessibility hover event on the system tray, which is
// what we get when you tap it on a touch screen when ChromeVox is on.
sm_.Call([]() {
ash::TrayBackgroundView* tray = ash::Shell::Get()
->GetPrimaryRootWindowController()
->GetStatusAreaWidget()
->unified_system_tray();
tray->NotifyAccessibilityEvent(ax::mojom::Event::kHover, true);
});
sm_.ExpectSpeechPattern("Status tray, time* Battery at* percent*");
sm_.ExpectSpeech("Button");
sm_.Replay();
ash::TrayBackgroundView* tray = ash::Shell::Get()
->GetPrimaryRootWindowController()
->GetStatusAreaWidget()
->unified_system_tray();
tray->NotifyAccessibilityEvent(ax::mojom::Event::kHover, true);
EXPECT_EQ("Status tray,", sm_.GetNextUtterance());
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "time*,"));
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "Battery*"));
EXPECT_EQ("Button", sm_.GetNextUtterance());
}
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxNextTabRecovery) {
......@@ -714,22 +792,66 @@ class OobeSpokenFeedbackTest : public LoginManagerTest {
DISALLOW_COPY_AND_ASSIGN(OobeSpokenFeedbackTest);
};
IN_PROC_BROWSER_TEST_F(OobeSpokenFeedbackTest, SpokenFeedbackInOobe) {
// Test is flaky: http://crbug.com/346797
IN_PROC_BROWSER_TEST_F(OobeSpokenFeedbackTest, DISABLED_SpokenFeedbackInOobe) {
ui_controls::EnableUIControls();
ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
AccessibilityManager::Get()->EnableSpokenFeedback(true);
// The Let's go button gets initial focus.
sm_.ExpectSpeech("Let's go");
LoginDisplayHost* login_display_host = LoginDisplayHost::default_host();
WebUILoginView* web_ui_login_view = login_display_host->GetWebUILoginView();
views::Widget* widget = web_ui_login_view->GetWidget();
gfx::NativeWindow window = widget->GetNativeWindow();
sm_.Call([]() {
ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
nullptr, ui::VKEY_TAB, false, false, false, false));
});
sm_.ExpectSpeech("Shut down");
sm_.ExpectSpeech("Button");
// We expect to be in the language select dropdown for this test to work,
// so make sure that's the case.
test::OobeJS().ExecuteAsync("$('language-select').focus()");
AccessibilityManager::Get()->EnableSpokenFeedback(true);
ASSERT_TRUE(sm_.SkipChromeVoxEnabledMessage());
// There's no guarantee that ChromeVox speaks anything when injected after
// the page loads, which is by design. Tab forward and then backward
// 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 (sm_.GetNextUtterance() != "Select your keyboard:") {
}
EXPECT_EQ("U S", sm_.GetNextUtterance());
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "Combo box * of *"));
ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
window, ui::VKEY_TAB, false, true /*shift*/, false, false));
while (sm_.GetNextUtterance() != "Select your language:") {
}
EXPECT_EQ("English ( United States)", sm_.GetNextUtterance());
EXPECT_TRUE(base::MatchPattern(sm_.GetNextUtterance(), "Combo box * of *"));
}
sm_.Replay();
// This test is flaky (https://crbug.com/1013551).
IN_PROC_BROWSER_TEST_F(OobeSpokenFeedbackTest,
DISABLED_ChromeVoxPanelTabsMenuEmpty) {
// The ChromeVox panel should not populate the tabs menu if we are in the
// OOBE.
ASSERT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
AccessibilityManager::Get()->EnableSpokenFeedback(true);
// Included to reduce flakiness.
while (sm_.GetNextUtterance() != "Press Search plus Space to activate") {
}
// Press [search + .] to open ChromeVox Panel
ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
nullptr, ui::VKEY_OEM_PERIOD, false, false, false, true));
while (sm_.GetNextUtterance() != "ChromeVox Panel") {
}
// Go to tabs menu and verify that it has no items.
ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
nullptr, ui::VKEY_RIGHT, false, false, false, false));
while (sm_.GetNextUtterance() != "Speech") {
}
ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync(
nullptr, ui::VKEY_RIGHT, false, false, false, false));
while (sm_.GetNextUtterance() != "Tabs") {
}
EXPECT_EQ("Menu", sm_.GetNextUtterance());
EXPECT_EQ("No items", sm_.GetNextUtterance());
}
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest,
......
......@@ -29,7 +29,6 @@ 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