Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
|
fs
2017/05/05 10:52:42
uNit: <html> and <head> (and corresponding end tag
hiroshige
2017/05/08 17:22:06
Done.
| |
| 4 <script src="../../resources/testharness.js"></script> | |
| 5 <script src="../../resources/testharnessreport.js"></script> | |
| 6 <script> | |
| 7 var t1 = async_test("Loading of SVG with a valid font completes " + | |
|
fs
2017/05/05 10:52:42
Personally I think I would've written these tests
hiroshige
2017/05/08 17:22:06
Done.
| |
| 8 "before <img> load event and drawImage() doesn't crash."); | |
| 9 var t2 = async_test("Loading of SVG with a valid font completes " + | |
| 10 "before <body> load event and drawImage() doesn't crash."); | |
| 11 | |
| 12 var imgOnLoadCalled = false; | |
| 13 | |
| 14 function doTest() { | |
| 15 var svg = document.getElementById('img'); | |
| 16 var canvas = document.createElement("canvas"); | |
| 17 var ctx = canvas.getContext("2d"); | |
| 18 ctx.drawImage(svg, 0, 0); | |
| 19 } | |
| 20 | |
| 21 var imgOnLoad = t1.step_func_done(function() { | |
| 22 imgOnLoadCalled = true; | |
| 23 doTest(); | |
| 24 }); | |
| 25 | |
| 26 var bodyOnLoad = t2.step_func_done(function() { | |
| 27 assert_true(imgOnLoadCalled, | |
| 28 "<img> load event must be fired before <body> load event"); | |
| 29 doTest(); | |
| 30 }); | |
| 31 </script> | |
| 32 </head> | |
| 33 <body onload="bodyOnLoad()"> | |
| 34 <img src="resources/data-font-in-css.svg" id="img" onload="imgOnLoad()"> | |
| 35 </body> | |
| 36 </html> | |
| OLD | NEW |