OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <style> | 2 <style> |
3 body { | 3 body { |
4 height: 2000px; | 4 height: 2000px; |
5 width: 2000px; | 5 width: 2000px; |
6 } | 6 } |
7 </style> | 7 </style> |
8 | 8 |
9 <script src="../../../resources/testharness.js"></script> | 9 <script src="../../../resources/testharness.js"></script> |
10 <script src="../../../resources/testharnessreport.js"></script> | 10 <script src="../../../resources/testharnessreport.js"></script> |
11 <script> | 11 <script> |
12 var numCallsScroll = 0; | 12 var numCallsScroll = 0; |
13 var numCallsResize = 0; | 13 var numCallsResize = 0; |
14 var pageScaleFactor = 2; | 14 var pageScaleFactor = 2; |
15 | 15 |
16 function viewport() { | 16 var t = async_test('verify that the scroll and resize events get fired on wind
ow.view'); |
17 return window.visualViewport; | |
18 } | |
19 | |
20 var t = async_test('verify that the scroll and resize events get fired on wind
ow.visualViewport'); | |
21 | 17 |
22 window.onload = t.step_func(function() { | 18 window.onload = t.step_func(function() { |
23 // Turn off smooth scrolling. | 19 // Turn off smooth scrolling. |
24 internals.settings.setScrollAnimatorEnabled(false); | 20 internals.settings.setScrollAnimatorEnabled(false); |
25 | 21 |
26 window.visualViewport.addEventListener('scroll', function(e) { | 22 window.view.addEventListener('scroll', function(e) { |
27 numCallsScroll++; | 23 numCallsScroll++; |
28 }); | 24 }); |
29 | 25 |
30 window.visualViewport.addEventListener('resize', function(e) { | 26 window.view.addEventListener('resize', function(e) { |
31 numCallsResize++; | 27 numCallsResize++; |
32 }); | 28 }); |
33 | 29 |
34 // Scroll both viewports. | 30 // Scroll both viewports. |
35 eventSender.mouseMoveTo(100, 100); | 31 eventSender.mouseMoveTo(100, 100); |
36 eventSender.continuousMouseScrollBy(100, 100); | 32 eventSender.continuousMouseScrollBy(100, 100); |
37 assert_equals(numCallsScroll, 0); | 33 assert_equals(numCallsScroll, 0); |
38 assert_equals(numCallsResize, 0); | 34 assert_equals(numCallsResize, 0); |
39 | 35 |
40 // TODO(ymalik): Remove hook to internals to pinch-zoom here and browser | 36 // TODO(ymalik): Remove hook to internals to pinch-zoom here and browser |
(...skipping 10 matching lines...) Expand all Loading... |
51 requestAnimationFrame(function() { | 47 requestAnimationFrame(function() { |
52 t.step(function() { | 48 t.step(function() { |
53 assert_equals(numCallsScroll, 1, "scroll listener called for offset ch
ange"); | 49 assert_equals(numCallsScroll, 1, "scroll listener called for offset ch
ange"); |
54 assert_equals(numCallsResize, 1, "resize listener not called for offse
t change"); | 50 assert_equals(numCallsResize, 1, "resize listener not called for offse
t change"); |
55 }); | 51 }); |
56 t.done(); | 52 t.done(); |
57 }); | 53 }); |
58 }); | 54 }); |
59 }); | 55 }); |
60 </script> | 56 </script> |
OLD | NEW |