Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / permissionclient / image-permissions.html
bloba37b789836668d67976731a4ad578102e8a0170a
1 <!DOCTYPE html>
2 <script src='../resources/js-test.js'></script>
3 <script>
4 jsTestIsAsync = true;
6 description("Blocked images can be reloaded, so neither onload nor onerror is called. Only check here that onload is never called when image is blocked.");
8 if (window.testRunner)
9 testRunner.dumpPermissionClientCallbacks();
11 document.write('<img src="resources/boston.gif" onload="loaded()">');
13 function loaded()
15 debug("PASS: first image loaded");
16 if (window.testRunner && testRunner.setImagesAllowed)
17 testRunner.setImagesAllowed(false);
18 else
19 debug("This test requires testRunner.setImagesAllowed, so it be can't run in a browser.");
21 // Load an image not in cache.
22 var img = document.createElement('img');
23 img.onload = function () { log("FAIL: not cached image loaded"); }
24 img.src = "resources/boston.gif?nocache";
25 document.getElementById("img").appendChild(img);
27 // Load an image from cache.
28 var imgFromCache = document.createElement('img');
29 imgFromCache.onload = function () { log("FAIL: image from cache loaded"); }
30 imgFromCache.src = "resources/boston.gif";
31 document.getElementById("img").appendChild(imgFromCache);
33 // Add an iframe with an image.
34 var iframe = document.createElement('iframe');
35 iframe.src = "resources/image.html";
36 document.getElementById("img").appendChild(iframe);
38 setTimeout(finishJSTest, 0);
40 </script>
41 <div id="img"></div>