Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: chrome/test/data/extensions/api_test/automation/tests/tabs/sanity_check.js

Issue 2151713002: Less strict checked state changes and introduce disabled state for content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: m Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 {enabled: true, 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.rootWebArea, 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); 29 assertEq('body', body.htmlTag);
30 state = RemoveUntestedStates(body.state); 30 state = RemoveUntestedStates(body.state);
31 assertEq({enabled: true, readOnly: true}, state); 31 assertEq({readOnly: true}, state);
32 32
33 var contentChildren = body.children; 33 var contentChildren = body.children;
34 assertEq(3, contentChildren.length); 34 assertEq(3, contentChildren.length);
35 var okButton = contentChildren[0]; 35 var okButton = contentChildren[0];
36 assertEq('Ok', okButton.name); 36 assertEq('Ok', okButton.name);
37 state = RemoveUntestedStates(okButton.state); 37 state = RemoveUntestedStates(okButton.state);
38 assertEq({enabled: true, focusable: true, readOnly: true}, state); 38 assertEq({focusable: true, readOnly: true}, state);
39 var userNameInput = contentChildren[1]; 39 var userNameInput = contentChildren[1];
40 assertEq('Username', userNameInput.name); 40 assertEq('Username', userNameInput.name);
41 state = RemoveUntestedStates(userNameInput.state); 41 state = RemoveUntestedStates(userNameInput.state);
42 assertEq({editable: true, enabled: true, focusable: true}, state); 42 assertEq({editable: true, focusable: true}, state);
43 var cancelButton = contentChildren[2]; 43 var cancelButton = contentChildren[2];
44 assertEq('Cancel', 44 assertEq('Cancel',
45 cancelButton.name); 45 cancelButton.name);
46 state = RemoveUntestedStates(cancelButton.state); 46 state = RemoveUntestedStates(cancelButton.state);
47 assertEq({enabled: true, focusable: true, readOnly: true}, state); 47 assertEq({focusable: true, readOnly: true}, state);
48 48
49 // Traversal. 49 // Traversal.
50 assertEq(undefined, rootNode.parent); 50 assertEq(undefined, rootNode.parent);
51 assertEq(rootNode, body.parent); 51 assertEq(rootNode, body.parent);
52 52
53 assertEq(body, rootNode.firstChild); 53 assertEq(body, rootNode.firstChild);
54 assertEq(body, rootNode.lastChild); 54 assertEq(body, rootNode.lastChild);
55 55
56 assertEq(okButton, body.firstChild); 56 assertEq(okButton, body.firstChild);
57 assertEq(cancelButton, body.lastChild); 57 assertEq(cancelButton, body.lastChild);
(...skipping 16 matching lines...) Expand all
74 chrome.test.succeed(); 74 chrome.test.succeed();
75 }, 75 },
76 function testIsRoot() { 76 function testIsRoot() {
77 assertTrue(rootNode.isRootNode); 77 assertTrue(rootNode.isRootNode);
78 assertFalse(rootNode.firstChild.isRootNode); 78 assertFalse(rootNode.firstChild.isRootNode);
79 chrome.test.succeed(); 79 chrome.test.succeed();
80 } 80 }
81 ]; 81 ];
82 82
83 setUpAndRunTests(allTests); 83 setUpAndRunTests(allTests);
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/automation/tests/tabs/find.js ('k') | components/pdf/renderer/pdf_accessibility_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698