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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/history/scroll-restoration/scroll-restoration-scale-not-impacted.html

Issue 1424593002: Update layout tests to use internals.visualViewport APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: undo delete test that depends on "inert-visual-viewport" flag Created 5 years, 2 months 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <style> 2 <style>
3 body { 3 body {
4 height: 10000px; 4 height: 10000px;
5 width: 10000px; 5 width: 10000px;
6 } 6 }
7 </style> 7 </style>
8 8
9 <body></body> 9 <body></body>
10 10
11 <script src="../../../resources/testharness.js"></script> 11 <script src="../../../resources/testharness.js"></script>
12 <script src="../../../resources/testharnessreport.js"></script> 12 <script src="../../../resources/testharnessreport.js"></script>
13 <script type="text/javascript"> 13 <script type="text/javascript">
14 'use strict'; 14 'use strict';
15 async_test(function(t) { 15 async_test(function(t) {
16 window.addEventListener('load', t.step_func(function() { 16 window.addEventListener('load', t.step_func(function() {
17 document.body.offsetTop; // force layout 17 document.body.offsetTop; // force layout
18 if (window.name != 'verification') { 18 if (window.name != 'verification') {
19 assert_array_equals([window.innerWidth, window.innerHeight], [800, 600], 'initial page size is valid'); 19 assert_array_equals([window.innerWidth, window.innerHeight], [800, 600], 'initial page size is valid');
20 if (window.internals) 20 if (window.internals) {
21 window.internals.setPageScaleFactor(2); 21 window.internals.setPageScaleFactor(2);
22 assert_array_equals([window.innerWidth, window.innerHeight], [400, 300], 'page is scaled'); 22 assert_array_equals([internals.visualViewportWidth(), internals.visual ViewportHeight()], [400, 300], 'page is scaled');
23 }
23 24
24 history.scrollRestoration = 'manual'; 25 history.scrollRestoration = 'manual';
25 window.scrollTo(100, 200); 26 window.scrollTo(100, 200);
26 assert_equals(history.scrollRestoration, 'manual'); 27 assert_equals(history.scrollRestoration, 'manual');
27 assert_array_equals([window.scrollX, window.scrollY], [100, 200]); 28 assert_array_equals([window.scrollX, window.scrollY], [100, 200]);
28 29
29 setTimeout(function() { 30 setTimeout(function() {
30 window.name = 'verification'; 31 window.name = 'verification';
31 window.location = "data:text/html,<script>history.back();</scr" + "ipt >"; 32 window.location = "data:text/html,<script>history.back();</scr" + "ipt >";
32 }, 0); 33 }, 0);
33 } else { 34 } else {
34 assert_array_equals([window.innerWidth, window.innerHeight], [400, 300], 'page scale is restored'); 35 assert_array_equals([internals.visualViewportWidth(), internals.visualVi ewportHeight()], [400, 300], 'page scale is restored');
35 assert_array_equals([window.scrollX, window.scrollY], [0, 0], 'scroll po sition is not restored'); 36 assert_array_equals([window.scrollX, window.scrollY], [0, 0], 'scroll po sition is not restored');
36 // clean up 37 // clean up
37 window.name = ''; 38 window.name = '';
38 if (window.internals) 39 if (window.internals)
39 setTimeout(function() {window.internals.setPageScaleFactor(1);}, 0); 40 setTimeout(function() {window.internals.setPageScaleFactor(1);}, 0);
40 t.done(); 41 t.done();
41 } 42 }
42 })); 43 }));
43 }, 'Setting scrollRestoration to manual should not affect scale restoration'); 44 }, 'Setting scrollRestoration to manual should not affect scale restoration');
44 </script> 45 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698