OLD | NEW |
---|---|
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../../resources/testharness.js"></script> | 3 <script src="../../../resources/testharness.js"></script> |
4 <script src="../../../resources/testharnessreport.js"></script> | 4 <script src="../../../resources/testharnessreport.js"></script> |
5 <script> | 5 <script> |
6 var t = async_test("window.stop() can stop loading of multipart images"); | 6 var t = async_test("window.stop() can stop loading of multipart images"); |
7 | 7 |
8 function firstPartLoaded() | 8 function firstPartLoaded() |
9 { | 9 { |
10 const url = "resources/multipart.php?interval=1&loop=1&img1=2x2-green.png&im g2=abe.png"; | 10 const url = "resources/multipart.php?interval=1&loop=1&img1=2x2-green.png&im g2=abe.png"; |
11 if (window.internals) { | 11 if (window.internals) { |
12 assert_true(internals.isLoading(url), "The image should be loading befor e window.stop()."); | 12 assert_true(internals.isLoading(url), "The image should be loading befor e window.stop()."); |
13 } | 13 } |
14 window.stop(); | 14 window.stop(); |
15 | |
16 // We emulate window load event to signal testharness.js that we don't | |
kinuko
2017/05/08 09:24:24
nit: that -> so that?
kouhei (in TOK)
2017/05/08 11:54:25
"that" seems correct here?
hiroshige
2017/05/08 19:23:10
Either looks fine to me (with different but accept
| |
17 // have to wait for window load event (that will never occur because | |
18 // we've called window.stop()) before test completes. | |
19 dispatchEvent(new Event('load')); | |
20 | |
15 window.setTimeout(t.step_func(function() { | 21 window.setTimeout(t.step_func(function() { |
16 if (window.internals) { | 22 if (window.internals) { |
17 assert_false(internals.isLoading(url), "The image should not be load ing after window.stop()."); | 23 assert_false(internals.isLoading(url), "The image should not be load ing after window.stop()."); |
18 } | 24 } |
19 t.done(); | 25 t.done(); |
20 }), 100); | 26 }), 100); |
21 } | 27 } |
22 </script> | 28 </script> |
23 </head> | 29 </head> |
24 <body> | 30 <body> |
25 <img id=testingImage src="resources/multipart.php?interval=1&loop=1&img1=2x2-gre en.png&img2=abe.png" onload="t.step(firstPartLoaded)"> | 31 <img id=testingImage src="resources/multipart.php?interval=1&loop=1&img1=2x2-gre en.png&img2=abe.png" onload="t.step(firstPartLoaded)"> |
26 </body> | 32 </body> |
27 </html> | 33 </html> |
OLD | NEW |