Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 var initialize_AccessibilityTest = function() { | |
| 2 | |
| 3 var sidebarPane; | |
| 4 | |
| 5 InspectorTest.showAccessibilityWidget = function() | |
| 6 { | |
| 7 var sidebarPaneWrappers = WebInspector.panels.elements._elementsSidebarViewW rappers; | |
|
dgozman
2016/07/22 16:44:29
These panes are loaded asynchronously. We should w
| |
| 8 var sidebarPaneWrapper = sidebarPaneWrappers.find((wrapper) => { return wrap per._title === "Accessibility"; }); | |
| 9 | |
| 10 sidebarPaneWrapper.expandPane(); | |
| 11 sidebarPane = sidebarPaneWrapper.children()[0]; | |
| 12 } | |
| 13 | |
| 14 /** | |
| 15 * @param {string} idValue | |
| 16 * @param {function(!WebInspector.DOMNode)} callback | |
| 17 */ | |
| 18 InspectorTest.selectNodeAndWaitForAccessibility = function(idValue, callback) | |
| 19 { | |
| 20 callback = InspectorTest.safeWrap(callback); | |
| 21 | |
| 22 var targetNode; | |
| 23 | |
| 24 InspectorTest.selectNodeWithId(idValue, nodeSelected); | |
| 25 InspectorTest.waitForAccessibilityNodeUpdate(callback); | |
| 26 | |
| 27 /** | |
| 28 * @param {!WebInspector.DOMNode} node | |
| 29 */ | |
| 30 function nodeSelected(node) | |
| 31 { | |
| 32 targetNode = node; | |
| 33 } | |
| 34 } | |
| 35 | |
| 36 InspectorTest.dumpSelectedElementAccessibilityNode = function() | |
| 37 { | |
| 38 if (!sidebarPane) | |
| 39 InspectorTest.showAccessibilityWidget(); | |
| 40 | |
| 41 InspectorTest.dumpAccessibilityNode(sidebarPane._axNodeSubPane._axNode); | |
| 42 } | |
| 43 | |
| 44 /** | |
| 45 * @param {!AccessibilityAgent.AXNode} accessibilityNode | |
| 46 */ | |
| 47 InspectorTest.dumpAccessibilityNode = function(accessibilityNode) | |
| 48 { | |
| 49 if (!accessibilityNode) { | |
| 50 InspectorTest.addResult("<null>"); | |
| 51 return; | |
| 52 } | |
| 53 var builder = []; | |
| 54 builder.push(accessibilityNode.role.value); | |
| 55 builder.push('"' + accessibilityNode.name.value + '"'); | |
| 56 | |
| 57 for (var property of accessibilityNode.properties) | |
| 58 builder.push(property.name + '="' + property.value.value + '"'); | |
| 59 | |
| 60 InspectorTest.addResult(builder.join(" ")); | |
| 61 } | |
| 62 | |
| 63 /** | |
| 64 * @param {!AccessibilitySidebarView} sidebarPane | |
| 65 * @param {string} attribute | |
| 66 * @return {?WebInspector.ARIAAttributesTreeElement} | |
| 67 */ | |
| 68 InspectorTest.findARIAAttributeTreeElement = function(attribute) | |
| 69 { | |
| 70 var ariaSubPane = sidebarPane._ariaSubPane; | |
| 71 var treeOutline = ariaSubPane._treeOutline; | |
| 72 var childNodes = treeOutline._rootElement._children; | |
| 73 for (var treeElement of childNodes) { | |
| 74 if (treeElement._attribute.name === attribute) | |
| 75 return treeElement; | |
| 76 } | |
| 77 return null; | |
| 78 } | |
| 79 | |
| 80 /** | |
| 81 * @param {function()} callback | |
| 82 */ | |
| 83 InspectorTest.waitForAccessibilityNodeUpdate = function(callback) | |
| 84 { | |
| 85 InspectorTest.addSniffer(WebInspector.AccessibilitySidebarView.prototype, "_ accessibilityNodeUpdatedForTest", callback); | |
| 86 } | |
| 87 }; | |
| OLD | NEW |