Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / data / prerender / prerender_deferred_image.html
blob2507bf3b1f7b96dced0f7034c9a9cc6110cecab0
1 <html>
2 <!--
3 This test checks to make sure that redirects are deferred.
4 -->
5 <head>
6 <title>Prerender deferred redirect</title>
7 </head>
8 <body>
9 <script>
10 var imageWasLoaded = false;
12 var prefix = "";
13 if (location.hash == "#double_redirect")
14 prefix = "/server-redirect?";
16 // Insert a deferred redirect into the document.
17 var image = new Image();
18 image.src = prefix + "/files/prerender/image-deferred.png";
19 image.onload = function() {
20 imageWasLoaded = true;
22 document.body.appendChild(image);
24 // Make sure the image was not loaded while prerendering.
25 function DidPrerenderPass() {
26 return !imageWasLoaded;
29 // Make sure the image is loaded once the page is displayed.
30 function DidDisplayPass() {
31 return imageWasLoaded;
34 // Wait for a sister image to load before calling DidPrerenderPass.
35 // TODO(davidben): Wait on something more reasonable. This should
36 // still pass reliably, but will only fail flakily on regression.
37 var image2 = new Image();
38 image2.src = prefix + "/files/prerender/image-redirect.png";
39 image2.onload = function() {
40 document.title = "READY";
42 document.body.appendChild(image2);
43 </script>
44 </body>
45 </html>