OLD | NEW |
1 function initialize_AuditTests() | 1 function initialize_AuditTests() |
2 { | 2 { |
3 | 3 |
4 InspectorTest.preloadPanel("audits"); | 4 InspectorTest.preloadPanel("audits"); |
5 | 5 |
6 InspectorTest.collectAuditResults = function() | 6 InspectorTest.collectAuditResults = function() |
7 { | 7 { |
8 WebInspector.panels.audits.showResults(WebInspector.panels.audits.auditResul
tsTreeElement.children[0].results); | 8 WebInspector.panels.audits.showResults(WebInspector.panels.audits.auditResul
tsTreeElement.children[0].results); |
9 var liElements = WebInspector.panels.audits.visibleView.element.getElementsB
yTagName("li"); | 9 var liElements = WebInspector.panels.audits.visibleView.element.getElementsB
yTagName("li"); |
10 for (var j = 0; j < liElements.length; ++j) { | 10 for (var j = 0; j < liElements.length; ++j) { |
11 if (liElements[j].treeElement) | 11 if (liElements[j].treeElement) |
12 liElements[j].treeElement.expand(); | 12 liElements[j].treeElement.expand(); |
13 } | 13 } |
14 InspectorTest.collectTextContent(WebInspector.panels.audits.visibleView.elem
ent, ""); | 14 InspectorTest.collectTextContent(WebInspector.panels.audits.visibleView.elem
ent, ""); |
15 } | 15 } |
16 | 16 |
17 InspectorTest.launchAllAudits = function(shouldReload, callback) | 17 InspectorTest.launchAllAudits = function(shouldReload, callback) |
18 { | 18 { |
19 InspectorTest.addSniffer(WebInspector.AuditController.prototype, "_auditFini
shedCallback", callback); | 19 InspectorTest.addSniffer(WebInspector.AuditController.prototype, "_auditFini
shedCallback", callback); |
20 var launcherView = WebInspector.panels.audits._launcherView; | 20 var launcherView = WebInspector.panels.audits._launcherView; |
21 launcherView._selectAllClicked(true); | 21 launcherView._selectAllClicked(true); |
22 launcherView._auditPresentStateElement.checked = !shouldReload; | 22 launcherView._auditPresentStateElement.checked = !shouldReload; |
23 launcherView._launchButtonClicked(); | 23 launcherView._launchButtonClicked(); |
24 } | 24 } |
25 | 25 |
26 InspectorTest.collectTextContent = function(element, indent) | 26 InspectorTest.collectTextContent = function(element, indent) |
27 { | 27 { |
28 var nodeOutput = ""; | 28 var nodeOutput = ""; |
29 var child = element.firstChild; | 29 var child = element.shadowRoot || element.firstChild; |
30 | 30 |
| 31 var nonTextTags = { "STYLE": 1, "SCRIPT": 1 }; |
31 while (child) { | 32 while (child) { |
32 if (child.nodeType === Node.TEXT_NODE) { | 33 if (child.nodeType === Node.TEXT_NODE) { |
33 nodeOutput += child.nodeValue.replace("\u200B", ""); | 34 if (!nonTextTags[child.parentElement.nodeName]) |
34 } else if (child.nodeType === Node.ELEMENT_NODE) { | 35 nodeOutput += child.nodeValue.replace("\u200B", ""); |
| 36 } else if (child.nodeType === Node.ELEMENT_NODE || child.nodeType === No
de.DOCUMENT_FRAGMENT_NODE) { |
35 if (nodeOutput !== "") { | 37 if (nodeOutput !== "") { |
36 InspectorTest.addResult(indent + nodeOutput); | 38 InspectorTest.addResult(indent + nodeOutput); |
37 nodeOutput = ""; | 39 nodeOutput = ""; |
38 } | 40 } |
39 if (!child.firstChild && child.className.indexOf("severity") == 0) | 41 if (!child.firstChild && child.className.indexOf("severity") == 0) |
40 nodeOutput = "[" + child.className + "] "; | 42 nodeOutput = "[" + child.className + "] "; |
41 else | 43 else |
42 InspectorTest.collectTextContent(child, indent + " "); | 44 InspectorTest.collectTextContent(child, indent + " "); |
43 } | 45 } |
44 child = child.nextSibling; | 46 child = child.nextSibling; |
45 } | 47 } |
46 if (nodeOutput !== "") | 48 if (nodeOutput !== "") |
47 InspectorTest.addResult(indent + nodeOutput); | 49 InspectorTest.addResult(indent + nodeOutput); |
48 } | 50 } |
49 | 51 |
50 } | 52 } |
OLD | NEW |