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 // Do not test orientation or hover attributes (similar to exclusions on native | 5 // Do not test orientation or hover attributes (similar to exclusions on native |
6 // accessibility), since they can be inconsistent depending on the environment. | 6 // accessibility), since they can be inconsistent depending on the environment. |
7 var RemoveUntestedStates = function(state) { | 7 var RemoveUntestedStates = function(state) { |
8 delete state[StateType.horizontal]; | 8 var result = JSON.parse(JSON.stringify(state)); |
aboxhall
2015/06/11 17:42:46
So annoying there's not a better (simple) way to d
dmazzoni
2015/06/12 17:51:36
Acknowledged.
| |
9 delete state[StateType.hovered]; | 9 delete result[StateType.horizontal]; |
10 delete state[StateType.vertical]; | 10 delete result[StateType.hovered]; |
11 delete result[StateType.vertical]; | |
12 return result; | |
11 }; | 13 }; |
12 | 14 |
13 var allTests = [ | 15 var allTests = [ |
14 function testSimplePage() { | 16 function testSimplePage() { |
15 var title = rootNode.docTitle; | 17 var title = rootNode.docTitle; |
16 assertEq('Automation Tests', title); | 18 assertEq('Automation Tests', title); |
17 RemoveUntestedStates(rootNode.state); | 19 |
20 var state = RemoveUntestedStates(rootNode.state); | |
18 assertEq( | 21 assertEq( |
19 {enabled: true, focusable: true, readOnly: true}, | 22 {enabled: true, focusable: true, readOnly: true}, |
20 rootNode.state); | 23 state); |
24 | |
21 var children = rootNode.children; | 25 var children = rootNode.children; |
22 assertEq(RoleType.rootWebArea, rootNode.role); | 26 assertEq(RoleType.rootWebArea, rootNode.role); |
23 assertEq(1, children.length); | 27 assertEq(1, children.length); |
24 var body = children[0]; | 28 var body = children[0]; |
25 assertEq('body', body.htmlTag); | 29 assertEq('body', body.htmlTag); |
26 | 30 state = RemoveUntestedStates(body.state); |
27 RemoveUntestedStates(body.state); | 31 assertEq({enabled: true, readOnly: true}, state); |
28 assertEq({enabled: true, readOnly: true}, | |
29 body.state); | |
30 | 32 |
31 var contentChildren = body.children; | 33 var contentChildren = body.children; |
32 assertEq(3, contentChildren.length); | 34 assertEq(3, contentChildren.length); |
33 var okButton = contentChildren[0]; | 35 var okButton = contentChildren[0]; |
34 assertEq('Ok', okButton.name); | 36 assertEq('Ok', okButton.name); |
35 RemoveUntestedStates(okButton.state); | 37 state = RemoveUntestedStates(okButton.state); |
36 assertEq({enabled: true, focusable: true, readOnly: true}, | 38 assertEq({enabled: true, focusable: true, readOnly: true}, state); |
37 okButton.state); | |
38 var userNameInput = contentChildren[1]; | 39 var userNameInput = contentChildren[1]; |
39 assertEq('Username', | 40 assertEq('Username', |
40 userNameInput.description); | 41 userNameInput.description); |
41 RemoveUntestedStates(userNameInput.state); | 42 state = RemoveUntestedStates(userNameInput.state); |
42 assertEq({enabled: true, focusable: true}, | 43 assertEq({enabled: true, focusable: true}, state); |
43 userNameInput.state); | |
44 var cancelButton = contentChildren[2]; | 44 var cancelButton = contentChildren[2]; |
45 assertEq('Cancel', | 45 assertEq('Cancel', |
46 cancelButton.name); | 46 cancelButton.name); |
47 RemoveUntestedStates(cancelButton.state); | 47 state = RemoveUntestedStates(cancelButton.state); |
48 assertEq({enabled: true, focusable: true, readOnly: true}, | 48 assertEq({enabled: true, focusable: true, readOnly: true}, state); |
49 cancelButton.state); | |
50 | 49 |
51 // Traversal. | 50 // Traversal. |
52 assertEq(undefined, rootNode.parent); | 51 assertEq(undefined, rootNode.parent); |
53 assertEq(rootNode, body.parent); | 52 assertEq(rootNode, body.parent); |
54 | 53 |
55 assertEq(body, rootNode.firstChild); | 54 assertEq(body, rootNode.firstChild); |
56 assertEq(body, rootNode.lastChild); | 55 assertEq(body, rootNode.lastChild); |
57 | 56 |
58 assertEq(okButton, body.firstChild); | 57 assertEq(okButton, body.firstChild); |
59 assertEq(cancelButton, body.lastChild); | 58 assertEq(cancelButton, body.lastChild); |
(...skipping 16 matching lines...) Expand all Loading... | |
76 chrome.test.succeed(); | 75 chrome.test.succeed(); |
77 }, | 76 }, |
78 function testIsRoot() { | 77 function testIsRoot() { |
79 assertTrue(rootNode.isRootNode); | 78 assertTrue(rootNode.isRootNode); |
80 assertFalse(rootNode.firstChild.isRootNode); | 79 assertFalse(rootNode.firstChild.isRootNode); |
81 chrome.test.succeed(); | 80 chrome.test.succeed(); |
82 } | 81 } |
83 ]; | 82 ]; |
84 | 83 |
85 setUpAndRunTests(allTests); | 84 setUpAndRunTests(allTests); |
OLD | NEW |