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

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: Rebase and fix test 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/elements/accessibility/edit-aria-attributes.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.revealWidget();
11 return InspectorTest.waitForAccessibilityNodeUpdate();
12 } else {
13 return _waitForViewsLoaded()
14 .then(() => {
15 return InspectorTest.showAccessibilityView();
16 });
17 }
18 }
19
20
21 /**
22 * @return {Promise}
23 */
24 function _waitForViewsLoaded()
25 {
26 return new Promise(function(resolve, reject)
27 {
28 InspectorTest.addSniffer(WebInspector.ElementsPanel.prototype,
29 "_sidebarViewsLoadedForTest",
30 resolve);
31 WebInspector.panels.elements._loadSidebarViews();
32 });
33 }
34
35 function _getAccessibilitySidebarPane()
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) {
83 for (var property of accessibilityNode.properties) {
84 if ("value" in property)
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.addResult("Could not get Accessibility sidebar pane.");
101 InspectorTest.completeTest();
102 return;
103 }
104
105 var ariaSubPane = sidebarPane._ariaSubPane;
106 var treeOutline = ariaSubPane._treeOutline;
107 var childNodes = treeOutline._rootElement._children;
108 for (var treeElement of childNodes) {
109 if (treeElement._attribute.name === attribute)
110 return treeElement;
111 }
112 return null;
113 }
114
115 /**
116 * @return {Promise}
117 */
118 InspectorTest.waitForAccessibilityNodeUpdate = function()
119 {
120 return new Promise(function(resolve, reject)
121 {
122 InspectorTest.addSniffer(WebInspector.AccessibilitySidebarView.prototype , "_accessibilityNodeUpdatedForTest", resolve);
123 });
124 }
125
126 /**
127 * @return {Promise}
128 */
129 InspectorTest.waitForAccessibilityNodeUpdateInARIAPane = function()
130 {
131 return new Promise(function(resolve, reject)
132 {
133 InspectorTest.addSniffer(WebInspector.ARIAAttributesPane.prototype, "_go tNodeForTest", resolve);
134 });
135 }
136 };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/elements/accessibility/edit-aria-attributes.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698