OLD | NEW |
1 function runTest() { | 1 function runTest() { |
2 if (!window.testRunner || !window.sessionStorage) | 2 if (!window.testRunner || !window.sessionStorage) |
3 return; | 3 return; |
4 | 4 |
5 if (!window.targetScaleFactor) | 5 if (!window.targetScaleFactor) |
6 window.targetScaleFactor = 2; | 6 window.targetScaleFactor = 2; |
7 | 7 |
8 if (!sessionStorage.scaleFactorIsSet) { | 8 if (!sessionStorage.scaleFactorIsSet) { |
9 testRunner.waitUntilDone(); | 9 testRunner.waitUntilDone(); |
10 testRunner.setBackingScaleFactor(targetScaleFactor, scaleFactorIsSet); | 10 testRunner.setBackingScaleFactor(targetScaleFactor, scaleFactorIsSet); |
11 } | 11 } |
12 | 12 |
13 if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) { | 13 if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) { |
14 delete sessionStorage.pageReloaded; | 14 delete sessionStorage.pageReloaded; |
15 delete sessionStorage.scaleFactorIsSet; | 15 delete sessionStorage.scaleFactorIsSet; |
16 if (!window.manualNotifyDone) { | 16 if (!window.manualNotifyDone) { |
17 setTimeout(function() { | 17 setTimeout(function() { |
18 testRunner.notifyDone(); | 18 testRunner.notifyDone(); |
19 }, 0); | 19 }, 0); |
20 } | 20 } |
21 } else { | 21 } else { |
22 // Right now there is a bug that srcset does not properly deal with dyna
mic changes to the scale factor, | 22 // Right now there is a bug that srcset does not properly deal with dyna
mic changes to the scale factor, |
23 // so to work around that, we must reload the page to get the new image. | 23 // so to work around that, we must reload the page to get the new image. |
24 sessionStorage.pageReloaded = true; | 24 // |
25 if (window.internals) { | 25 // At the time of the Document load event, there might be other |
26 internals.evictAllResources(); | 26 // ongoing tasks that can cause new images to be loaded. To evict |
27 } | 27 // those images, we delay evictAllResources() call a little. |
28 document.location.reload(true); | 28 setTimeout(function() { |
| 29 sessionStorage.pageReloaded = true; |
| 30 if (window.internals) { |
| 31 internals.evictAllResources(); |
| 32 } |
| 33 document.location.reload(true); |
| 34 }, 300); |
29 } | 35 } |
30 } | 36 } |
31 | 37 |
32 function scaleFactorIsSet() { | 38 function scaleFactorIsSet() { |
33 sessionStorage.scaleFactorIsSet = true; | 39 sessionStorage.scaleFactorIsSet = true; |
34 } | 40 } |
35 | 41 |
36 window.addEventListener("load", runTest, false); | 42 window.addEventListener("load", runTest, false); |
OLD | NEW |