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

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

Issue 2195343003: Support navigation within editable nodes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 4 years, 4 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_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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 function(rootNode) { 369 function(rootNode) {
370 var assertExists = this.newCallback(function (evt) { 370 var assertExists = this.newCallback(function (evt) {
371 assertNotNullNorUndefined( 371 assertNotNullNorUndefined(
372 ChromeVoxState.desktopAutomationHandler.textEditHandler_); 372 ChromeVoxState.desktopAutomationHandler.textEditHandler_);
373 evt.stopPropagation(); 373 evt.stopPropagation();
374 }); 374 });
375 var assertDoesntExist = this.newCallback(function (evt) { 375 var assertDoesntExist = this.newCallback(function (evt) {
376 assertTrue( 376 assertTrue(
377 !ChromeVoxState.desktopAutomationHandler.editableTextHandler_); 377 !ChromeVoxState.desktopAutomationHandler.editableTextHandler_);
378 evt.stopPropagation(); 378 evt.stopPropagation();
379
380 // Focus the other text field here to make this test not racey.
381 editable.focus();
379 }); 382 });
380 383
381 var editable = rootNode.find({ role: RoleType.textField }); 384 var editable = rootNode.find({ role: RoleType.textField });
382 var nonEditable = rootNode.find({ role: RoleType.paragraph }); 385 var nonEditable = rootNode.find({ role: RoleType.paragraph });
383 386
387 this.listenOnce(nonEditable, 'focus', assertDoesntExist);
384 this.listenOnce(editable, 'focus', assertExists); 388 this.listenOnce(editable, 'focus', assertExists);
385 this.listenOnce(nonEditable, 'focus', assertDoesntExist);
386 389
387 editable.focus();
388 nonEditable.focus(); 390 nonEditable.focus();
389 }.bind(this)); 391 }.bind(this));
390 }); 392 });
391 393
392 TEST_F('BackgroundTest', 'EarconsForControls', function() { 394 TEST_F('BackgroundTest', 'EarconsForControls', function() {
393 var mockFeedback = this.createMockFeedback(); 395 var mockFeedback = this.createMockFeedback();
394 this.runWithLoadedTree( 396 this.runWithLoadedTree(
395 function() {/*! 397 function() {/*!
396 <p>Initial focus will be on something that's not a control.</p> 398 <p>Initial focus will be on something that's not a control.</p>
397 <a href="#">MyLink</a> 399 <a href="#">MyLink</a>
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 .call(doCmd('previousHeading')) 937 .call(doCmd('previousHeading'))
936 .expectNextSpeechUtteranceIsNot('NE') 938 .expectNextSpeechUtteranceIsNot('NE')
937 .expectSpeech('NW') 939 .expectSpeech('NW')
938 .replay(); 940 .replay();
939 }); 941 });
940 }); 942 });
941 943
942 TEST_F('BackgroundTest', 'ContentEditableJumpSyncsRange', function() { 944 TEST_F('BackgroundTest', 'ContentEditableJumpSyncsRange', function() {
943 var mockFeedback = this.createMockFeedback(); 945 var mockFeedback = this.createMockFeedback();
944 this.runWithLoadedTree(function(root) {/*! 946 this.runWithLoadedTree(function(root) {/*!
947 <p>start</p>
945 <div contenteditable> 948 <div contenteditable>
946 <h1>Top News</h1> 949 <h1>Top News</h1>
947 <h1>Most Popular</h1> 950 <h1>Most Popular</h1>
948 <h1>Sports</h1> 951 <h1>Sports</h1>
949 </div> 952 </div>
950 */}, function(root) { 953 */}, function(root) {
951 var assertRangeHasText = function(text) { 954 var assertRangeHasText = function(text) {
952 return function() { 955 return function() {
953 assertEquals(text, 956 assertEquals(text,
954 ChromeVoxState.instance.getCurrentRange().start.node.name); 957 ChromeVoxState.instance.getCurrentRange().start.node.name);
955 }; 958 };
956 }; 959 };
957 960
958 mockFeedback.call(doCmd('nextHeading')) 961 mockFeedback.call(doCmd('nextEditText'))
962 .expectSpeech('Top News')
963 .call(doCmd('nextHeading'))
959 .expectSpeech('Top News') 964 .expectSpeech('Top News')
960 .call(assertRangeHasText('Top News')) 965 .call(assertRangeHasText('Top News'))
961 .call(doCmd('nextHeading')) 966 .call(doCmd('nextHeading'))
962 .expectSpeech('Most Popular') 967 .expectSpeech('Most Popular')
963 .call(assertRangeHasText('Most Popular')) 968 .call(assertRangeHasText('Most Popular'))
964 .call(doCmd('nextLine')) 969 .call(doCmd('nextHeading'))
965 .expectSpeech('Sports') 970 .expectSpeech('Sports')
966 .call(assertRangeHasText('Sports')) 971 .call(assertRangeHasText('Sports'))
967 .replay(); 972 .replay();
968 }); 973 });
969 }); 974 });
970 975
971 TEST_F('BackgroundTest', 'Selection', function() { 976 TEST_F('BackgroundTest', 'Selection', function() {
972 var mockFeedback = this.createMockFeedback(); 977 var mockFeedback = this.createMockFeedback();
973 this.runWithLoadedTree(function(root) {/*! 978 this.runWithLoadedTree(function(root) {/*!
974 <p>simple</p> 979 <p>simple</p>
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 .call(doCmd('nextHeading' + level)) 1130 .call(doCmd('nextHeading' + level))
1126 .expectSpeech('No next level ' + level + ' heading.') 1131 .expectSpeech('No next level ' + level + ' heading.')
1127 .call(doCmd('previousHeading' + level)) 1132 .call(doCmd('previousHeading' + level))
1128 .expectSpeech('No previous level ' + level + ' heading.'); 1133 .expectSpeech('No previous level ' + level + ' heading.');
1129 }; 1134 };
1130 for (var i = 1; i <= 6; i++) 1135 for (var i = 1; i <= 6; i++)
1131 makeLevelAssertions(i); 1136 makeLevelAssertions(i);
1132 mockFeedback.replay(); 1137 mockFeedback.replay();
1133 }); 1138 });
1134 }); 1139 });
1140
1141 TEST_F('BackgroundTest', 'EditableNavigation', function() {
1142 var mockFeedback = this.createMockFeedback();
1143 this.runWithLoadedTree(function(root) {/*!
1144 <div contenteditable>this is a test</div>
1145 */}, function(root) {
1146 mockFeedback.call(doCmd('nextObject'))
1147 .expectSpeech('this is a test')
1148 .call(doCmd('nextObject'))
1149 .expectSpeech(/data*/)
1150 .call(doCmd('nextObject'))
1151 .expectSpeech('this is a test')
1152 .call(doCmd('nextWord'))
1153 .expectSpeech('is', 'selected')
1154 .replay();
1155 });
1156 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698