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 var result = JSON.parse(JSON.stringify(state)); | 8 var result = JSON.parse(JSON.stringify(state)); |
9 delete result[StateType.horizontal]; | 9 delete result[StateType.HORIZONTAL]; |
10 delete result[StateType.hovered]; | 10 delete result[StateType.HOVERED]; |
11 delete result[StateType.vertical]; | 11 delete result[StateType.VERTICAL]; |
12 return result; | 12 return result; |
13 }; | 13 }; |
14 | 14 |
15 var allTests = [ | 15 var allTests = [ |
16 function testSimplePage() { | 16 function testSimplePage() { |
17 var title = rootNode.docTitle; | 17 var title = rootNode.docTitle; |
18 assertEq('Automation Tests', title); | 18 assertEq('Automation Tests', title); |
19 | 19 |
20 var state = RemoveUntestedStates(rootNode.state); | 20 var state = RemoveUntestedStates(rootNode.state); |
21 assertEq( | 21 assertEq( |
22 {focusable: true, readOnly: true, focused: true}, | 22 {focusable: true, readOnly: true, focused: true}, |
23 state); | 23 state); |
24 | 24 |
25 var children = rootNode.children; | 25 var children = rootNode.children; |
26 assertEq(RoleType.rootWebArea, rootNode.role); | 26 assertEq(RoleType.ROOT_WEB_AREA, rootNode.role); |
27 assertEq(1, children.length); | 27 assertEq(1, children.length); |
28 var body = children[0]; | 28 var body = children[0]; |
29 assertEq('body', body.htmlTag); | |
30 state = RemoveUntestedStates(body.state); | 29 state = RemoveUntestedStates(body.state); |
31 assertEq({readOnly: true}, state); | 30 assertEq({readOnly: true}, state); |
32 | 31 |
33 var contentChildren = body.children; | 32 var contentChildren = body.children; |
34 assertEq(3, contentChildren.length); | 33 assertEq(3, contentChildren.length); |
35 var okButton = contentChildren[0]; | 34 var okButton = contentChildren[0]; |
36 assertEq('Ok', okButton.name); | 35 assertEq('Ok', okButton.name); |
37 state = RemoveUntestedStates(okButton.state); | 36 state = RemoveUntestedStates(okButton.state); |
38 assertEq({focusable: true, readOnly: true}, state); | 37 assertEq({focusable: true, readOnly: true}, state); |
39 var userNameInput = contentChildren[1]; | 38 var userNameInput = contentChildren[1]; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 chrome.test.succeed(); | 73 chrome.test.succeed(); |
75 }, | 74 }, |
76 function testIsRoot() { | 75 function testIsRoot() { |
77 assertTrue(rootNode.isRootNode); | 76 assertTrue(rootNode.isRootNode); |
78 assertFalse(rootNode.firstChild.isRootNode); | 77 assertFalse(rootNode.firstChild.isRootNode); |
79 chrome.test.succeed(); | 78 chrome.test.succeed(); |
80 } | 79 } |
81 ]; | 80 ]; |
82 | 81 |
83 setUpAndRunTests(allTests); | 82 setUpAndRunTests(allTests); |
OLD | NEW |