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

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

Issue 514363002: Remove attributes and methods which should not be part of the public API (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Rewrite unit test in terms of HTML IDs rather than automation IDs Created 6 years, 3 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
« no previous file with comments | « chrome/renderer/resources/extensions/automation/automation_node.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 chrome.test.runWithModuleSystem(function(moduleSystem) { 5 chrome.test.runWithModuleSystem(function(moduleSystem) {
6 window.AutomationRootNode = 6 window.AutomationRootNode =
7 moduleSystem.require('automationNode').AutomationRootNode; 7 moduleSystem.require('automationNode').AutomationRootNode;
8 window.privates = moduleSystem.privates; 8 window.privates = moduleSystem.privates;
9 }); 9 });
10 10
(...skipping 27 matching lines...) Expand all
38 'childIds': [5, 6, 7, 8, 9, 10, 11] 38 'childIds': [5, 6, 7, 8, 9, 10, 11]
39 }, 39 },
40 { 40 {
41 'id': 11, 'role': 'div', 41 'id': 11, 'role': 'div',
42 'childIds': [], 42 'childIds': [],
43 'htmlAttributes': {'id': 'target' } 43 'htmlAttributes': {'id': 'target' }
44 }, 44 },
45 { 45 {
46 'id': 5, 'role': 'div', 46 'id': 5, 'role': 'div',
47 'childIds': [], 47 'childIds': [],
48 'htmlAttributes': {'aria-activedescendant': 'target'}, 48 'htmlAttributes': {'aria-activedescendant': 'target',
49 'id': 'activedescendant'},
49 'intAttributes': {'activedescendantId': 11}, 50 'intAttributes': {'activedescendantId': 11},
50 }, 51 },
51 { 52 {
52 'id': 6, 'role': 'div', 53 'id': 6, 'role': 'div',
53 'childIds': [], 54 'childIds': [],
54 'htmlAttributes': {'aria-controls': 'target'}, 55 'htmlAttributes': {'aria-controls': 'target', 'id': 'controlledBy'},
55 'intlistAttributes': {'controlsIds': [11]}, 56 'intlistAttributes': {'controlsIds': [11]},
56 }, 57 },
57 { 58 {
58 'id': 7, 'role': 'div', 59 'id': 7, 'role': 'div',
59 'childIds': [], 60 'childIds': [],
60 'htmlAttributes': {'aria-describedby': 'target'}, 61 'htmlAttributes': {'aria-describedby': 'target', 'id': 'describedBy'},
61 'intlistAttributes': {'describedbyIds': [11, 6]}, 62 'intlistAttributes': {'describedbyIds': [11, 6]},
62 }, 63 },
63 { 64 {
64 'id': 8, 'role': 'div', 65 'id': 8, 'role': 'div',
65 'childIds': [], 66 'childIds': [],
66 'htmlAttributes': {'aria-flowto': 'target'}, 67 'htmlAttributes': {'aria-flowto': 'target', 'id': 'flowTo'},
67 'intlistAttributes': {'flowtoIds': [11]}, 68 'intlistAttributes': {'flowtoIds': [11]},
68 }, 69 },
69 { 70 {
70 'id': 9, 'role': 'div', 71 'id': 9, 'role': 'div',
71 'childIds': [], 72 'childIds': [],
72 'htmlAttributes': {'aria-labelledby': 'target'}, 73 'htmlAttributes': {'aria-labelledby': 'target', 'id': 'labelledBy'},
73 'intlistAttributes': {'labelledbyIds': [11]} 74 'intlistAttributes': {'labelledbyIds': [11]}
74 }, 75 },
75 { 76 {
76 'id': 10, 'role': 'div', 77 'id': 10, 'role': 'div',
77 'childIds': [], 78 'childIds': [],
78 'htmlAttributes': {'aria-owns': 'target'}, 79 'htmlAttributes': {'aria-owns': 'target', 'id': 'owns'},
79 'intlistAttributes': {'ownsIds': [11]}, 80 'intlistAttributes': {'ownsIds': [11]},
80 } 81 }
81 ]} 82 ]}
82 } 83 }
83 84
84 var tree = new AutomationRootNode(); 85 var tree = new AutomationRootNode();
85 privates(tree).impl.onAccessibilityEvent(data); 86 privates(tree).impl.onAccessibilityEvent(data);
86 87
87 var activedescendant = tree.firstChild(); 88 var activedescendant = tree.firstChild();
88 assertIsDef(activedescendant); 89 assertIsDef(activedescendant);
89 assertEq(5, activedescendant.id); 90 assertEq('activedescendant', activedescendant.attributes.id);
90 assertEq(11, activedescendant.attributes['aria-activedescendant'].id); 91 assertEq(
92 'target',
93 activedescendant.attributes['aria-activedescendant'].attributes.id);
91 assertIsNotDef(activedescendant.attributes.activedescendantId); 94 assertIsNotDef(activedescendant.attributes.activedescendantId);
92 95
93 var controlledBy = activedescendant.nextSibling(); 96 var controlledBy = activedescendant.nextSibling();
94 assertIsDef(controlledBy); 97 assertIsDef(controlledBy);
95 assertEq(6, controlledBy.id); 98 assertEq('controlledBy', controlledBy.attributes.id);
96 assertEq(11, controlledBy.attributes['aria-controls'][0].id); 99 assertEq('target',
100 controlledBy.attributes['aria-controls'][0].attributes.id);
97 assertEq(1, controlledBy.attributes['aria-controls'].length); 101 assertEq(1, controlledBy.attributes['aria-controls'].length);
98 assertIsNotDef(controlledBy.attributes.controlledbyIds); 102 assertIsNotDef(controlledBy.attributes.controlledbyIds);
99 103
100 var describedBy = controlledBy.nextSibling(); 104 var describedBy = controlledBy.nextSibling();
101 assertIsDef(describedBy); 105 assertIsDef(describedBy);
102 assertEq(7, describedBy.id); 106 assertEq('describedBy', describedBy.attributes.id);
103 assertEq(11, describedBy.attributes['aria-describedby'][0].id); 107 assertEq('target',
104 assertEq(6, describedBy.attributes['aria-describedby'][1].id); 108 describedBy.attributes['aria-describedby'][0].attributes.id);
109 assertEq('controlledBy',
110 describedBy.attributes['aria-describedby'][1].attributes.id);
105 assertEq(2, describedBy.attributes['aria-describedby'].length); 111 assertEq(2, describedBy.attributes['aria-describedby'].length);
106 assertIsNotDef(describedBy.attributes.describedbyIds); 112 assertIsNotDef(describedBy.attributes.describedbyIds);
107 113
108 var flowTo = describedBy.nextSibling(); 114 var flowTo = describedBy.nextSibling();
109 assertIsDef(flowTo); 115 assertIsDef(flowTo);
110 assertEq(8, flowTo.id); 116 assertEq('flowTo', flowTo.attributes.id);
111 assertEq(11, flowTo.attributes['aria-flowto'][0].id); 117 assertEq('target',
118 flowTo.attributes['aria-flowto'][0].attributes.id);
112 assertEq(1, flowTo.attributes['aria-flowto'].length); 119 assertEq(1, flowTo.attributes['aria-flowto'].length);
113 assertIsNotDef(flowTo.attributes.flowtoIds); 120 assertIsNotDef(flowTo.attributes.flowtoIds);
114 121
115 var labelledBy = flowTo.nextSibling(); 122 var labelledBy = flowTo.nextSibling();
116 assertIsDef(labelledBy); 123 assertIsDef(labelledBy);
117 assertEq(9, labelledBy.id); 124 assertEq('labelledBy', labelledBy.attributes.id);
118 assertEq(11, labelledBy.attributes['aria-labelledby'][0].id); 125 assertEq('target',
126 labelledBy.attributes['aria-labelledby'][0].attributes.id);
119 assertEq(1, labelledBy.attributes['aria-labelledby'].length); 127 assertEq(1, labelledBy.attributes['aria-labelledby'].length);
120 assertIsNotDef(labelledBy.attributes.labelledbyIds); 128 assertIsNotDef(labelledBy.attributes.labelledbyIds);
121 129
122 var owns = labelledBy.nextSibling(); 130 var owns = labelledBy.nextSibling();
123 assertIsDef(owns); 131 assertIsDef(owns);
124 assertEq(10, owns.id); 132 assertEq('owns', owns.attributes.id);
125 assertEq(11, owns.attributes['aria-owns'][0].id); 133 assertEq('target', owns.attributes['aria-owns'][0].attributes.id);
126 assertEq(1, owns.attributes['aria-owns'].length); 134 assertEq(1, owns.attributes['aria-owns'].length);
127 assertIsNotDef(owns.attributes.ownsIds); 135 assertIsNotDef(owns.attributes.ownsIds);
128 136
129 succeed(); 137 succeed();
130 }, 138 },
131 139
132 function testCannotSetAttribute() { 140 function testCannotSetAttribute() {
133 var update = 141 var update =
134 { 142 {
135 'nodeIdToClear': 0, 'nodes': [ 143 'nodeIdToClear': 0, 'nodes': [
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 213
206 // Make sure the name changes. 214 // Make sure the name changes.
207 assertTrue(privates(tree).impl.unserialize(update)); 215 assertTrue(privates(tree).impl.unserialize(update));
208 assertEq('bar', button.attributes.name); 216 assertEq('bar', button.attributes.name);
209 217
210 succeed(); 218 succeed();
211 } 219 }
212 ]; 220 ];
213 221
214 chrome.test.runTests(tests); 222 chrome.test.runTests(tests);
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/automation/automation_node.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698