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
3 // found in the LICENSE file.
5 // Do not test orientation or hover attributes (similar to exclusions on native
6 // accessibility), since they can be inconsistent depending on the environment.
7 var RemoveUntestedStates = function(state) {
8 delete state[StateType.horizontal];
9 delete state[StateType.hovered];
10 delete state[StateType.vertical];
14 function testSimplePage() {
15 var title = rootNode.attributes.docTitle;
16 assertEq('Automation Tests', title);
17 RemoveUntestedStates(rootNode.state);
19 {enabled: true, focusable: true, readOnly: true},
21 var children = rootNode.children();
22 assertEq(1, children.length);
23 var body = children[0];
24 assertEq('body', body.attributes.htmlTag);
26 RemoveUntestedStates(body.state);
27 assertEq({enabled: true, readOnly: true},
30 var contentChildren = body.children();
31 assertEq(3, contentChildren.length);
32 var okButton = contentChildren[0];
33 assertEq('Ok', okButton.attributes.name);
34 RemoveUntestedStates(okButton.state);
35 assertEq({enabled: true, focusable: true, readOnly: true},
37 var userNameInput = contentChildren[1];
39 userNameInput.attributes.description);
40 RemoveUntestedStates(userNameInput.state);
41 assertEq({enabled: true, focusable: true},
43 var cancelButton = contentChildren[2];
45 cancelButton.attributes.name);
46 RemoveUntestedStates(cancelButton.state);
47 assertEq({enabled: true, focusable: true, readOnly: true},
51 assertEq(undefined, rootNode.parent());
52 assertEq(rootNode, body.parent());
54 assertEq(body, rootNode.firstChild());
55 assertEq(body, rootNode.lastChild());
57 assertEq(okButton, body.firstChild());
58 assertEq(cancelButton, body.lastChild());
60 assertEq(body, okButton.parent());
61 assertEq(body, userNameInput.parent());
62 assertEq(body, cancelButton.parent());
64 assertEq(undefined, okButton.previousSibling());
65 assertEq(undefined, okButton.firstChild());
66 assertEq(userNameInput, okButton.nextSibling());
67 assertEq(undefined, okButton.lastChild());
69 assertEq(okButton, userNameInput.previousSibling());
70 assertEq(cancelButton, userNameInput.nextSibling());
72 assertEq(userNameInput, cancelButton.previousSibling());
73 assertEq(undefined, cancelButton.nextSibling());
75 chrome.test.succeed();
77 function testIsRoot() {
78 assertTrue(rootNode.isRootNode);
79 assertFalse(rootNode.firstChild().isRootNode);
80 chrome.test.succeed();
84 setUpAndRunTests(allTests);