| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <script src="/js-test-resources/js-test.js"></script> | |
| 3 <body> | |
| 4 <script> | |
| 5 document.body.innerHTML += '<img id="load" src="http://127.0.0.1:8000/resour
ces/slow-image.php?name=square100.png&mimeType=image/png&sleep=100">'; | |
| 6 document.body.innerHTML += '<img id="error" srcset="http://127.0.0.1:8000/re
sources/slow-image.php?name=not_there.png&mimeType=image/png&sleep=300">'; | |
| 7 document.body.innerHTML += '<img id="redirect" src="http://127.0.0.1:8000/re
sources/slow-image.php?redirect_name=square100.png&mimeType=image/png&sleep=500"
>'; | |
| 8 jsTestIsAsync = true; | |
| 9 var img = window.document.getElementById("load"); | |
| 10 shouldBe('img.currentSrc', '""'); | |
| 11 var expectedCurrentSrc = "http://127.0.0.1:8000/resources/slow-image.php?nam
e=square100.png&mimeType=image/png&sleep=100"; | |
| 12 img.onload = function() { | |
| 13 img.srcset = "http://127.0.0.1:8000/resources/slow-image.php?name=square
200.png&mimeType=image/png&sleep=100 1x"; | |
| 14 shouldBe('img.currentSrc', 'expectedCurrentSrc'); | |
| 15 expectedCurrentSrc = "http://127.0.0.1:8000/resources/slow-image.php?nam
e=square200.png&mimeType=image/png&sleep=100"; | |
| 16 }; | |
| 17 var img_err = window.document.getElementById("error"); | |
| 18 img_err.onerror = function() { | |
| 19 shouldBe('img_err.currentSrc', '"http://127.0.0.1:8000/resources/slow-im
age.php?name=not_there.png&mimeType=image/png&sleep=300"'); | |
| 20 }; | |
| 21 | |
| 22 var img_redirect = window.document.getElementById("redirect"); | |
| 23 img_redirect.onload = function() { | |
| 24 shouldBe('img_redirect.currentSrc', '"http://127.0.0.1:8000/resources/sl
ow-image.php?redirect_name=square100.png&mimeType=image/png&sleep=500"'); | |
| 25 }; | |
| 26 window.onload = function() { | |
| 27 finishJSTest(); | |
| 28 }; | |
| 29 </script> | |
| 30 </body> | |
| OLD | NEW |