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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/testing/mock_feedback_test.unitjs

Issue 1319093003: Use new earcons in ChromeVox Next. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@automation_node_id_fix_2
Patch Set: Rebase Created 5 years, 2 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/mock_feedback.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 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 // Include test fixture. 5 // Include test fixture.
6 GEN_INCLUDE(['chromevox_unittest_base.js', 6 GEN_INCLUDE(['chromevox_unittest_base.js',
7 'mock_feedback.js']); 7 'mock_feedback.js']);
8 8
9 function speak(text, opt_properties) { 9 function speak(text, opt_properties) {
10 cvox.ChromeVox.tts.speak(text, 0, opt_properties); 10 cvox.ChromeVox.tts.speak(text, 0, opt_properties);
11 } 11 }
12 12
13 function braille(text) { 13 function braille(text) {
14 var navBraille = cvox.NavBraille.fromText(text); 14 var navBraille = cvox.NavBraille.fromText(text);
15 cvox.ChromeVox.braille.write(navBraille); 15 cvox.ChromeVox.braille.write(navBraille);
16 return navBraille; 16 return navBraille;
17 } 17 }
18 18
19 function earcon(earconName) {
20 cvox.ChromeVox.earcons.playEarcon(cvox.Earcon[earconName]);
21 }
22
19 /** 23 /**
20 * Test fixture. 24 * Test fixture.
21 * @constructor 25 * @constructor
22 * @extends {ChromeVoxUnitTestBase} 26 * @extends {ChromeVoxUnitTestBase}
23 */ 27 */
24 function MockFeedbackUnitTest() { 28 function MockFeedbackUnitTest() {
25 ChromeVoxUnitTestBase.call(this); 29 ChromeVoxUnitTestBase.call(this);
26 this.expectedCalls = []; 30 this.expectedCalls = [];
27 } 31 }
28 32
29 MockFeedbackUnitTest.prototype = { 33 MockFeedbackUnitTest.prototype = {
30 __proto__: ChromeVoxUnitTestBase.prototype, 34 __proto__: ChromeVoxUnitTestBase.prototype,
31 35
32 setUp: function() { 36 setUp: function() {
33 cvox.ChromeVox = cvox.ChromeVox || {}; 37 cvox.ChromeVox = cvox.ChromeVox || {};
34 }, 38 },
35 39
36 closureModuleDeps: [ 40 closureModuleDeps: [
37 'cvox.BrailleInterface', 41 'cvox.BrailleInterface',
38 'cvox.NavBraille', 42 'cvox.NavBraille',
39 'cvox.TtsInterface' 43 'cvox.TtsInterface',
44 'cvox.AbstractEarcons'
40 ] 45 ]
41 }; 46 };
42 47
43 TEST_F('MockFeedbackUnitTest', 'speechAndCallbacks', function() { 48 TEST_F('MockFeedbackUnitTest', 'speechAndCallbacks', function() {
44 var afterThirdStringCalled = false; 49 var afterThirdStringCalled = false;
45 var spruiousStringEndCallbackCalled = false; 50 var spruiousStringEndCallbackCalled = false;
46 var finishCalled = false; 51 var finishCalled = false;
47 var mock = new MockFeedback(function() { 52 var mock = new MockFeedback(function() {
48 assertFalse(finishCalled); 53 assertFalse(finishCalled);
49 finishCalled = true; 54 finishCalled = true;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 braille('Some other string'); 168 braille('Some other string');
164 firstCallbackCalled = true; 169 firstCallbackCalled = true;
165 }) 170 })
166 .expectBraille('Unmatched string') 171 .expectBraille('Unmatched string')
167 .call(function() { 172 .call(function() {
168 throw Error('Should not be called'); 173 throw Error('Should not be called');
169 }) 174 })
170 .replay(); 175 .replay();
171 assertTrue(firstCallbackCalled); 176 assertTrue(firstCallbackCalled);
172 }); 177 });
178
179 TEST_F('MockFeedbackUnitTest', 'SpeechAndEarcons', function() {
180 var finishCalled = false;
181 var mock = new MockFeedback(function() { finishCalled = true; });
182 mock.install();
183 mock.call(function() {
184 speak('MyButton', {startCallback: function() {
185 earcon('BUTTON');
186 }});
187 })
188 .expectSpeech('MyButton')
189 .expectEarcon(cvox.Earcon.BUTTON)
190 .call(function() {
191 earcon('ALERT_MODAL');
192 speak('MyTextField', {startCallback: function() {
193 earcon('EDITABLE_TEXT');
194 }});
195 })
196 .expectEarcon(cvox.Earcon.ALERT_MODAL)
197 .expectSpeech('MyTextField')
198 .expectEarcon(cvox.Earcon.EDITABLE_TEXT)
199 .replay();
200 assertTrue(finishCalled);
201 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/testing/mock_feedback.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698