OLD | NEW |
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 chrome.test.succeed(); | 251 chrome.test.succeed(); |
252 }, | 252 }, |
253 | 253 |
254 function testNameFrom() { | 254 function testNameFrom() { |
255 var link = rootNode.find({ role: 'link' }); | 255 var link = rootNode.find({ role: 'link' }); |
256 assertEq(chrome.automation.NameFromType.CONTENTS, link.nameFrom); | 256 assertEq(chrome.automation.NameFromType.CONTENTS, link.nameFrom); |
257 var textarea = rootNode.find({ attributes: { name: 'textarea' } }); | 257 var textarea = rootNode.find({ attributes: { name: 'textarea' } }); |
258 assertEq(chrome.automation.NameFromType.ATTRIBUTE, textarea.nameFrom); | 258 assertEq(chrome.automation.NameFromType.ATTRIBUTE, textarea.nameFrom); |
259 chrome.test.succeed(); | 259 chrome.test.succeed(); |
260 }, | 260 }, |
| 261 |
| 262 function testCheckedAttribute() { |
| 263 // Checkbox can use all 3 checked attribute values: true|false|mixed |
| 264 var checkTest1 = rootNode.find({ attributes: { name: 'check-test-1' } }); |
| 265 assertTrue(Boolean(checkTest1)); |
| 266 assertEq(checkTest1.checked, 'true'); |
| 267 |
| 268 var checkTest2 = rootNode.find({ attributes: { name: 'check-test-2' } }); |
| 269 assertTrue(Boolean(checkTest2)); |
| 270 assertEq(checkTest2.checked, 'false'); |
| 271 |
| 272 var checkTest3 = rootNode.find({ attributes: { name: 'check-test-3' } }); |
| 273 assertTrue(Boolean(checkTest3)); |
| 274 assertEq(checkTest3.checked, 'mixed'); |
| 275 |
| 276 // Uncheckable nodes have a checked attribute of undefined |
| 277 var checkTest4 = rootNode.find({ attributes: { name: 'check-test-4' } }); |
| 278 assertTrue(Boolean(checkTest4)); |
| 279 assertEq(checkTest4.checked, undefined); |
| 280 |
| 281 chrome.test.succeed(); |
| 282 }, |
261 ]; | 283 ]; |
262 | 284 |
263 setUpAndRunTests(allTests, 'attributes.html'); | 285 setUpAndRunTests(allTests, 'attributes.html'); |
OLD | NEW |