| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <style> | |
| 4 div#img-container { | |
| 5 position: relative; | |
| 6 width: 99px; | |
| 7 height: 99px; | |
| 8 overflow: clip; | |
| 9 } | |
| 10 </style> | |
| 11 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
| 12 <script src="../../http/tests/inspector/timeline-test.js"></script> | |
| 13 <script> | |
| 14 | |
| 15 var images = [ | |
| 16 ["resources/test.bmp", "25", "25"], | |
| 17 ["resources/test.gif", "25", "25"], | |
| 18 ["resources/test.ico", "25", "25"], | |
| 19 ["resources/test.jpg", "25", "25"], | |
| 20 ["resources/test.png", "25", "25"], | |
| 21 ["resources/test.webp", "25", "25"], | |
| 22 ["resources/big.png", "150", "150"] | |
| 23 ]; | |
| 24 | |
| 25 function displayImages(callback) | |
| 26 { | |
| 27 var currentImage = 0; | |
| 28 | |
| 29 var img = document.getElementById("img-container").firstElementChild; | |
| 30 img.addEventListener("load", onImageLoaded, false); | |
| 31 | |
| 32 if (window.testRunner) | |
| 33 testRunner.displayAsyncThen(showNextImage); | |
| 34 | |
| 35 function showNextImage() | |
| 36 { | |
| 37 if (currentImage >= images.length) { | |
| 38 callback(); | |
| 39 return; | |
| 40 } | |
| 41 img.width = images[currentImage][1]; | |
| 42 img.height = images[currentImage][2]; | |
| 43 img.src = images[currentImage][0]; | |
| 44 currentImage++; | |
| 45 } | |
| 46 | |
| 47 function onImageLoaded() | |
| 48 { | |
| 49 if (window.testRunner) | |
| 50 testRunner.displayAsyncThen(showNextImage); | |
| 51 } | |
| 52 } | |
| 53 | |
| 54 function test() | |
| 55 { | |
| 56 InspectorTest.invokeAsyncWithTimeline("displayImages", dumpRecords); | |
| 57 | |
| 58 function dumpRecords(records) | |
| 59 { | |
| 60 InspectorTest.timelineModel().forAllRecords(processRecord.bind(this)); | |
| 61 function processRecord(record) | |
| 62 { | |
| 63 if (record.type() === WebInspector.TimelineModel.RecordType.DecodeIm
age || record.type() === WebInspector.TimelineModel.RecordType.ResizeImage) { | |
| 64 // Some decode events may happen in the background, so we won't
have a stack trace. | |
| 65 delete record._record.stackTrace; | |
| 66 InspectorTest.printTimelineRecordProperties(record); | |
| 67 } | |
| 68 } | |
| 69 InspectorTest.completeTest(); | |
| 70 } | |
| 71 } | |
| 72 | |
| 73 </script> | |
| 74 </head> | |
| 75 | |
| 76 <body onload="runTest()"> | |
| 77 <p> | |
| 78 Tests the Timeline API instrumentation of a DecodeImage and ResizeImage events | |
| 79 </p> | |
| 80 <div id="img-container"><img></div> | |
| 81 </body> | |
| 82 </html> | |
| OLD | NEW |