Chromium Code Reviews| 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 795f268bc20ceb8bea6010ff034b15cc067df925..bf5d2b25bad939da977a793736fcf93360eb398f 100644 |
| --- a/chrome/browser/resources/chromeos/chromevox/testing/mock_feedback.js |
| +++ b/chrome/browser/resources/chromeos/chromevox/testing/mock_feedback.js |
| @@ -141,6 +141,32 @@ MockFeedback.prototype = { |
| }, |
| /** |
| + * Adds an expectation that the next spoken utterances do *not* match |
| + * the given arguments. |
| + * @param {...(string|RegExp)} var_args One or more utterance to add as |
|
Peter Lundblad
2015/08/26 18:42:37
One or more utterances.
|
| + * negative expectations. |
| + * @return {MockFeedback} |this| for chaining |
| + */ |
| + expectNextSpeechUtteranceIsNot: function() { |
| + assertFalse(this.replaying_); |
| + Array.prototype.forEach.call(arguments, function(text) { |
| + this.pendingActions_.push({ |
| + perform: function() { |
| + if (this.pendingUtterances_.length == 0) |
| + return false; |
| + if (MockFeedback.matchAndConsume_( |
| + text, {}, this.pendingUtterances_)) { |
| + throw new Error('Got disallowed utterance "' + text + '".'); |
| + } |
| + return true; |
| + }.bind(this), |
| + toString: function() { return 'Do not speak \'' + text + '\''; } |
| + }); |
| + }.bind(this)); |
| + return this; |
| + }, |
| + |
| + /** |
| * Adds an expectation for braille output. |
| * @param {string|RegExp} text |
| * @param {Object=} opt_props Additional properties to match in the |