Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../http/tests/inspector/elements-test.js"></script> | 4 <script src="../../http/tests/inspector/elements-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function pseudoVisibility(resolve, reject, pseudo) | 7 function pseudoVisibility(pseudo) |
| 8 { | 8 { |
| 9 var parentNode = document.getElementById("parent-node"); | 9 var parentNode = document.getElementById("parent-node"); |
| 10 resolve(getComputedStyle(parentNode, ":" + pseudo).visibility); | 10 return getComputedStyle(parentNode, ":" + pseudo).visibility; |
| 11 } | 11 } |
| 12 | 12 |
| 13 function pseudoIframeVisibility(resolve, reject) | 13 function pseudoIframeVisibility() |
| 14 { | 14 { |
| 15 var parentNode = frames[0].document.getElementById("frame-node"); | 15 var parentNode = frames[0].document.getElementById("frame-node"); |
| 16 resolve(getComputedStyle(parentNode).visibility); | 16 return getComputedStyle(parentNode).visibility; |
| 17 } | 17 } |
| 18 | 18 |
| 19 function test() | 19 function test() |
| 20 { | 20 { |
| 21 var treeOutline; | 21 var treeOutline; |
| 22 var parentNode; | 22 var parentNode; |
| 23 var childNode; | 23 var childNode; |
| 24 var frameNode; | 24 var frameNode; |
| 25 | 25 |
| 26 InspectorTest.runTestSuite([ | 26 InspectorTest.runTestSuite([ |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 { | 118 { |
| 119 testPseudoToggle(parentNode.afterPseudoElement(), next); | 119 testPseudoToggle(parentNode.afterPseudoElement(), next); |
| 120 }, | 120 }, |
| 121 | 121 |
| 122 function testToggleHideShortcutOnInFrame(next) | 122 function testToggleHideShortcutOnInFrame(next) |
| 123 { | 123 { |
| 124 treeOutline.toggleHideElement(frameNode, callback); | 124 treeOutline.toggleHideElement(frameNode, callback); |
| 125 | 125 |
| 126 function callback() | 126 function callback() |
| 127 { | 127 { |
| 128 InspectorTest.invokePageFunctionPromise("pseudoIframeVisibility" , []).then(function(result) { | 128 InspectorTest.evaluateInPagePromise("pseudoIframeVisibility()"). then(function(result) { |
| 129 InspectorTest.addResult("=== Added hide shortcut in frame == ="); | 129 InspectorTest.addResult("=== Added hide shortcut in frame == ="); |
| 130 InspectorTest.addResult("=== Frame node is hidden ==="); | 130 InspectorTest.addResult("=== Frame node is hidden ==="); |
| 131 InspectorTest.addResult("visibility: " + result + ";"); | 131 InspectorTest.addResult("visibility: " + result.value + ";") ; |
|
dgozman
2016/08/03 22:46:58
Can we fix evaluateInPagePromise to pass the value
kozy
2016/08/03 23:48:39
I think it can break other tests, I'll try to addr
| |
| 132 next(); | 132 next(); |
| 133 }); | 133 }); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 ]); | 136 ]); |
| 137 | 137 |
| 138 function getPropertyText(computedStyle, propertyName) | 138 function getPropertyText(computedStyle, propertyName) |
| 139 { | 139 { |
| 140 return String.sprintf("%s: %s;", propertyName, computedStyle.get(propert yName)); | 140 return String.sprintf("%s: %s;", propertyName, computedStyle.get(propert yName)); |
| 141 } | 141 } |
| 142 | 142 |
| 143 function testPseudoToggle(pseudoNode, next) | 143 function testPseudoToggle(pseudoNode, next) |
| 144 { | 144 { |
| 145 treeOutline.toggleHideElement(pseudoNode, callback); | 145 treeOutline.toggleHideElement(pseudoNode, callback); |
| 146 function callback() | 146 function callback() |
| 147 { | 147 { |
| 148 InspectorTest.invokePageFunctionPromise("pseudoVisibility", [pseudoN ode.pseudoType()]).then(function(result) { | 148 var pseudoNodeTypeArg = pseudoNode.pseudoType() ? ("\"" + pseudoNode .pseudoType() + "\"") : "undefined"; |
| 149 InspectorTest.addResult("::" + pseudoNode.pseudoType() + " node visibility: '" + result + "'"); | 149 InspectorTest.evaluateInPagePromise("pseudoVisibility(" + pseudoNode TypeArg + ")").then(function(result) { |
| 150 InspectorTest.addResult("::" + pseudoNode.pseudoType() + " node visibility: '" + result.value + "'"); | |
| 150 next(); | 151 next(); |
| 151 }); | 152 }); |
| 152 } | 153 } |
| 153 } | 154 } |
| 154 } | 155 } |
| 155 </script> | 156 </script> |
| 156 <style> | 157 <style> |
| 157 #parent-node::before { | 158 #parent-node::before { |
| 158 content: "before"; | 159 content: "before"; |
| 159 } | 160 } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 173 <div id="parent-node">parent | 174 <div id="parent-node">parent |
| 174 <div style="visibility:hidden">hidden | 175 <div style="visibility:hidden">hidden |
| 175 <div id="child-node" style="visibility:visible">child</div> | 176 <div id="child-node" style="visibility:visible">child</div> |
| 176 </div> | 177 </div> |
| 177 </div> | 178 </div> |
| 178 | 179 |
| 179 <iframe src="resources/hide-shortcut-iframe.html" onload="runTest()"> | 180 <iframe src="resources/hide-shortcut-iframe.html" onload="runTest()"> |
| 180 | 181 |
| 181 </body> | 182 </body> |
| 182 </html> | 183 </html> |
| OLD | NEW |