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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/elements/accessibility/accessibility-pane-test.js

Issue 2058323002: Add ARIA panel to accessibility sidebar pane (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test and add test expectation 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
(Empty)
1 var initialize_AccessibilityTest = function() {
2
3 /**
4 * @return {Promise}
5 */
6 InspectorTest.showAccessibilityView = function()
7 {
8 var sidebarPane = _getAccessibilitySidebarPane();
9 if (sidebarPane) {
10 sidebarPane.requestReveal();
11 return Promise.resolve(sidebarPane);
12 } else {
13 return _waitForViewsLoaded()
14 .then(() => {
dgozman 2016/07/25 17:39:38 I think we can just pass result of Promise.all() i
aboxhall 2016/07/25 19:49:19 Hm, I think I need to extra wrapper so that Promis
dgozman 2016/07/25 22:41:53 You are right! I missed that.
15 return Promise.all([InspectorTest.waitForAccessibilityNode Update(),
16 InspectorTest.showAccessibilityView()] );
17 });
18 }
19 }
20
21
22 /**
23 * @return {Promise}
24 */
25 _waitForViewsLoaded = function() {
dgozman 2016/07/25 17:39:38 InspectorTest._waitForViewsLoaded
aboxhall 2016/07/25 19:49:19 I figured it doesn't need to be accessible outside
dgozman 2016/07/25 22:41:53 It doesn't, but that's how we usually name them. A
26 return new Promise(function(resolve, reject)
27 {
28 InspectorTest.addSniffer(WebInspector.ElementsPanel.prototype,
29 "_sidebarViewsLoadedForTest",
30 () => { resolve(); });
dgozman 2016/07/25 17:39:38 Can just pass |resolve| as a sniffer.
aboxhall 2016/07/25 19:49:19 Done.
31 WebInspector.panels.elements._loadSidebarViews();
32 });
33 }
34
35 _getAccessibilitySidebarPane = function()
dgozman 2016/07/25 17:39:38 InspectorTest._getAccessibilitySidebarPane
aboxhall 2016/07/25 19:49:19 Similar to above.
36 {
37 var sidebarViews = WebInspector.panels.elements._elementsSidebarViews;
38 var sidebarPane = sidebarViews.find((view) => { return view._title === "Acce ssibility"; });
39 return sidebarPane;
40 }
41
42 /**
43 * @param {string} idValue
44 * @return {Promise}
45 */
46 InspectorTest.selectNodeAndWaitForAccessibility = function(idValue)
47 {
48 return Promise.all([InspectorTest.waitForAccessibilityNodeUpdateInARIAPane() ,
49 InspectorTest.waitForAccessibilityNodeUpdate(),
50 new Promise(function(resolve) {
51 InspectorTest.selectNodeWithId(idValue, resolve);
52 })]);
53 }
54
55 InspectorTest.dumpSelectedElementAccessibilityNode = function()
56 {
57 var sidebarPane = _getAccessibilitySidebarPane();
58
59 if (!sidebarPane) {
60 InspectorTest.addResult('No sidebarPane in dumpSelectedElementAccessibil ityNode');
61 InspectorTest.completeTest();
62 return;
63 }
64 InspectorTest.dumpAccessibilityNode(sidebarPane._axNodeSubPane._axNode);
65 }
66
67 /**
68 * @param {!AccessibilityAgent.AXNode} accessibilityNode
69 */
70 InspectorTest.dumpAccessibilityNode = function(accessibilityNode)
71 {
72 if (!accessibilityNode) {
73 InspectorTest.addResult("<null>");
74 InspectorTest.completeTest();
75 return;
76 }
77
78 var builder = [];
79 builder.push(accessibilityNode.role.value);
80 builder.push(accessibilityNode.name ? '"' + accessibilityNode.name.value + ' "'
81 : "<undefined>");
82 if ('properties' in accessibilityNode) {
dgozman 2016/07/25 17:39:38 style: double quotes
aboxhall 2016/07/25 19:49:19 Oh, weird presubmit didn't catch that. Fixed.
83 for (var property of accessibilityNode.properties) {
84 if ('value' in property)
dgozman 2016/07/25 17:39:38 ditto
aboxhall 2016/07/25 19:49:19 Done.
85 builder.push(property.name + '="' + property.value.value + '"');
86 }
87 }
88 InspectorTest.addResult(builder.join(" "));
89 }
90
91 /**
92 * @param {string} attribute
93 * @return {?WebInspector.ARIAAttributesTreeElement}
94 */
95 InspectorTest.findARIAAttributeTreeElement = function(attribute)
96 {
97 var sidebarPane = _getAccessibilitySidebarPane();
98
99 if (!sidebarPane) {
100 InspectorTest.completeTest();
dgozman 2016/07/25 17:39:38 Add error message similar to above.
aboxhall 2016/07/25 19:49:19 Done.
101 return;
102 }
103
104 var ariaSubPane = sidebarPane._ariaSubPane;
105 var treeOutline = ariaSubPane._treeOutline;
106 var childNodes = treeOutline._rootElement._children;
107 for (var treeElement of childNodes) {
108 if (treeElement._attribute.name === attribute)
109 return treeElement;
110 }
111 return null;
112 }
113
114 /**
115 * @return {Promise}
116 */
117 InspectorTest.waitForAccessibilityNodeUpdate = function()
118 {
119 return new Promise(function(resolve, reject)
120 {
121 InspectorTest.addSniffer(WebInspector.AccessibilitySidebarView.prototype , "_accessibilityNodeUpdatedForTest", resolve);
122 });
123 }
124
125 /**
126 * @return {Promise}
127 */
128 InspectorTest.waitForAccessibilityNodeUpdateInARIAPane = function()
129 {
130 return new Promise(function(resolve, reject)
131 {
132 InspectorTest.addSniffer(WebInspector.ARIAAttributesPane.prototype, "_go tNodeForTest", resolve);
133 });
134 }
135 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698