1 <script src=
"/js-test-resources/js-test.js"></script>
2 <iframe id='iframe'
></iframe>
4 description("This test is to test whether preload image will require 2 more requests or not.");
6 window
.jsTestIsAsync
= true;
8 function CallCommand(cmd
)
11 var req
= new XMLHttpRequest
;
12 req
.open("GET", "/resources/network-simulator.php?command=" + cmd
, false);
14 return req
.responseText
;
21 function checkAccessCount()
23 // Get the access count of resource:/loading/resources/preload-test.jpg. Should be 1.
24 count
= CallCommand("get-resource-count&path=/loading/resources/preload-test.jpg");
25 shouldBeEqualToString('count', '1');
29 // Reset resource count
30 CallCommand("reset-resource-count");
32 window
.addEventListener("message", function(event
) {
33 if (event
.data
== 'imgerror') {
34 testFailed("test img load failed");
36 } else if (event
.data
== 'imgload') {
37 setTimeout(checkAccessCount
, 1000);
43 var iframe
= document
.getElementById("iframe");
44 iframe
.src
= 'resources/preload-img-test-iframe.html';