Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3530)

Unified Diff: chrome/browser/resources/chromeos/chromevox/testing/chromevox_unittest_base.js

Issue 595633002: Port event watcher ChromeVox tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@live_regions
Patch Set: Fix async issues Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/chromevox_tests.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/chromevox/testing/chromevox_unittest_base.js
diff --git a/chrome/browser/resources/chromeos/chromevox/testing/chromevox_unittest_base.js b/chrome/browser/resources/chromeos/chromevox/testing/chromevox_unittest_base.js
index 0e598a0a57bd8ee0448309584cc091324108e947..1f5c96d32b4d289aadbbeb8e42ab98c2ee1b546b 100644
--- a/chrome/browser/resources/chromeos/chromevox/testing/chromevox_unittest_base.js
+++ b/chrome/browser/resources/chromeos/chromevox/testing/chromevox_unittest_base.js
@@ -30,6 +30,13 @@ ChromeVoxUnitTestBase.prototype = {
__proto__: testing.Test.prototype,
/** @override */
+ closureModuleDeps: [
+ 'cvox.ChromeVoxTester',
+ 'cvox.ChromeVoxUserCommands',
+ 'cvox.SpokenListBuilder',
+ ],
+
+ /** @override */
browsePreload: DUMMY_URL,
/**
@@ -141,6 +148,18 @@ ChromeVoxUnitTestBase.prototype = {
},
/**
+ * 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
* of [text, queueMode] tuples OR a SpokenListBuilder with the expected
@@ -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();
}
};
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/chromevox_tests.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698