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

Unified 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: Add test scaffolding and test Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/inspector/elements/accessibility/accessibility-pane-test.js
diff --git a/third_party/WebKit/LayoutTests/inspector/elements/accessibility/accessibility-pane-test.js b/third_party/WebKit/LayoutTests/inspector/elements/accessibility/accessibility-pane-test.js
new file mode 100644
index 0000000000000000000000000000000000000000..d10da8679d500da9ad2d5d472ef3c75784112eca
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector/elements/accessibility/accessibility-pane-test.js
@@ -0,0 +1,87 @@
+var initialize_AccessibilityTest = function() {
+
+var sidebarPane;
+
+InspectorTest.showAccessibilityWidget = function()
+{
+ var sidebarPaneWrappers = WebInspector.panels.elements._elementsSidebarViewWrappers;
dgozman 2016/07/22 16:44:29 These panes are loaded asynchronously. We should w
+ var sidebarPaneWrapper = sidebarPaneWrappers.find((wrapper) => { return wrapper._title === "Accessibility"; });
+
+ sidebarPaneWrapper.expandPane();
+ sidebarPane = sidebarPaneWrapper.children()[0];
+}
+
+/**
+ * @param {string} idValue
+ * @param {function(!WebInspector.DOMNode)} callback
+ */
+InspectorTest.selectNodeAndWaitForAccessibility = function(idValue, callback)
+{
+ callback = InspectorTest.safeWrap(callback);
+
+ var targetNode;
+
+ InspectorTest.selectNodeWithId(idValue, nodeSelected);
+ InspectorTest.waitForAccessibilityNodeUpdate(callback);
+
+ /**
+ * @param {!WebInspector.DOMNode} node
+ */
+ function nodeSelected(node)
+ {
+ targetNode = node;
+ }
+}
+
+InspectorTest.dumpSelectedElementAccessibilityNode = function()
+{
+ if (!sidebarPane)
+ InspectorTest.showAccessibilityWidget();
+
+ InspectorTest.dumpAccessibilityNode(sidebarPane._axNodeSubPane._axNode);
+}
+
+/**
+ * @param {!AccessibilityAgent.AXNode} accessibilityNode
+ */
+InspectorTest.dumpAccessibilityNode = function(accessibilityNode)
+{
+ if (!accessibilityNode) {
+ InspectorTest.addResult("<null>");
+ return;
+ }
+ var builder = [];
+ builder.push(accessibilityNode.role.value);
+ builder.push('"' + accessibilityNode.name.value + '"');
+
+ for (var property of accessibilityNode.properties)
+ builder.push(property.name + '="' + property.value.value + '"');
+
+ InspectorTest.addResult(builder.join(" "));
+}
+
+/**
+ * @param {!AccessibilitySidebarView} sidebarPane
+ * @param {string} attribute
+ * @return {?WebInspector.ARIAAttributesTreeElement}
+ */
+InspectorTest.findARIAAttributeTreeElement = function(attribute)
+{
+ var ariaSubPane = sidebarPane._ariaSubPane;
+ var treeOutline = ariaSubPane._treeOutline;
+ var childNodes = treeOutline._rootElement._children;
+ for (var treeElement of childNodes) {
+ if (treeElement._attribute.name === attribute)
+ return treeElement;
+ }
+ return null;
+}
+
+/**
+ * @param {function()} callback
+ */
+InspectorTest.waitForAccessibilityNodeUpdate = function(callback)
+{
+ InspectorTest.addSniffer(WebInspector.AccessibilitySidebarView.prototype, "_accessibilityNodeUpdatedForTest", callback);
+}
+};

Powered by Google App Engine
This is Rietveld 408576698