| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <script src="../../../resources/run-after-display.js"></script> |
| 3 <script> | 4 <script> |
| 4 function doUpdate() | |
| 5 { | |
| 6 document.getElementsByTagName('canvas')[0].style.top = "60px"; | |
| 7 | |
| 8 if (window.testRunner) { | |
| 9 testRunner.display(); | |
| 10 testRunner.notifyDone(); | |
| 11 } | |
| 12 } | |
| 13 | |
| 14 function init() | 5 function init() |
| 15 { | 6 { |
| 16 if (window.testRunner) | 7 runAfterDisplay(function() { |
| 17 doUpdate(); | 8 document.getElementsByTagName('canvas')[0].style.top = "60px"; |
| 18 else { | 9 if (window.testRunner) |
| 19 // Delay canvas layer update if test runs without testRunner to | 10 testRunner.notifyDone(); |
| 20 // allow first layer update to be processed on UI side. | 11 }); |
| 21 window.setTimeout(doUpdate, 100); | |
| 22 } | |
| 23 } | 12 } |
| 24 </script> | 13 </script> |
| 25 <body onload="init()"> | 14 <body onload="init()"> |
| 26 <script> | 15 <script> |
| 27 if (window.testRunner) | 16 if (window.testRunner) |
| 28 testRunner.waitUntilDone(); | 17 testRunner.waitUntilDone(); |
| 29 </script> | 18 </script> |
| 30 <span id="description" style="color: white"> | 19 <span id="description" style="color: white"> |
| 31 This test is only useful as a pixel test. You should see red canvas of size 100x
100. | 20 This test is only useful as a pixel test. You should see red canvas of size 100x
100. |
| 32 </span> | 21 </span> |
| 33 <br> | 22 <br> |
| 34 <style> | 23 <style> |
| 35 canvas { | 24 canvas { |
| 36 outline: 1px solid blue; | 25 outline: 1px solid blue; |
| 37 } | 26 } |
| 38 body { | 27 body { |
| 39 background-color: darkblue; | 28 background-color: darkblue; |
| 40 } | 29 } |
| 41 </style> | 30 </style> |
| 42 <script> | 31 <script> |
| 43 | 32 |
| 44 if (window.testRunner) { | 33 if (window.testRunner) { |
| 45 testRunner.overridePreference("WebKitWebGLEnabled", "1"); | 34 testRunner.overridePreference("WebKitWebGLEnabled", "1"); |
| 46 testRunner.dumpAsTextWithPixelResults(); | 35 testRunner.dumpAsTextWithPixelResults(); |
| 47 document.getElementById("description").style.position = "absolute"; | 36 document.getElementById("description").style.position = "absolute"; |
| 48 document.getElementById("description").style.top = "-5000px"; | 37 document.getElementById("description").style.top = "-5000px"; |
| 49 } | 38 } |
| 50 | 39 |
| 51 var can = document.createElement('canvas'); | 40 var can = document.createElement('canvas'); |
| 52 can.width = can.height = 100; | 41 can.width = can.height = 100; |
| 53 can.style.position = "absolute"; | 42 can.style.position = "absolute"; |
| 54 can.style.left = "40px"; | 43 can.style.left = "40px"; |
| 55 can.style.top = "40px"; | 44 can.style.top = "40px"; |
| 56 document.body.appendChild(can); | 45 document.body.appendChild(can); |
| 57 var ctx = can.getContext("experimental-webgl"); | 46 var ctx = can.getContext("experimental-webgl"); |
| 58 ctx.clearColor(1, 0, 0, 1); | 47 ctx.clearColor(1, 0, 0, 1); |
| 59 ctx.clear(ctx.COLOR_BUFFER_BIT); | 48 ctx.clear(ctx.COLOR_BUFFER_BIT); |
| 60 | |
| 61 if (window.testRunner) | |
| 62 testRunner.display(); | |
| 63 </script> | 49 </script> |
| 64 </body> | 50 </body> |
| 65 </html> | 51 </html> |
| 66 | 52 |
| OLD | NEW |