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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/common/editable_text_test.unitjs

Issue 889593002: Refactorings to reduce dependencies in ChromeVox 2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix copyright year. Created 5 years, 10 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
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 // 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
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 * @constructor 88 * @constructor
89 * @extends {ChromeVoxUnitTestBase} 89 * @extends {ChromeVoxUnitTestBase}
90 */ 90 */
91 function CvoxEditableTextUnitTest() {} 91 function CvoxEditableTextUnitTest() {}
92 92
93 CvoxEditableTextUnitTest.prototype = { 93 CvoxEditableTextUnitTest.prototype = {
94 __proto__: ChromeVoxUnitTestBase.prototype, 94 __proto__: ChromeVoxUnitTestBase.prototype,
95 95
96 /** @override */ 96 /** @override */
97 closureModuleDeps: [ 97 closureModuleDeps: [
98 'cvox.ChromeVoxEditableElement',
98 'cvox.ChromeVoxEditableHTMLInput', 99 'cvox.ChromeVoxEditableHTMLInput',
99 'cvox.ChromeVoxEditableTextBase', 100 'cvox.ChromeVoxEditableTextBase',
100 'cvox.ChromeVoxEventWatcher', 101 'cvox.ChromeVoxEventWatcher',
101 'cvox.TextChangeEvent', 102 'cvox.TextChangeEvent',
102 'cvox.TtsInterface', 103 'cvox.TtsInterface',
103 'cvox.TypingEcho', 104 'cvox.TypingEcho',
104 ], 105 ],
105 106
106 /** @override */ 107 /** @override */
107 setUp: function() { 108 setUp: function() {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 obj.changed(new cvox.TextChangeEvent('Hello, world.', 2, 2)); 269 obj.changed(new cvox.TextChangeEvent('Hello, world.', 2, 2));
269 assertEqualStringArrays(['Unselected'], 270 assertEqualStringArrays(['Unselected'],
270 tts.get()); 271 tts.get());
271 }); 272 });
272 273
273 274
274 /** Test multi-line text. */ 275 /** Test multi-line text. */
275 TEST_F('CvoxEditableTextUnitTest', 'MultiLineText', function() { 276 TEST_F('CvoxEditableTextUnitTest', 'MultiLineText', function() {
276 var str = 'This string\nspans\nfive lines.\n \n'; 277 var str = 'This string\nspans\nfive lines.\n \n';
277 var tts = new TestTts(); 278 var tts = new TestTts();
278 var obj = new cvox.ChromeVoxEditableTextBase(str, 0, 0, false, tts); 279 var obj = new cvox.ChromeVoxEditableElement(null, str, 0, 0, false, tts);
279 obj.multiline = true; 280 obj.multiline = true;
280 obj.getLineIndex = function(index) { 281 obj.getLineIndex = function(index) {
281 if (index >= 33) { 282 if (index >= 33) {
282 return 4; 283 return 4;
283 } else if (index >= 30) { 284 } else if (index >= 30) {
284 return 3; 285 return 3;
285 } else if (index >= 18) { 286 } else if (index >= 18) {
286 return 2; 287 return 2;
287 } else if (index >= 12) { 288 } else if (index >= 12) {
288 return 1; 289 return 1;
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 var firstLine = 'Some text.\n'; 684 var firstLine = 'Some text.\n';
684 for (var i = 0; i < firstLine.length; ++i) { 685 for (var i = 0; i < firstLine.length; ++i) {
685 editable.update(true); 686 editable.update(true);
686 TestBraille.assertContent(firstLine, i, i); 687 TestBraille.assertContent(firstLine, i, i);
687 window.getSelection().modify('move', 'forward', 'character'); 688 window.getSelection().modify('move', 'forward', 'character');
688 } 689 }
689 // 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.
690 editable.update(true); 691 editable.update(true);
691 TestBraille.assertContent('', 0, 0); 692 TestBraille.assertContent('', 0, 0);
692 }); 693 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698