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 <style> | 5 <style> |
| 6 .border { | 6 .border { |
| 7 border: 1px solid black; | 7 border: 1px solid black; |
| 8 } | 8 } |
| 9 </style> | 9 </style> |
| 10 <script> | 10 <script> |
| 11 | 11 |
| 12 function requestAnimationFramePromise() | |
| 13 { | |
| 14 var callback; | |
| 15 var promise = new Promise((fulfill) => callback = fulfill); | |
|
caseq
2016/08/05 17:56:42
Just
return new Promise(fullfill => requestAnimati
kozy
2016/08/10 01:21:14
Done.
| |
| 16 requestAnimationFrame(callback); | |
| 17 return promise; | |
| 18 } | |
| 19 | |
| 12 function buildShadowDOM() | 20 function buildShadowDOM() |
| 13 { | 21 { |
| 14 var host = document.querySelector("body"); | 22 var host = document.querySelector("body"); |
| 15 var root = host.createShadowRoot(); | 23 var root = host.createShadowRoot(); |
| 16 var template = document.querySelector("#dom-template"); | 24 var template = document.querySelector("#dom-template"); |
| 17 var clone = document.importNode(template.content, true); | 25 var clone = document.importNode(template.content, true); |
| 18 root.appendChild(clone); | 26 root.appendChild(clone); |
| 19 var second = root.querySelector("#fifth"); | 27 var second = root.querySelector("#fifth"); |
| 20 second.id = "inspected-shadow"; | 28 second.id = "inspected-shadow"; |
| 21 runTest(); | 29 runTest(); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 35 | 43 |
| 36 function onSelected() | 44 function onSelected() |
| 37 { | 45 { |
| 38 resetHighlightCount(onHighlightCountReset); | 46 resetHighlightCount(onHighlightCountReset); |
| 39 } | 47 } |
| 40 | 48 |
| 41 function onHighlightCountReset() | 49 function onHighlightCountReset() |
| 42 { | 50 { |
| 43 var section = InspectorTest.firstMatchedStyleSection(); | 51 var section = InspectorTest.firstMatchedStyleSection(); |
| 44 section._highlight(); | 52 section._highlight(); |
| 45 InspectorTest.waitForOverlayRepaint(onHighlighted); | 53 InspectorTest.callFunctionInPageAsync("requestAnimationFrameProm ise").then(onHighlighted) |
| 46 } | 54 } |
| 47 | 55 |
| 48 function onHighlighted() | 56 function onHighlighted() |
| 49 { | 57 { |
| 50 dumpHighlightCount(next); | 58 dumpHighlightCount(next); |
| 51 } | 59 } |
| 52 }, | 60 }, |
| 53 | 61 |
| 54 function testShadowDOMNodeSelection(next) | 62 function testShadowDOMNodeSelection(next) |
| 55 { | 63 { |
| 56 InspectorTest.selectNodeAndWaitForStyles("inspected-shadow", onSelec ted); | 64 InspectorTest.selectNodeAndWaitForStyles("inspected-shadow", onSelec ted); |
| 57 | 65 |
| 58 function onSelected() | 66 function onSelected() |
| 59 { | 67 { |
| 60 resetHighlightCount(onHighlightCountReset); | 68 resetHighlightCount(onHighlightCountReset); |
| 61 } | 69 } |
| 62 | 70 |
| 63 function onHighlightCountReset() | 71 function onHighlightCountReset() |
| 64 { | 72 { |
| 65 var section = InspectorTest.firstMatchedStyleSection(); | 73 var section = InspectorTest.firstMatchedStyleSection(); |
| 66 section._highlight(); | 74 section._highlight(); |
| 67 InspectorTest.waitForOverlayRepaint(onHighlighted); | 75 InspectorTest.callFunctionInPageAsync("requestAnimationFrameProm ise").then(onHighlighted) |
| 68 } | 76 } |
| 69 | 77 |
| 70 function onHighlighted() | 78 function onHighlighted() |
| 71 { | 79 { |
| 72 dumpHighlightCount(next); | 80 dumpHighlightCount(next); |
| 73 } | 81 } |
| 74 }, | 82 }, |
| 75 ]); | 83 ]); |
| 76 | 84 |
| 77 function drawHighlightProxy() | 85 function drawHighlightProxy() |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 } | 137 } |
| 130 </style> | 138 </style> |
| 131 <div class="bck">1st</div> | 139 <div class="bck">1st</div> |
| 132 <div class="bck">2nd</div> | 140 <div class="bck">2nd</div> |
| 133 <div class="bck">3rd</div> | 141 <div class="bck">3rd</div> |
| 134 <div class="bck">4th</div> | 142 <div class="bck">4th</div> |
| 135 <div class="bck" id="fifth">5th</div> | 143 <div class="bck" id="fifth">5th</div> |
| 136 </template> | 144 </template> |
| 137 </body> | 145 </body> |
| 138 </html> | 146 </html> |
| OLD | NEW |