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

Add test coverage for ChromeVox api

Bug: 
Change-Id: I8b4c002427f14426753e6a4ddc083e50a33cb985
Reviewed-on: https://chromium-review.googlesource.com/847896
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarAaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#527035}
parent 94bc3e41
...@@ -673,6 +673,47 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxNextTabRecovery) { ...@@ -673,6 +673,47 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxNextTabRecovery) {
} }
} }
IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, ChromeVoxApi) {
EnableChromeVox();
ui_test_utils::NavigateToURL(
browser(),
GURL("data:text/html;charset=utf-8,"
"<script>"
" var output = [];"
" document.addEventListener('chromeVoxLoaded', function() {"
" output.push('load');"
" cvox.Api.speak(output.join(' '));"
" });"
" document.addEventListener('chromeVoxUnloaded', function() {"
" output.push('unload');"
" });"
"</script>"));
// At this point, ChromeVox loads, followed by the page load which will fire a
// chromeVoxLoaded event. The page signals back with a 'load' utterance.
while (true) {
std::string utterance = speech_monitor_.GetNextUtterance();
if (utterance == "load")
break;
}
// Unload ChromeVox, which should trigger the chromeVoxUnloaded event.
AccessibilityManager::Get()->EnableSpokenFeedback(
false, ash::A11Y_NOTIFICATION_NONE);
// Re-enable ChromeVox here, and check all three events were seen by the
// page. Note this exercises a slightly different codepath. Dynamic after
// page load injection whereas before we tested on load injection.
AccessibilityManager::Get()->EnableSpokenFeedback(
true, ash::A11Y_NOTIFICATION_NONE);
while (true) {
std::string utterance = speech_monitor_.GetNextUtterance();
if (utterance == "load unload load")
break;
}
}
// //
// Spoken feedback tests that run only in guest mode. // Spoken feedback tests that run only in guest mode.
// //
......
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