Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: chrome/test/data/prerender/prerender_deferred_image.html

Issue 1409163006: Migrating tests to use EmbeddedTestServer (/chrome/browser misc) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <!-- 2 <!--
3 This test checks to make sure that redirects are deferred. 3 This test checks to make sure that redirects are deferred.
4 --> 4 -->
5 <head> 5 <head>
6 <title>Prerender deferred redirect</title> 6 <title>Prerender deferred redirect</title>
7 </head> 7 </head>
8 <body> 8 <body>
9 <script> 9 <script>
10 var imageWasLoaded = false; 10 var imageWasLoaded = false;
11 11
12 var prefix = ""; 12 var prefix = "";
13 if (location.hash == "#double_redirect") 13 if (location.hash == "#double_redirect")
14 prefix = "/server-redirect?"; 14 prefix = "/server-redirect?";
15 15
16 // Insert a deferred redirect into the document. 16 // Insert a deferred redirect into the document.
17 var image = new Image(); 17 var image = new Image();
18 image.src = prefix + "/files/prerender/image-deferred.png"; 18 image.src = prefix + "/prerender/image-deferred.png";
19 image.onload = function() { 19 image.onload = function() {
20 imageWasLoaded = true; 20 imageWasLoaded = true;
21 }; 21 };
22 document.body.appendChild(image); 22 document.body.appendChild(image);
23 23
24 // Make sure the image was not loaded while prerendering. 24 // Make sure the image was not loaded while prerendering.
25 function DidPrerenderPass() { 25 function DidPrerenderPass() {
26 return !imageWasLoaded; 26 return !imageWasLoaded;
27 } 27 }
28 28
29 // Make sure the image is loaded once the page is displayed. 29 // Make sure the image is loaded once the page is displayed.
30 function DidDisplayPass() { 30 function DidDisplayPass() {
31 return imageWasLoaded; 31 return imageWasLoaded;
32 } 32 }
33 33
34 // Wait for a sister image to load before calling DidPrerenderPass. 34 // Wait for a sister image to load before calling DidPrerenderPass.
35 // TODO(davidben): Wait on something more reasonable. This should 35 // TODO(davidben): Wait on something more reasonable. This should
36 // still pass reliably, but will only fail flakily on regression. 36 // still pass reliably, but will only fail flakily on regression.
37 var image2 = new Image(); 37 var image2 = new Image();
38 image2.src = prefix + "/files/prerender/image-redirect.png"; 38 image2.src = prefix + "/prerender/image-redirect.png";
39 image2.onload = function() { 39 image2.onload = function() {
40 document.title = "READY"; 40 document.title = "READY";
41 }; 41 };
42 document.body.appendChild(image2); 42 document.body.appendChild(image2);
43 </script> 43 </script>
44 </body> 44 </body>
45 </html> 45 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698