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

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

Issue 596033002: Entering / exiting dialog notification should not interrupt live region. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@event_watcher_tests
Patch Set: Use map and filter 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/host/interface/tts_interface.js ('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/host/testing/tts.js
diff --git a/chrome/browser/resources/chromeos/chromevox/host/testing/tts.js b/chrome/browser/resources/chromeos/chromevox/host/testing/tts.js
index bff32f281e56a50eb3068a11c2ff2452ff5fbb5e..956cdc49d4efb08c2ceba8fbc9b608bcf8cd2acc 100644
--- a/chrome/browser/resources/chromeos/chromevox/host/testing/tts.js
+++ b/chrome/browser/resources/chromeos/chromevox/host/testing/tts.js
@@ -37,7 +37,9 @@ cvox.TestTts.prototype.sentinelText_ = '@@@STOP@@@';
* @override
*/
cvox.TestTts.prototype.speak = function(text, queueMode, opt_properties) {
- this.utterances_.push({text: text, queueMode: queueMode});
+ this.utterances_.push({text: text,
+ queueMode: queueMode,
+ properties: opt_properties});
if (opt_properties && opt_properties['endCallback'] != undefined) {
var len = this.utterances_.length;
// 'After' is a sentinel value in the tests that tells TTS to stop and
@@ -82,6 +84,39 @@ cvox.TestTts.prototype.getUtterancesAsString = function() {
};
/**
+ * Processes the utterances spoken the same way the speech queue does,
+ * as if they were all generated one after another, with no delay between
+ * them, and returns a list of strings that would be output.
+ *
+ * For example, if two strings were spoken with a queue mode of FLUSH,
+ * only the second string will be returned.
+ * @return {Array.<string>} A list of strings representing the speech output.
+ */
+cvox.TestTts.prototype.getSpeechQueueOutput = function() {
+ var queue = [];
+ for (var i = 0; i < this.utterances_.length; i++) {
+ var utterance = this.utterances_[i];
+ switch (utterance.queueMode) {
+ case cvox.AbstractTts.QUEUE_MODE_FLUSH:
+ queue = [];
+ break;
+ case cvox.AbstractTts.QUEUE_MODE_QUEUE:
+ break;
+ case cvox.AbstractTts.QUEUE_MODE_CATEGORY_FLUSH:
+ queue = queue.filter(function(u) {
+ return (utterance.properties && utterance.properties.category) &&
+ (!u.properties ||
+ u.properties.category != utterance.properties.category);
+ });
+ break;
+ }
+ queue.push(utterance);
+ }
+
+ return queue.map(function(u) { return u.text; });
+};
+
+/**
* Return a list of strings of what was spoken by tts.speak().
* @return {Array.<string>} A list of all utterances spoken since
* initialization or the last call to clearUtterances.
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/host/interface/tts_interface.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698