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

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

Issue 1457683009: Complete live region support in ChromeVox Next. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed last feedback Created 5 years 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
Index: chrome/browser/resources/chromeos/chromevox/testing/mock_feedback.js
diff --git a/chrome/browser/resources/chromeos/chromevox/testing/mock_feedback.js b/chrome/browser/resources/chromeos/chromevox/testing/mock_feedback.js
index 4c846e8f7f433b8b5d299d7db85a741645380192..ec90c105c03f57fea8f6ff07b706170710936400 100644
--- a/chrome/browser/resources/chromeos/chromevox/testing/mock_feedback.js
+++ b/chrome/browser/resources/chromeos/chromevox/testing/mock_feedback.js
@@ -160,6 +160,55 @@ MockFeedback.prototype = {
},
/**
+ * Adds an expectation for one spoken utterance that will be enqueued
+ * with a given queue mode.
+ * @param {string|RegExp} text One utterance expectation.
+ * @param {cvox.QueueMode} queueMode The expected queue mode.
+ * @return {MockFeedback} |this| for chaining
+ */
+ expectSpeechWithQueueMode: function(text, queueMode) {
+ assertFalse(this.replaying_);
+ this.pendingActions_.push({
+ perform: function() {
+ return !!MockFeedback.matchAndConsume_(
+ text, {queueMode: queueMode}, this.pendingUtterances_);
+ }.bind(this),
+ toString: function() {
+ return 'Speak \'' + text + '\' with mode ' + queueMode;
+ }
+ });
+ return this;
+ },
+
+ /**
+ * Adds an expectation for one spoken utterance that will be queued.
+ * @param {string|RegExp} text One utterance expectation.
+ * @return {MockFeedback} |this| for chaining
+ */
+ expectQueuedSpeech: function(text) {
+ return this.expectSpeechWithQueueMode(text, cvox.QueueMode.QUEUE);
+ },
+
+ /**
+ * Adds an expectation for one spoken utterance that will be flushed.
+ * @param {string|RegExp} text One utterance expectation.
+ * @return {MockFeedback} |this| for chaining
+ */
+ expectFlushingSpeech: function(text) {
+ return this.expectSpeechWithQueueMode(text, cvox.QueueMode.FLUSH);
+ },
+
+ /**
+ * Adds an expectation for one spoken utterance that will be queued
+ * with the category flush mode.
+ * @param {string|RegExp} text One utterance expectation.
+ * @return {MockFeedback} |this| for chaining
+ */
+ expectCategoryFlushSpeech: function(text) {
+ return this.expectSpeechWithQueueMode(text, cvox.QueueMode.CATEGORY_FLUSH);
+ },
+
+ /**
* Adds an expectation that the next spoken utterances do *not* match
* the given arguments.
*
@@ -299,6 +348,7 @@ MockFeedback.prototype = {
}
this.pendingUtterances_.push(
{text: textString,
+ queueMode: queueMode,
callback: callback});
this.process_();
},

Powered by Google App Engine
This is Rietveld 408576698