3 This test checks to make sure that redirects are deferred.
6 <title>Prerender deferred redirect
</title>
10 var imageWasLoaded
= false;
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
);