| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Mock tts class. | 6 * Mock tts class. |
| 7 * @constructor | 7 * @constructor |
| 8 * @extends {cvox.TtsInterface} | 8 * @extends {cvox.TtsInterface} |
| 9 */ | 9 */ |
| 10 var MockTts = function() { | 10 var MockTts = function() { |
| 11 /** | 11 /** |
| 12 * The event handler for the most recent call to |speak|. | 12 * The event handler for the most recent call to |speak|. |
| 13 * @private | 13 * @private |
| 14 */ | 14 */ |
| 15 this.onEvent_; | 15 this.onEvent_; |
| 16 }; | 16 }; |
| 17 | 17 |
| 18 MockTts.prototype = { | 18 MockTts.prototype = { |
| 19 /** | 19 /** |
| 20 * A list of predicate, start, and end callbacks for a pending expectation. | 20 * A list of predicate, start, and end callbacks for a pending expectation. |
| 21 * @type {!Array.<{{predicate: function(string) : boolean, | 21 * @type {!Array<{{predicate: function(string) : boolean, |
| 22 * startCallback: function() : void, | 22 * startCallback: function() : void, |
| 23 * endCallback: function() : void}>} | 23 * endCallback: function() : void}>} |
| 24 * @private | 24 * @private |
| 25 */ | 25 */ |
| 26 expectations_: [], | 26 expectations_: [], |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * A list of strings stored whenever there are no expectations. | 29 * A list of strings stored whenever there are no expectations. |
| 30 * @type {!Array.<string} | 30 * @type {!Array<string} |
| 31 * @private | 31 * @private |
| 32 */ | 32 */ |
| 33 idleUtterances_: [], | 33 idleUtterances_: [], |
| 34 | 34 |
| 35 /** @override */ | 35 /** @override */ |
| 36 speak: function(textString, queueMode, properties) { | 36 speak: function(textString, queueMode, properties) { |
| 37 if (properties) | 37 if (properties) |
| 38 this.onEvent_ = properties['onEvent']; | 38 this.onEvent_ = properties['onEvent']; |
| 39 | 39 |
| 40 this.process_(textString); | 40 this.process_(textString); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 if (targetExpectation.endCallback) | 135 if (targetExpectation.endCallback) |
| 136 targetExpectation.endCallback(); | 136 targetExpectation.endCallback(); |
| 137 var nextExpectation = this.expectations_[0]; | 137 var nextExpectation = this.expectations_[0]; |
| 138 if (nextExpectation && nextExpectation.startCallback) | 138 if (nextExpectation && nextExpectation.startCallback) |
| 139 nextExpectation.startCallback(); | 139 nextExpectation.startCallback(); |
| 140 } else { | 140 } else { |
| 141 this.expectations_.unshift(targetExpectation); | 141 this.expectations_.unshift(targetExpectation); |
| 142 } | 142 } |
| 143 }, | 143 }, |
| 144 }; | 144 }; |
| OLD | NEW |