| 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 delete state[StateType.horizontal]; |
| 9 delete state[StateType.hovered]; | 9 delete state[StateType.hovered]; |
| 10 delete state[StateType.vertical]; | 10 delete state[StateType.vertical]; |
| 11 }; | 11 }; |
| 12 | 12 |
| 13 var allTests = [ | 13 var allTests = [ |
| 14 function testSimplePage() { | 14 function testSimplePage() { |
| 15 var title = tree.root.attributes.docTitle; | 15 var title = tree.root.attributes.docTitle; |
| 16 assertEq('Automation Tests', title); | 16 assertEq('Automation Tests', title); |
| 17 RemoveUntestedStates(tree.root.state); | 17 RemoveUntestedStates(tree.root.state); |
| 18 assertEq( | 18 assertEq( |
| 19 {enabled: true, focusable: true, readOnly: true}, | 19 {enabled: true, focusable: true, readOnly: true}, |
| 20 tree.root.state); | 20 tree.root.state); |
| 21 var children = tree.root.children(); | 21 var children = tree.root.children(); |
| 22 assertEq(1, children.length); | 22 assertEq(1, children.length); |
| 23 | |
| 24 var body = children[0]; | 23 var body = children[0]; |
| 25 assertEq('body', body.attributes.htmlTag); | 24 assertEq('body', body.attributes.htmlTag); |
| 26 | 25 |
| 27 RemoveUntestedStates(body.state); | 26 RemoveUntestedStates(body.state); |
| 28 assertEq({enabled: true, readOnly: true}, | 27 assertEq({enabled: true, readOnly: true}, |
| 29 body.state); | 28 body.state); |
| 30 | 29 |
| 31 var contentChildren = body.children(); | 30 var contentChildren = body.children(); |
| 32 assertEq(3, contentChildren.length); | 31 assertEq(3, contentChildren.length); |
| 33 var okButton = contentChildren[0]; | 32 var okButton = contentChildren[0]; |
| 34 assertEq('Ok', okButton.attributes.name); | 33 assertEq('Ok', okButton.attributes.name); |
| 35 RemoveUntestedStates(okButton.state); | 34 RemoveUntestedStates(okButton.state); |
| 36 assertEq({enabled: true, focusable: true, readOnly: true}, | 35 assertEq({enabled: true, focusable: true, readOnly: true}, |
| 37 okButton.state); | 36 okButton.state); |
| 38 var userNameInput = contentChildren[1]; | 37 var userNameInput = contentChildren[1]; |
| 39 assertEq('Username', | 38 assertEq('Username', |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 assertEq(cancelButton, userNameInput.nextSibling()); | 70 assertEq(cancelButton, userNameInput.nextSibling()); |
| 72 | 71 |
| 73 assertEq(userNameInput, cancelButton.previousSibling()); | 72 assertEq(userNameInput, cancelButton.previousSibling()); |
| 74 assertEq(undefined, cancelButton.nextSibling()); | 73 assertEq(undefined, cancelButton.nextSibling()); |
| 75 | 74 |
| 76 chrome.test.succeed(); | 75 chrome.test.succeed(); |
| 77 } | 76 } |
| 78 ]; | 77 ]; |
| 79 | 78 |
| 80 setUpAndRunTests(allTests); | 79 setUpAndRunTests(allTests); |
| OLD | NEW |