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 // Include test fixture. | 5 // Include test fixture. |
6 GEN_INCLUDE(['../testing/chromevox_unittest_base.js']); | 6 GEN_INCLUDE(['../testing/chromevox_unittest_base.js']); |
7 | 7 |
8 /** | 8 /** |
9 * A TTS class implementing speak and stop methods intended only for testing. | 9 * A TTS class implementing speak and stop methods intended only for testing. |
10 * @constructor | 10 * @constructor |
11 * @implements cvox.TtsInterface | 11 * @implements cvox.TtsInterface |
12 */ | 12 */ |
13 function TestTts() { | 13 function TestTts() { |
14 this.strings = []; | 14 this.strings = []; |
15 } | 15 } |
16 | 16 |
17 /** | 17 /** |
18 * The strings that were spoken since the last call to get(). | 18 * The strings that were spoken since the last call to get(). |
19 * @type {Array.<string>} | 19 * @type {Array<string>} |
20 */ | 20 */ |
21 TestTts.prototype.strings; | 21 TestTts.prototype.strings; |
22 | 22 |
23 /** | 23 /** |
24 * Returns the list of strings spoken since the last time this method was | 24 * Returns the list of strings spoken since the last time this method was |
25 * called, and then clears the list. | 25 * called, and then clears the list. |
26 * @return {Array.<string>} The list of strings. | 26 * @return {Array<string>} The list of strings. |
27 */ | 27 */ |
28 TestTts.prototype.get = function() { | 28 TestTts.prototype.get = function() { |
29 var result = this.strings; | 29 var result = this.strings; |
30 this.strings = []; | 30 this.strings = []; |
31 return result; | 31 return result; |
32 }; | 32 }; |
33 | 33 |
34 /** @override */ | 34 /** @override */ |
35 TestTts.prototype.speak = function(text, queueMode, properties) { | 35 TestTts.prototype.speak = function(text, queueMode, properties) { |
36 this.strings.push(text); | 36 this.strings.push(text); |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 var firstLine = 'Some text.\n'; | 684 var firstLine = 'Some text.\n'; |
685 for (var i = 0; i < firstLine.length; ++i) { | 685 for (var i = 0; i < firstLine.length; ++i) { |
686 editable.update(true); | 686 editable.update(true); |
687 TestBraille.assertContent(firstLine, i, i); | 687 TestBraille.assertContent(firstLine, i, i); |
688 window.getSelection().modify('move', 'forward', 'character'); | 688 window.getSelection().modify('move', 'forward', 'character'); |
689 } | 689 } |
690 // We should have crossed the line break to the second line which is blank. | 690 // We should have crossed the line break to the second line which is blank. |
691 editable.update(true); | 691 editable.update(true); |
692 TestBraille.assertContent('', 0, 0); | 692 TestBraille.assertContent('', 0, 0); |
693 }); | 693 }); |
OLD | NEW |