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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/testing/mock_tts.js

Issue 938623003: Fix ChromeVox next tests to fail instead of timing out where applicable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify async callback handling in the tests. Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/testing/chromevox_unittest_base.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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() {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 expectSpeechAfter: function(expectedText, opt_callback, opt_exact) { 55 expectSpeechAfter: function(expectedText, opt_callback, opt_exact) {
56 var expectation = {}; 56 var expectation = {};
57 if (this.expectations_.length == 0 && opt_callback) 57 if (this.expectations_.length == 0 && opt_callback)
58 opt_callback(); 58 opt_callback();
59 else 59 else
60 expectation.startCallback = opt_callback; 60 expectation.startCallback = opt_callback;
61 this.addExpectation_(expectedText, expectation, opt_exact); 61 this.addExpectation_(expectedText, expectation, opt_exact);
62 }, 62 },
63 63
64 /** 64 /**
65 * Finishes expectations and calls testDone. 65 * Finishes expectations and calls {@code callback} afterwards.
66 * @param {Function} callback
66 */ 67 */
67 finishExpectations: function() { 68 finishExpectations: function(callback) {
68 this.expectSpeechAfter('', testDone); 69 this.expectSpeechAfter('', callback);
69 }, 70 },
70 71
71 /** 72 /**
72 * @private 73 * @private
73 * @param {string} expectedText Text expected spoken. 74 * @param {string} expectedText Text expected spoken.
74 * @param {{startCallback: function() : void, 75 * @param {{startCallback: function() : void,
75 * endCallback: function() : void}=} opt_expectation 76 * endCallback: function() : void}=} opt_expectation
76 * @param {boolean=} opt_exact Expects an exact match. 77 * @param {boolean=} opt_exact Expects an exact match.
77 */ 78 */
78 addExpectation_: function(expectedText, opt_expectation, opt_exact) { 79 addExpectation_: function(expectedText, opt_expectation, opt_exact) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 matchingProperties.endCallback(); 122 matchingProperties.endCallback();
122 } 123 }
123 var nextExpectation = this.expectations_[0]; 124 var nextExpectation = this.expectations_[0];
124 if (nextExpectation && nextExpectation.startCallback) 125 if (nextExpectation && nextExpectation.startCallback)
125 nextExpectation.startCallback(); 126 nextExpectation.startCallback();
126 } else { 127 } else {
127 this.expectations_.unshift(targetExpectation); 128 this.expectations_.unshift(targetExpectation);
128 } 129 }
129 }, 130 },
130 }; 131 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/testing/chromevox_unittest_base.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698