| 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/layers-test.js"></script> | 4 <script src="../../http/tests/inspector/layers-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 function test() | 6 function test() |
| 7 { | 7 { |
| 8 setTimeout(() => InspectorTest.completeTest(), 3000); | 8 setTimeout(() => InspectorTest.completeTest(), 3000); |
| 9 InspectorTest.requestLayers(onGotLayers); | 9 InspectorTest.requestLayers(onGotLayers); |
| 10 | 10 |
| 11 function onGotLayers() | 11 function onGotLayers() |
| 12 { | 12 { |
| 13 var layer = InspectorTest.findLayerByNodeIdAttribute("a"); | 13 var layer = InspectorTest.findLayerByNodeIdAttribute("a"); |
| 14 layer.requestSnapshot(onSnapshotDone); | 14 layer.requestSnapshot(onSnapshotDone); |
| 15 } | 15 } |
| 16 | 16 |
| 17 function onSnapshotDone(snapshot) | 17 function onSnapshotDone(snapshot) |
| 18 { | 18 { |
| 19 testImageForSnapshot(snapshot, undefined).then(() => testImageForSnapsho
t(snapshot, 0.5)).then(() => InspectorTest.completeTest()); | 19 testImageForSnapshot(snapshot, undefined).then(() => testImageForSnapsho
t(snapshot, 0.5)).then(() => InspectorTest.completeTest()); |
| 20 } | 20 } |
| 21 | 21 |
| 22 function testImageForSnapshot(snapshot, scale) | 22 function testImageForSnapshot(snapshot, scale) |
| 23 { | 23 { |
| 24 return new Promise(fulfill => { | 24 return new Promise(fulfill => { |
| 25 InspectorTest.LayerTreeAgent.replaySnapshot(snapshot._id, undefined,
undefined, scale, InspectorBackend.wrapClientCallback(fulfill, "LayerTreeAgent.
replaySnapshot(): ")); | 25 InspectorTest.LayerTreeAgent.replaySnapshot(snapshot._id, undefined,
undefined, scale, Protocol.wrapClientCallback(fulfill, "LayerTreeAgent.replaySn
apshot(): ")); |
| 26 }).then(imageURL => new Promise(fulfill => { | 26 }).then(imageURL => new Promise(fulfill => { |
| 27 var image = new Image(); | 27 var image = new Image(); |
| 28 image.addEventListener("load", () => fulfill(image), false); | 28 image.addEventListener("load", () => fulfill(image), false); |
| 29 image.src = imageURL; | 29 image.src = imageURL; |
| 30 })).then(image => { | 30 })).then(image => { |
| 31 InspectorTest.addResult(`Image dimensions at scale ${scale}: ${image.
naturalWidth} x ${image.naturalHeight}`); | 31 InspectorTest.addResult(`Image dimensions at scale ${scale}: ${image.
naturalWidth} x ${image.naturalHeight}`); |
| 32 }); | 32 }); |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 </script> | 35 </script> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 49 })(); | 49 })(); |
| 50 </script> | 50 </script> |
| 51 <div style="width:50px; height:50px; background-color:red;"></div> | 51 <div style="width:50px; height:50px; background-color:red;"></div> |
| 52 <img src="../tracing/resources/test.png"> | 52 <img src="../tracing/resources/test.png"> |
| 53 <svg> | 53 <svg> |
| 54 <rect x="0" y="0" width="10" height="10" style="opacity:0.5"/> | 54 <rect x="0" y="0" width="10" height="10" style="opacity:0.5"/> |
| 55 </svg> | 55 </svg> |
| 56 </div> | 56 </div> |
| 57 </body> | 57 </body> |
| 58 </html> | 58 </html> |
| OLD | NEW |