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

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

Issue 1318683002: Make cvox2 feedback more robust when focusing a text field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mock_feedback
Patch Set: EditableTextBase expects start < end Created 5 years, 3 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/cvox2/background/background_test.extjs ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 * @fileoverview This file contains the |MockFeedback| class which is a 6 * @fileoverview This file contains the |MockFeedback| class which is a
7 * combined mock class for speech and braille feedback. A test that uses 7 * combined mock class for speech and braille feedback. A test that uses
8 * this class may add expectations for speech utterances and braille display 8 * this class may add expectations for speech utterances and braille display
9 * content to be output. The |install| method sets appropriate mock classes 9 * content to be output. The |install| method sets appropriate mock classes
10 * as the |cvox.ChromeVox.tts| and |cvox.ChromeVox.braille| objects, 10 * as the |cvox.ChromeVox.tts| and |cvox.ChromeVox.braille| objects,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 return !!MockFeedback.matchAndConsume_( 134 return !!MockFeedback.matchAndConsume_(
135 text, {}, this.pendingUtterances_); 135 text, {}, this.pendingUtterances_);
136 }.bind(this), 136 }.bind(this),
137 toString: function() { return 'Speak \'' + text + '\''; } 137 toString: function() { return 'Speak \'' + text + '\''; }
138 }); 138 });
139 }.bind(this)); 139 }.bind(this));
140 return this; 140 return this;
141 }, 141 },
142 142
143 /** 143 /**
144 * Adds an expectation that the next spoken utterances do *not* match
145 * the given arguments.
146 *
147 * This is only guaranteed to work for the immediately following utterance.
148 * If you use it to check an utterance other than the immediately following
149 * one the results may be flaky.
150 *
151 * @param {...(string|RegExp)} var_args One or more utterance to add as
152 * negative expectations.
153 * @return {MockFeedback} |this| for chaining
154 */
155 expectNextSpeechUtteranceIsNot: function() {
156 assertFalse(this.replaying_);
157 Array.prototype.forEach.call(arguments, function(text) {
158 this.pendingActions_.push({
159 perform: function() {
160 if (this.pendingUtterances_.length == 0)
161 return false;
162 if (MockFeedback.matchAndConsume_(
163 text, {}, this.pendingUtterances_)) {
164 throw new Error('Got disallowed utterance "' + text + '".');
165 }
166 return true;
167 }.bind(this),
168 toString: function() { return 'Do not speak \'' + text + '\''; }
169 });
170 }.bind(this));
171 return this;
172 },
173
174 /**
144 * Adds an expectation for braille output. 175 * Adds an expectation for braille output.
145 * @param {string|RegExp} text 176 * @param {string|RegExp} text
146 * @param {Object=} opt_props Additional properties to match in the 177 * @param {Object=} opt_props Additional properties to match in the
147 * |NavBraille| 178 * |NavBraille|
148 * @return {MockFeedback} |this| for chaining 179 * @return {MockFeedback} |this| for chaining
149 */ 180 */
150 expectBraille: function(text, opt_props) { 181 expectBraille: function(text, opt_props) {
151 assertFalse(this.replaying_); 182 assertFalse(this.replaying_);
152 var props = opt_props || {}; 183 var props = opt_props || {};
153 this.pendingActions_.push({ 184 this.pendingActions_.push({
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 } 354 }
324 if (candidate) { 355 if (candidate) {
325 var consumed = pending.splice(0, i + 1); 356 var consumed = pending.splice(0, i + 1);
326 consumed.forEach(function(item) { 357 consumed.forEach(function(item) {
327 if (item.callback) 358 if (item.callback)
328 item.callback(); 359 item.callback();
329 }); 360 });
330 } 361 }
331 return candidate; 362 return candidate;
332 }; 363 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698