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

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

Issue 2939753002: Fix EditingTest.RichText* (Closed)
Patch Set: Rebase. Created 3 years, 6 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 | « no previous file | 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(['../../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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 });
214 214
215 // Fails flakily, see https://crbug.com/724847. 215 TEST_F('EditingTest', 'RichTextMoveByLine', function() {
216 TEST_F('EditingTest', 'DISABLED_RichTextMoveByLine', function() {
217 editing.useRichText = true; 216 editing.useRichText = true;
218 var mockFeedback = this.createMockFeedback(); 217 var mockFeedback = this.createMockFeedback();
219 this.runWithLoadedTree(function() {/*! 218 this.runWithLoadedTree(function() {/*!
220 <div id="go" role="textbox" contenteditable> 219 <div id="go" role="textbox" contenteditable>
221 <h2>hello</h2> 220 <h2>hello</h2>
222 <div><br></div> 221 <div><br></div>
223 <p>This is a <a href="#test">test</a> of rich text</p> 222 <p>This is a <a href="#test">test</a> of rich text</p>
224 </div> 223 </div>
225 <script> 224 <script>
226 var dir = 'forward'; 225 var dir = 'forward';
227 var line = 0; 226 var line = 0;
228 document.getElementById('go').addEventListener('click', function() { 227 document.getElementById('go').addEventListener('click', function() {
229 var sel = getSelection(); 228 var sel = getSelection();
230 sel.modify('move', dir, 'line'); 229 sel.modify('move', dir, 'line');
231 if (dir == 'forward') 230 if (dir == 'forward')
232 line++; 231 line++;
233 else 232 else
234 line--; 233 line--;
235 234
236 if (line == 0) 235 if (line == 0)
237 dir = 'forward'; 236 dir = 'forward';
238 if (line == 2) 237 if (line == 2)
239 dir = 'backward'; 238 dir = 'backward';
240 }, true); 239 }, true);
241 </script> 240 </script>
242 */}, function(root) { 241 */}, function(root) {
243 var input = root.find({role: RoleType.TEXT_FIELD}); 242 var input = root.find({role: RoleType.TEXT_FIELD});
244 var moveByLine = input.doDefault.bind(input); 243 var moveByLine = input.doDefault.bind(input);
245 mockFeedback.call(input.focus.bind(input)) 244 this.listenOnce(input, 'focus', function() {
246 .expectSpeech('Text area') 245 mockFeedback.call(moveByLine)
247 .call(moveByLine) 246 .expectSpeech('\n')
248 .expectSpeech('\n') 247 .expectBraille('\n')
249 .expectBraille('\n') 248 .call(moveByLine)
250 .call(moveByLine) 249 .expectSpeech('This is a ', 'test', 'Link', ' of rich text')
251 .expectSpeech('This is a ', 'test', 'Link', ' of rich text') 250 .expectBraille('This is a test lnk of rich text')
252 .expectBraille('This is a test lnk of rich text') 251 .call(moveByLine)
253 .call(moveByLine) 252 .expectSpeech('\n')
254 .expectSpeech('\n') 253 .expectBraille('\n')
255 .expectBraille('\n') 254 .call(moveByLine)
256 .call(moveByLine) 255 .expectSpeech('hello', 'Heading 2')
257 .expectSpeech('hello', 'Heading 2') 256 .expectBraille('hello h2')
258 .expectBraille('hello h2') 257 .replay();
259 .replay(); 258 });
259 input.focus();
260 }); 260 });
261 }); 261 });
262 262
263 // Fails flakily, see https://crbug.com/732000. 263 TEST_F('EditingTest', 'RichTextMoveByCharacter', function() {
264 TEST_F('EditingTest', 'DISABLED_RichTextMoveByCharacter', function() {
265 editing.useRichText = true; 264 editing.useRichText = true;
266 var mockFeedback = this.createMockFeedback(); 265 var mockFeedback = this.createMockFeedback();
267 this.runWithLoadedTree(function() {/*! 266 this.runWithLoadedTree(function() {/*!
268 <div id="go" role="textbox" contenteditable>This <b>is</b> a test.</div> 267 <div id="go" role="textbox" contenteditable>This <b>is</b> a test.</div>
269 268
270 <script> 269 <script>
271 var dir = 'forward'; 270 var dir = 'forward';
272 var char = 0; 271 var char = 0;
273 document.getElementById('go').addEventListener('click', function() { 272 document.getElementById('go').addEventListener('click', function() {
274 var sel = getSelection(); 273 var sel = getSelection();
275 sel.modify('move', dir, 'character'); 274 sel.modify('move', dir, 'character');
276 if (dir == 'forward') 275 if (dir == 'forward')
277 char++; 276 char++;
278 else 277 else
279 char--; 278 char--;
280 279
281 if (char == 0) 280 if (char == 0)
282 dir = 'forward'; 281 dir = 'forward';
283 if (line == 16) 282 if (line == 16)
284 dir = 'backward'; 283 dir = 'backward';
285 }, true); 284 }, true);
286 </script> 285 </script>
287 */}, function(root) { 286 */}, function(root) {
288 var input = root.find({role: RoleType.TEXT_FIELD}); 287 var input = root.find({role: RoleType.TEXT_FIELD});
289 var moveByChar = input.doDefault.bind(input) 288 var moveByChar = input.doDefault.bind(input);
290 var lineText = 'This is a test.'; 289 var lineText = 'This is a test.';
291 290
292 mockFeedback.call(input.focus.bind(input)) 291 this.listenOnce(input, 'focus', function() {
293 .expectSpeech(lineText) 292 mockFeedback.call(moveByChar)
294 .expectSpeech('Text area') 293 .expectSpeech('h')
295 .call(moveByChar) 294 .expectBraille(lineText, { startIndex: 1, endIndex: 1 })
296 .expectSpeech('h') 295 .call(moveByChar)
297 .expectBraille(lineText, { startIndex: 1, endIndex: 1 }) 296 .expectSpeech('i')
298 .call(moveByChar) 297 .expectBraille(lineText, { startIndex: 2, endIndex: 2 })
299 .expectSpeech('i') 298 .call(moveByChar)
300 .expectBraille(lineText, { startIndex: 2, endIndex: 2 }) 299 .expectSpeech('s')
301 .call(moveByChar) 300 .expectBraille(lineText, { startIndex: 3, endIndex: 3 })
302 .expectSpeech('s') 301 .call(moveByChar)
303 .expectBraille(lineText, { startIndex: 3, endIndex: 3 }) 302 .expectSpeech(' ')
304 .call(moveByChar) 303 .expectBraille(lineText, { startIndex: 4, endIndex: 4 })
305 .expectSpeech(' ')
306 .expectBraille(lineText, { startIndex: 4, endIndex: 4 })
307 304
308 .call(moveByChar) 305 .call(moveByChar)
309 .expectSpeech('i') 306 .expectSpeech('i')
310 .expectSpeech('Bold start') 307 .expectSpeech('Bold start')
311 .expectBraille(lineText, { startIndex: 5, endIndex: 5 }) 308 .expectBraille(lineText, { startIndex: 5, endIndex: 5 })
312 309
313 .call(moveByChar) 310 .call(moveByChar)
314 .expectSpeech('s') 311 .expectSpeech('s')
315 .expectSpeech('Bold end') 312 .expectSpeech('Bold end')
316 .expectBraille(lineText, { startIndex: 6, endIndex: 6 }) 313 .expectBraille(lineText, { startIndex: 6, endIndex: 6 })
317 314
318 .call(moveByChar) 315 .call(moveByChar)
319 .expectSpeech(' ') 316 .expectSpeech(' ')
320 .expectBraille(lineText, { startIndex: 7, endIndex: 7 }) 317 .expectBraille(lineText, { startIndex: 7, endIndex: 7 })
321 318
322 .call(moveByChar) 319 .call(moveByChar)
323 .expectSpeech('a') 320 .expectSpeech('a')
324 .expectBraille(lineText, { startIndex: 8, endIndex: 8 }) 321 .expectBraille(lineText, { startIndex: 8, endIndex: 8 })
325 322
326 .call(moveByChar) 323 .call(moveByChar)
327 .expectSpeech(' ') 324 .expectSpeech(' ')
328 .expectBraille(lineText, { startIndex: 9, endIndex: 9 }) 325 .expectBraille(lineText, { startIndex: 9, endIndex: 9 })
329 326
330 .replay(); 327 .replay();
328 });
329 input.focus();
331 }); 330 });
332 }); 331 });
333 332
334 // Tests specifically for cursor workarounds. 333 // Tests specifically for cursor workarounds.
335 // Fails flakily, see https://crbug.com/731825. 334 TEST_F('EditingTest', 'RichTextMoveByCharacterNodeWorkaround', function() {
336 TEST_F('EditingTest', 'DISABLED_RichTextMoveByCharacterNodeWorkaround', function () {
337 editing.useRichText = true; 335 editing.useRichText = true;
338 var mockFeedback = this.createMockFeedback(); 336 var mockFeedback = this.createMockFeedback();
339 this.runWithLoadedTree(function() {/*! 337 this.runWithLoadedTree(function() {/*!
340 <div id="go" role="textbox" contenteditable>hello <b>world</b></div> 338 <div id="go" role="textbox" contenteditable>hello <b>world</b></div>
341 339
342 <script> 340 <script>
343 document.getElementById('go').addEventListener('click', function() { 341 document.getElementById('go').addEventListener('click', function() {
344 var sel = getSelection(); 342 var sel = getSelection();
345 sel.modify('move', 'forward', 'character'); 343 sel.modify('move', 'forward', 'character');
346 }, true); 344 }, true);
347 </script> 345 </script>
348 */}, function(root) { 346 */}, function(root) {
349 var input = root.find({role: RoleType.TEXT_FIELD}); 347 var input = root.find({role: RoleType.TEXT_FIELD});
350 var moveByChar = input.doDefault.bind(input) 348 var moveByChar = input.doDefault.bind(input)
351 var lineText = 'hello world'; 349 var lineText = 'hello world';
352 350
353 mockFeedback.call(input.focus.bind(input)) 351 this.listenOnce(input, 'focus', function() {
354 .expectSpeech(lineText) 352 mockFeedback.call(moveByChar)
355 .expectSpeech('Text area') 353 .expectSpeech('e')
356 .call(moveByChar) 354 .expectBraille(lineText, { startIndex: 1, endIndex: 1 })
357 .expectSpeech('e') 355 .call(moveByChar)
358 .expectBraille(lineText, { startIndex: 1, endIndex: 1 }) 356 .expectSpeech('l')
359 .call(moveByChar) 357 .expectBraille(lineText, { startIndex: 2, endIndex: 2 })
360 .expectSpeech('l') 358 .call(moveByChar)
361 .expectBraille(lineText, { startIndex: 2, endIndex: 2 }) 359 .expectSpeech('l')
362 .call(moveByChar) 360 .expectBraille(lineText, { startIndex: 3, endIndex: 3 })
363 .expectSpeech('l') 361 .call(moveByChar)
364 .expectBraille(lineText, { startIndex: 3, endIndex: 3 }) 362 .expectSpeech('o')
365 .call(moveByChar) 363 .expectBraille(lineText, { startIndex: 4, endIndex: 4 })
366 .expectSpeech('o') 364 .call(moveByChar)
367 .expectBraille(lineText, { startIndex: 4, endIndex: 4 }) 365 .expectSpeech(' ')
368 .call(moveByChar) 366 .expectBraille(lineText, { startIndex: 5, endIndex: 5 })
369 .expectSpeech(' ') 367 .call(moveByChar)
370 .expectBraille(lineText, { startIndex: 5, endIndex: 5 }) 368 .expectSpeech('w')
371 .call(moveByChar) 369 .expectBraille(lineText, { startIndex: 6, endIndex: 6 })
372 .expectSpeech('w') 370 .replay();
373 .expectBraille(lineText, { startIndex: 6, endIndex: 6 }) 371 });
374 .replay(); 372 input.focus();
375 }); 373 });
376 }); 374 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698