Index: chrome/browser/resources/chromeos/chromevox/testing/mock_tts.js |
diff --git a/chrome/browser/resources/chromeos/chromevox/testing/mock_tts.js b/chrome/browser/resources/chromeos/chromevox/testing/mock_tts.js |
index b41c0ad345f499e220b028cafba498ac10a57d31..0915e1120218ccf763628557b16e296418f22ab2 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/testing/mock_tts.js |
+++ b/chrome/browser/resources/chromeos/chromevox/testing/mock_tts.js |
@@ -8,6 +8,11 @@ |
* @extends {cvox.TtsInterface} |
*/ |
var MockTts = function() { |
+ /** |
+ * The event handler for the most recent call to |speak|. |
+ * @private |
+ */ |
+ this.onEvent_; |
}; |
MockTts.prototype = { |
@@ -29,6 +34,9 @@ MockTts.prototype = { |
/** @override */ |
speak: function(textString, queueMode, properties) { |
+ if (properties) |
+ this.onEvent_ = properties['onEvent']; |
+ |
this.process_(textString); |
}, |
@@ -69,6 +77,22 @@ MockTts.prototype = { |
}, |
/** |
+ * Fakes an event to |onEvent|. |
+ */ |
+ sendStartEvent: function() { |
+ if (this.onEvent_) |
+ this.onEvent_({type: 'start'}); |
+ }, |
+ |
+ /** |
+ * Fakes an event to |onEvent|. |
+ */ |
+ sendEndEvent: function() { |
+ if (this.onEvent_) |
+ this.onEvent_({type: 'end'}); |
+ }, |
+ |
+ /** |
* @private |
* @param {string} expectedText Text expected spoken. |
* @param {{startCallback: function() : void, |