Commit 943d55db authored by dmazzoni's avatar dmazzoni Committed by Commit bot

Port event watcher ChromeVox tests.

BUG=371692

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

Cr-Commit-Position: refs/heads/master@{#296259}
parent 59d5d59f
......@@ -140,6 +140,7 @@
'common/page_selection_test.unitjs',
'common/selection_util_test.unitjs',
'common/spannable_test.unitjs',
'chromevox/injected/event_watcher_test.unitjs',
'chromevox/injected/live_regions_test.unitjs',
'host/chrome/braille_display_manager_test.unitjs',
'host/chrome/braille_input_handler_test.unitjs',
......
......@@ -29,6 +29,13 @@ function ChromeVoxUnitTestBase() {}
ChromeVoxUnitTestBase.prototype = {
__proto__: testing.Test.prototype,
/** @override */
closureModuleDeps: [
'cvox.ChromeVoxTester',
'cvox.ChromeVoxUserCommands',
'cvox.SpokenListBuilder',
],
/** @override */
browsePreload: DUMMY_URL,
......@@ -140,6 +147,18 @@ ChromeVoxUnitTestBase.prototype = {
return this; // for chaining.
},
/**
* Asserts the TTS engine spoke a certain string. Clears the TTS buffer.
* @param {string} expectedText The expected text.
* @return {ChromeVoxUnitTestBase} this.
*/
assertSpoken: function(expectedText) {
assertEquals(expectedText,
cvox.ChromeVoxTester.testTts().getUtterancesAsString());
cvox.ChromeVoxTester.clearUtterances();
return this; // for chaining.
},
/**
* Asserts a list of utterances are in the correct queue mode.
* @param {cvox.SpokenListBuilder|Array} expectedList A list
......@@ -167,5 +186,32 @@ ChromeVoxUnitTestBase.prototype = {
expectedText, expectedQueueMode, text, queueMode) {
assertEquals(expectedQueueMode, queueMode);
assertEquals(expectedText, text);
},
/**
* Focuses an element.
* @param {string} id The id of the element to focus.
* @return {ChromeVoxUnitTestBase} this.
*/
setFocus: function(id) {
$(id).focus();
return this; // for chaining.
},
/**
* Executes a ChromeVox user command.
* @param {string} command The name of the command to run.
* @return {ChromeVoxUnitTestBase} this.
*/
userCommand: function(command) {
cvox.ChromeVoxUserCommands.commands[command]();
return this; // for chaining.
},
/**
* @return {cvox.SpokenListBuilder} A new builder.
*/
spokenList: function() {
return new cvox.SpokenListBuilder();
}
};
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