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

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

Issue 1100763002: Inject CanAddURLToHistory into TopSitesImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefs
Patch Set: Fix error introduced during rebase Created 5 years, 7 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 GEN_INCLUDE(['../../testing/assert_additions.js']); 5 GEN_INCLUDE(['../../testing/assert_additions.js']);
6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js']); 6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js']);
7 7
8 /** 8 /**
9 * Test fixture for output.js. 9 * Test fixture for output.js.
10 * @constructor 10 * @constructor
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 el = el.nextSibling; 131 el = el.nextSibling;
132 range = cursors.Range.fromNode(el); 132 range = cursors.Range.fromNode(el);
133 o = new Output().withSpeechAndBraille(range, null, 'navigate'); 133 o = new Output().withSpeechAndBraille(range, null, 'navigate');
134 assertEqualsJSON({string_: 'Heading 6f', 'spans_': [ 134 assertEqualsJSON({string_: 'Heading 6f', 'spans_': [
135 // Attributes. 135 // Attributes.
136 {value: 'name', start: 9, end: 10} 136 {value: 'name', start: 9, end: 10}
137 ]}, o.toSpannable()); 137 ]}, o.toSpannable());
138 }); 138 });
139 }); 139 });
140
141 TEST_F('OutputE2ETest', 'Audio', function() {
142 this.runWithLoadedTree('<audio src="foo.mp3" controls></audio>',
143 function(root) {
144 var el = root.firstChild.firstChild.firstChild.firstChild;
145 var range = cursors.Range.fromNode(el);
146 var o = new Output().withSpeechAndBraille(range, null, 'navigate');
147 assertEqualsJSON(
148 {string_: 'media control|Tool bar|||play|begin playback|Button',
149 spans_:
150 // Entered container toolbar.
151
152 // Button.
153 [{value: 'name', start: 23, end: 23},
154 {value: 'value', start: 24, end: 24},
155 {value: 'description', start: 25, end: 29},
156 {value: 'help', start: 30, end: 44},
157 {value: 'role', start: 45, end: 51},
158
159 // Button earcon.
160 {value: {}, start: 45, end: 51}]
161 }, o.toSpannableForTest());
162
163 el = el.nextSibling;
164 var prevRange = range;
165 range = cursors.Range.fromNode(el);
166 var o = new Output().withSpeechAndBraille(range, prevRange, 'navigate');
167 assertEqualsJSON({string_: '0, , slider|audio time scrubber',
168 spans_:
169 [{value: 'help', start: 12, end: 31}]
170 }, o.toSpannableForTest());
171 });
172 });
173
174 TEST_F('OutputE2ETest', 'Input', function() {
175 this.runWithLoadedTree(
176 '<input type="text"></input>' +
177 '<input type="email"></input>' +
178 '<input type="password"></input>' +
179 '<input type="tel"></input>' +
180 '<input type="number"></input>' +
181 '<input type="time"></input>' +
182 '<input type="date"></input>',
183 function(root) {
184 var expected = {string_: '', 'spans_': [
185 {value: 'name', start: 0, end: 0},
186
187 // Selection span.
188 {value: {startIndex: 0, endIndex: 0}, start: 1, end: 1},
189
190 {value: 'value', start: 1, end: 1},
191
192 // Earcon
193 {value: {}, start: 2, end: 2}
194 ]};
195
196 var expectedValues = [
197 '||Edit text',
198 '||Edit text, email entry',
199 '||Password edit text',
200 '||Edit text, number entry',
201 {string_: '||Combo box', spans_: [{value: 'name', start: 0, end: 0},
202 {value: {startIndex: 0, endIndex: 0}, start: 1, end: 1},
203 {value: 'value', start: 1, end: 1},
204 {value: 'role', start: 2, end: 11},
205 {value: {}, start: 2, end: 11}]},
206 {string_: '||Time', spans_: [{value: 'name', start: 0, end: 0},
207 {value: 'value', start: 1, end: 1},
208 {value: 'role', start: 2, end: 6}]},
209 {string_: '||Date control', spans_: [{value: 'name', start: 0, end: 0},
210 {value: 'value', start: 1, end: 1},
211 {value: 'role', start: 2, end: 14}]}
212 ];
213
214 var el = root.firstChild.firstChild;
215 expectedValues.forEach(function(expectedValue) {
216 var range = cursors.Range.fromNode(el);
217 var o = new Output().withSpeechAndBraille(range, null, 'navigate');
218 if (typeof expectedValue == 'object') {
219 assertEqualsJSON(expectedValue, o.toSpannableForTest());
220 } else {
221 expected.string_ = expectedValue;
222 assertEqualsJSON(expected, o.toSpannableForTest());
223 }
224 el = el.nextSibling;
225 });
226 });
227 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698