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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs

Issue 2650733002: Revert of Update json_schema_compiler to handle the Automation extension API (Closed)
Patch Set: Created 3 years, 11 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 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(['../../testing/chromevox_next_e2e_test_base.js', 6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js',
7 '../../testing/assert_additions.js']); 7 '../../testing/assert_additions.js']);
8 8
9 GEN_INCLUDE(['../../testing/mock_feedback.js']); 9 GEN_INCLUDE(['../../testing/mock_feedback.js']);
10 10
(...skipping 15 matching lines...) Expand all
26 */ 26 */
27 createMockFeedback: function() { 27 createMockFeedback: function() {
28 var mockFeedback = new MockFeedback(this.newCallback(), 28 var mockFeedback = new MockFeedback(this.newCallback(),
29 this.newCallback.bind(this)); 29 this.newCallback.bind(this));
30 mockFeedback.install(); 30 mockFeedback.install();
31 return mockFeedback; 31 return mockFeedback;
32 }, 32 },
33 33
34 assertLineData: function(doc, data) { 34 assertLineData: function(doc, data) {
35 this.runWithLoadedTree(doc, function(root) { 35 this.runWithLoadedTree(doc, function(root) {
36 var input = root.find({role: RoleType.TEXT_FIELD}); 36 var input = root.find({role: RoleType.textField});
37 input.addEventListener('focus', this.newCallback(function() { 37 input.addEventListener('focus', this.newCallback(function() {
38 var textHandler = ChromeVoxState.desktopAutomationHandler 38 var textHandler = ChromeVoxState.desktopAutomationHandler
39 .textEditHandler_.editableText_; 39 .textEditHandler_.editableText_;
40 40
41 var offset = 0; 41 var offset = 0;
42 for (var i = 0; i < data.length; i++) { 42 for (var i = 0; i < data.length; i++) {
43 var line = data[i]; 43 var line = data[i];
44 var actualStart = textHandler.getLineStart(i); 44 var actualStart = textHandler.getLineStart(i);
45 var actualEnd = textHandler.getLineEnd(i); 45 var actualEnd = textHandler.getLineEnd(i);
46 assertEquals(line.start, actualStart, 46 assertEquals(line.start, actualStart,
(...skipping 21 matching lines...) Expand all
68 <textarea id='textarea'> 68 <textarea id='textarea'>
69 Line 1&#xa; 69 Line 1&#xa;
70 line 2&#xa; 70 line 2&#xa;
71 line 3 71 line 3
72 </textarea> 72 </textarea>
73 */}; 73 */};
74 74
75 TEST_F('EditingTest', 'Focus', function() { 75 TEST_F('EditingTest', 'Focus', function() {
76 var mockFeedback = this.createMockFeedback(); 76 var mockFeedback = this.createMockFeedback();
77 this.runWithLoadedTree(doc, function(root) { 77 this.runWithLoadedTree(doc, function(root) {
78 var singleLine = root.find({role: RoleType.TEXT_FIELD, 78 var singleLine = root.find({role: RoleType.textField,
79 attributes: {name: 'singleLine'}}); 79 attributes: {name: 'singleLine'}});
80 var textarea = root.find({role: RoleType.TEXT_FIELD, 80 var textarea = root.find({role: RoleType.textField,
81 attributes: {name: 'textArea'}}); 81 attributes: {name: 'textArea'}});
82 singleLine.focus(); 82 singleLine.focus();
83 mockFeedback 83 mockFeedback
84 .expectSpeech('singleLine', 'Single line field', 'Edit text') 84 .expectSpeech('singleLine', 'Single line field', 'Edit text')
85 .expectBraille('singleLine Single line field ed', 85 .expectBraille('singleLine Single line field ed',
86 {startIndex: 11, endIndex: 11}) 86 {startIndex: 11, endIndex: 11})
87 .call(textarea.focus.bind(textarea)) 87 .call(textarea.focus.bind(textarea))
88 .expectSpeech('textArea', 88 .expectSpeech('textArea',
89 'Line 1\nline 2\nline 3', 89 'Line 1\nline 2\nline 3',
90 'Text area') 90 'Text area')
91 .expectBraille('textArea Line 1 mled', 91 .expectBraille('textArea Line 1 mled',
92 {startIndex: 9, endIndex: 9}); 92 {startIndex: 9, endIndex: 9});
93 93
94 mockFeedback.replay(); 94 mockFeedback.replay();
95 }); 95 });
96 }); 96 });
97 97
98 TEST_F('EditingTest', 'Multiline', function() { 98 TEST_F('EditingTest', 'Multiline', function() {
99 var mockFeedback = this.createMockFeedback(); 99 var mockFeedback = this.createMockFeedback();
100 this.runWithLoadedTree(doc, function(root) { 100 this.runWithLoadedTree(doc, function(root) {
101 var textarea = root.find({role: RoleType.TEXT_FIELD, 101 var textarea = root.find({role: RoleType.textField,
102 attributes: {name: 'textArea'}}); 102 attributes: {name: 'textArea'}});
103 textarea.focus(); 103 textarea.focus();
104 mockFeedback 104 mockFeedback
105 .expectSpeech('textArea', 105 .expectSpeech('textArea',
106 'Line 1\nline 2\nline 3', 106 'Line 1\nline 2\nline 3',
107 'Text area') 107 'Text area')
108 .expectBraille('textArea Line 1 mled', 108 .expectBraille('textArea Line 1 mled',
109 {startIndex: 9, endIndex: 9}) 109 {startIndex: 9, endIndex: 9})
110 .call(textarea.setSelection.bind(textarea, 1, 1)) 110 .call(textarea.setSelection.bind(textarea, 1, 1))
111 .expectSpeech('i') 111 .expectSpeech('i')
(...skipping 28 matching lines...) Expand all
140 if (input.selectionStart == 0) 140 if (input.selectionStart == 0)
141 return; 141 return;
142 console.log('TIM' + 'ER'); 142 console.log('TIM' + 'ER');
143 input.value = 'text2'; 143 input.value = 'text2';
144 window.clearInterval(timer); 144 window.clearInterval(timer);
145 } 145 }
146 timer = window.setInterval(poll, 200); 146 timer = window.setInterval(poll, 200);
147 </script> 147 </script>
148 */}, 148 */},
149 function(root) { 149 function(root) {
150 var input = root.find({role: RoleType.TEXT_FIELD}); 150 var input = root.find({role: RoleType.textField});
151 input.focus(); 151 input.focus();
152 mockFeedback 152 mockFeedback
153 .expectSpeech('text1', 'Edit text') 153 .expectSpeech('text1', 'Edit text')
154 .expectBraille('text1 ed', {startIndex: 0, endIndex: 0}) 154 .expectBraille('text1 ed', {startIndex: 0, endIndex: 0})
155 .call(input.setSelection.bind(input, 5, 5)) 155 .call(input.setSelection.bind(input, 5, 5))
156 .expectBraille('text2 ed', {startIndex: 5, endIndex: 5}) 156 .expectBraille('text2 ed', {startIndex: 5, endIndex: 5})
157 .expectSpeech('text2'); 157 .expectSpeech('text2');
158 158
159 mockFeedback.replay(); 159 mockFeedback.replay();
160 }); 160 });
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 can test</div></div> 204 can test</div></div>
205 */}, 205 */},
206 [ 206 [
207 {start: 0, end: 4, text: 'this'}, 207 {start: 0, end: 4, text: 'this'},
208 {start: 5, end: 5, text: ''}, 208 {start: 5, end: 5, text: ''},
209 {start: 6, end: 6, text: ''}, 209 {start: 6, end: 6, text: ''},
210 {start: 7, end: 8, text: 'I'}, 210 {start: 7, end: 8, text: 'I'},
211 {start: 9, end: 17, text: 'can test'}, 211 {start: 9, end: 17, text: 'can test'},
212 ]); 212 ]);
213 }); 213 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698