OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="/js-test-resources/js-test.js"></script> | 2 <script src="/js-test-resources/js-test.js"></script> |
3 <body> | 3 <body> |
4 <script> | 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">'; | 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; | 6 jsTestIsAsync = true; |
9 var img = window.document.getElementById("load"); | 7 var img = window.document.getElementById("load"); |
10 shouldBe('img.currentSrc', '""'); | 8 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"; | 9 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() { | 10 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"; | 11 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'); | 12 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"; | 13 expectedCurrentSrc = "http://127.0.0.1:8000/resources/slow-image.php?nam
e=square200.png&mimeType=image/png&sleep=100"; |
16 }; | 14 }; |
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() { | 15 window.onload = function() { |
27 finishJSTest(); | 16 finishJSTest(); |
28 }; | 17 }; |
29 </script> | 18 </script> |
30 </body> | 19 </body> |
OLD | NEW |