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

Side by Side Diff: chrome/test/data/extensions/api_test/automation/tests/tabs/attributes.js

Issue 1435113003: Make use of new AX name calc in Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix issue with ariaTextAlternative Created 5 years, 1 month 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 var ActiveDescendantAttribute = [ 'activedescendant' ]; 5 var ActiveDescendantAttribute = [ 'activedescendant' ];
6 var LinkAttributes = [ 'url' ]; 6 var LinkAttributes = [ 'url' ];
7 var DocumentAttributes = [ 'docUrl', 7 var DocumentAttributes = [ 'docUrl',
8 'docTitle', 8 'docTitle',
9 'docLoaded', 9 'docLoaded',
10 'docLoadingProgress' ]; 10 'docLoadingProgress' ];
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 var textField = textFields[i]; 86 var textField = textFields[i];
87 var description = textField.description; 87 var description = textField.description;
88 for (var j = 0; j < EditableTextAttributes.length; j++) { 88 for (var j = 0; j < EditableTextAttributes.length; j++) {
89 var attribute = EditableTextAttributes[j]; 89 var attribute = EditableTextAttributes[j];
90 assertTrue(attribute in textField, 90 assertTrue(attribute in textField,
91 'textField (' + description + ') should have a ' + 91 'textField (' + description + ') should have a ' +
92 attribute + ' attribute'); 92 attribute + ' attribute');
93 } 93 }
94 } 94 }
95 var input = textFields[0]; 95 var input = textFields[0];
96 assertEq('text-input', input.description); 96 assertEq('text-input', input.name);
97 assertEq(2, input.textSelStart); 97 assertEq(2, input.textSelStart);
98 assertEq(8, input.textSelEnd); 98 assertEq(8, input.textSelEnd);
99 99
100 var textArea = textFields[1]; 100 var textArea = textFields[1];
101 assertEq('textarea', textArea.description); 101 assertEq('textarea', textArea.name);
102 for (var i = 0; i < EditableTextAttributes.length; i++) { 102 for (var i = 0; i < EditableTextAttributes.length; i++) {
103 var attribute = EditableTextAttributes[i]; 103 var attribute = EditableTextAttributes[i];
104 assertTrue(attribute in textArea, 104 assertTrue(attribute in textArea,
105 'textArea should have a ' + attribute + ' attribute'); 105 'textArea should have a ' + attribute + ' attribute');
106 } 106 }
107 assertEq(0, textArea.textSelStart); 107 assertEq(0, textArea.textSelStart);
108 assertEq(0, textArea.textSelEnd); 108 assertEq(0, textArea.textSelEnd);
109 109
110 var ariaTextbox = textFields[2]; 110 var ariaTextbox = textFields[2];
111 assertEq('textbox-role', ariaTextbox.description); 111 assertEq('textbox-role', ariaTextbox.name);
112 assertEq(0, ariaTextbox.textSelStart); 112 assertEq(0, ariaTextbox.textSelStart);
113 assertEq(0, ariaTextbox.textSelEnd); 113 assertEq(0, ariaTextbox.textSelEnd);
114 114
115 chrome.test.succeed(); 115 chrome.test.succeed();
116 }, 116 },
117 117
118 function testRangeAttributes() { 118 function testRangeAttributes() {
119 var sliders = rootNode.findAll({ role: 'slider' }); 119 var sliders = rootNode.findAll({ role: 'slider' });
120 assertEq(2, sliders.length); 120 assertEq(2, sliders.length);
121 var spinButtons = rootNode.findAll({ role: 'spinButton' }); 121 var spinButtons = rootNode.findAll({ role: 'spinButton' });
122 assertEq(1, spinButtons.length); 122 assertEq(1, spinButtons.length);
123 var progressIndicators = rootNode.findAll({ role: 'progressIndicator' }); 123 var progressIndicators = rootNode.findAll({ role: 'progressIndicator' });
124 assertEq(1, progressIndicators.length); 124 assertEq(1, progressIndicators.length);
125 assertEq('progressbar-role', progressIndicators[0].description); 125 assertEq('progressbar-role', progressIndicators[0].name);
126 var scrollBars = rootNode.findAll({ role: 'scrollBar' }); 126 var scrollBars = rootNode.findAll({ role: 'scrollBar' });
127 assertEq(1, scrollBars.length); 127 assertEq(1, scrollBars.length);
128 128
129 var ranges = sliders.concat(spinButtons, progressIndicators, scrollBars); 129 var ranges = sliders.concat(spinButtons, progressIndicators, scrollBars);
130 assertEq(5, ranges.length); 130 assertEq(5, ranges.length);
131 131
132 for (var i = 0; i < ranges.length; i++) { 132 for (var i = 0; i < ranges.length; i++) {
133 var range = ranges[i]; 133 var range = ranges[i];
134 for (var j = 0; j < RangeAttributes.length; j++) { 134 for (var j = 0; j < RangeAttributes.length; j++) {
135 var attribute = RangeAttributes[j]; 135 var attribute = RangeAttributes[j];
136 assertTrue(attribute in range, 136 assertTrue(attribute in range,
137 range.role + ' (' + range.description + ') should have a ' 137 range.role + ' (' + range.description + ') should have a '
138 + attribute + ' attribute'); 138 + attribute + ' attribute');
139 } 139 }
140 } 140 }
141 141
142 var inputRange = sliders[0]; 142 var inputRange = sliders[0];
143 assertEq('range-input', inputRange.description); 143 assertEq('range-input', inputRange.name);
144 assertEq(4, inputRange.valueForRange); 144 assertEq(4, inputRange.valueForRange);
145 assertEq(0, inputRange.minValueForRange); 145 assertEq(0, inputRange.minValueForRange);
146 assertEq(5, inputRange.maxValueForRange); 146 assertEq(5, inputRange.maxValueForRange);
147 147
148 var ariaSlider = sliders[1]; 148 var ariaSlider = sliders[1];
149 assertEq('slider-role', ariaSlider.description); 149 assertEq('slider-role', ariaSlider.name);
150 assertEq(7, ariaSlider.valueForRange); 150 assertEq(7, ariaSlider.valueForRange);
151 assertEq(1, ariaSlider.minValueForRange); 151 assertEq(1, ariaSlider.minValueForRange);
152 assertEq(10, ariaSlider.maxValueForRange); 152 assertEq(10, ariaSlider.maxValueForRange);
153 153
154 var spinButton = spinButtons[0]; 154 var spinButton = spinButtons[0];
155 assertEq(14, spinButton.valueForRange); 155 assertEq(14, spinButton.valueForRange);
156 assertEq(1, spinButton.minValueForRange); 156 assertEq(1, spinButton.minValueForRange);
157 assertEq(31, spinButton.maxValueForRange); 157 assertEq(31, spinButton.maxValueForRange);
158 158
159 assertEq('0.9', progressIndicators[0].valueForRange.toPrecision(1)); 159 assertEq('0.9', progressIndicators[0].valueForRange.toPrecision(1));
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 var cell7 = cell6.nextSibling; 214 var cell7 = cell6.nextSibling;
215 assertEq(1, cell7.tableCellColumnIndex); 215 assertEq(1, cell7.tableCellColumnIndex);
216 assertEq(1, cell7.tableCellColumnSpan); 216 assertEq(1, cell7.tableCellColumnSpan);
217 assertEq(2, cell7.tableCellRowIndex); 217 assertEq(2, cell7.tableCellRowIndex);
218 assertEq(1, cell7.tableCellRowSpan); 218 assertEq(1, cell7.tableCellRowSpan);
219 219
220 chrome.test.succeed(); 220 chrome.test.succeed();
221 }, 221 },
222 222
223 function testNoAttributes() { 223 function testNoAttributes() {
224 var div = rootNode.find({ attributes: { description: 'main' } }); 224 var div = rootNode.find({ attributes: { name: 'main' } });
225 assertTrue(div !== undefined); 225 assertTrue(div !== undefined);
226 var allAttributes = [].concat(ActiveDescendantAttribute, 226 var allAttributes = [].concat(ActiveDescendantAttribute,
227 LinkAttributes, 227 LinkAttributes,
228 DocumentAttributes, 228 DocumentAttributes,
229 ScrollableAttributes, 229 ScrollableAttributes,
230 EditableTextAttributes, 230 EditableTextAttributes,
231 RangeAttributes, 231 RangeAttributes,
232 TableAttributes, 232 TableAttributes,
233 TableCellAttributes); 233 TableCellAttributes);
234 for (var attributeAttr in allAttributes) { 234 for (var attributeAttr in allAttributes) {
235 assertFalse(attributeAttr in div); 235 assertFalse(attributeAttr in div);
236 } 236 }
237 chrome.test.succeed(); 237 chrome.test.succeed();
238 } 238 }
239 ]; 239 ];
240 240
241 setUpAndRunTests(allTests, 'attributes.html'); 241 setUpAndRunTests(allTests, 'attributes.html');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698