Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <style> | 3 <style> |
| 4 div { | 4 div { |
| 5 display: inline-block; | 5 display: inline-block; |
| 6 border-style: solid; | 6 border-style: solid; |
| 7 } | 7 } |
| 8 | 8 |
| 9 div.img-container { | 9 div.img-container { |
| 10 position: relative; | 10 position: relative; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 var images = [ | 30 var images = [ |
| 31 ["./resources/test.webp", "25", "25"], | 31 ["./resources/test.webp", "25", "25"], |
| 32 ["./resources/test.bmp", "25", "25"], | 32 ["./resources/test.bmp", "25", "25"], |
| 33 ["./resources/test.gif", "25", "25"], | 33 ["./resources/test.gif", "25", "25"], |
| 34 ["./resources/test.ico", "25", "25"], | 34 ["./resources/test.ico", "25", "25"], |
| 35 ["./resources/test.jpg", "25", "25"], | 35 ["./resources/test.jpg", "25", "25"], |
| 36 ["./resources/test.png", "25", "25"], | 36 ["./resources/test.png", "25", "25"], |
| 37 ["./resources/big.png", "150", "150"] | 37 ["./resources/big.png", "150", "150"] |
| 38 ]; | 38 ]; |
| 39 | 39 |
| 40 function showImages(callback) | 40 function showImages() |
| 41 { | 41 { |
| 42 var nextImageIndex = 0; | 42 var promise = Promise.resolve(); |
| 43 for (let image of images) { | |
| 44 promise = promise | |
| 45 .then(() => addImage(image)) | |
|
caseq
2016/08/10 22:44:55
drop () =>
kozy
2016/08/11 01:34:16
I'd like to upload image and then run testRunner.l
| |
| 46 .then(() => new Promise((fulfill) => testRunner.layoutAndPaintAsyncT hen(fulfill))); | |
|
caseq
2016/08/10 22:44:55
ditto
kozy
2016/08/11 01:34:16
Acknowledged.
| |
| 47 } | |
| 48 return promise.then(() => generateFrames(3)); | |
| 43 | 49 |
| 44 addImages(); | 50 function addImage(image) |
| 45 | |
| 46 function addImages() | |
| 47 { | 51 { |
| 48 if (nextImageIndex >= images.length) { | |
| 49 // Allow several frames for image decoding to complete on rasterizer threads. | |
| 50 generateFrames(3, callback); | |
| 51 return; | |
| 52 } | |
| 53 | |
| 54 var imgContainer = document.createElement("div"); | 52 var imgContainer = document.createElement("div"); |
| 55 imgContainer.className = "img-container"; | 53 imgContainer.className = "img-container"; |
| 56 document.body.appendChild(imgContainer); | 54 document.body.appendChild(imgContainer); |
| 57 | 55 |
| 58 var imgElement = document.createElement("img"); | 56 var imgElement = document.createElement("img"); |
| 59 imgElement.addEventListener("load", testRunner.layoutAndPaintAsyncThen.b ind(testRunner, addImages)); | 57 var promise = new Promise((fulfill) => imgElement.onload = fulfill); |
| 60 imgContainer.appendChild(imgElement); | 58 imgContainer.appendChild(imgElement); |
| 61 | 59 |
| 62 var backgroundElement = document.createElement("div"); | 60 var backgroundElement = document.createElement("div"); |
| 63 backgroundElement.className = "background"; | 61 backgroundElement.className = "background"; |
| 64 document.body.appendChild(backgroundElement); | 62 document.body.appendChild(backgroundElement); |
| 65 | 63 |
| 66 var borderElement = document.createElement("div"); | 64 var borderElement = document.createElement("div"); |
| 67 borderElement.className = "border"; | 65 borderElement.className = "border"; |
| 68 document.body.appendChild(borderElement); | 66 document.body.appendChild(borderElement); |
| 69 | 67 |
| 70 var image = images[nextImageIndex++]; | |
| 71 imgElement.width = image[1]; | 68 imgElement.width = image[1]; |
| 72 imgElement.height = image[2]; | 69 imgElement.height = image[2]; |
| 73 imgElement.src = image[0]; | 70 imgElement.src = image[0]; |
| 74 backgroundElement.style.backgroundImage = "url(" + image[0] + "?backgrou nd)"; | 71 backgroundElement.style.backgroundImage = "url(" + image[0] + "?backgrou nd)"; |
| 75 borderElement.style.borderImage = "url(" + image[0] + "?border)"; | 72 borderElement.style.borderImage = "url(" + image[0] + "?border)"; |
| 73 | |
| 74 return promise; | |
| 76 } | 75 } |
| 77 } | 76 } |
| 78 | 77 |
| 79 | |
| 80 function test() | 78 function test() |
| 81 { | 79 { |
| 82 InspectorTest.invokeWithTracing("showImages", InspectorTest.safeWrap(onTraci ngComplete)); | 80 InspectorTest.invokeWithTracing("showImages", InspectorTest.safeWrap(onTraci ngComplete)); |
| 83 function onTracingComplete() | 81 function onTracingComplete() |
| 84 { | 82 { |
| 85 function isDecodeImageEvent(event) | 83 function isDecodeImageEvent(event) |
| 86 { | 84 { |
| 87 return event.name === WebInspector.TimelineModel.RecordType.DecodeIm age; | 85 return event.name === WebInspector.TimelineModel.RecordType.DecodeIm age; |
| 88 } | 86 } |
| 89 function compareImageURLs(a, b) | 87 function compareImageURLs(a, b) |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 109 | 107 |
| 110 </script> | 108 </script> |
| 111 </head> | 109 </head> |
| 112 | 110 |
| 113 <body onload="runTest()"> | 111 <body onload="runTest()"> |
| 114 <p> | 112 <p> |
| 115 Tests the instrumentation of a DecodeImage and ResizeImage events | 113 Tests the instrumentation of a DecodeImage and ResizeImage events |
| 116 </p> | 114 </p> |
| 117 </body> | 115 </body> |
| 118 </html> | 116 </html> |
| OLD | NEW |