OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
3 <script src="../../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 <script> | 4 <script> |
5 var numCallsScroll = 0; | 5 var numCallsScroll = 0; |
6 var numCallsResize = 0; | 6 var numCallsResize = 0; |
7 | 7 |
8 var t = async_test('verify that the resize events get fired when the window is
resized.'); | 8 var t = async_test('verify that the resize events get fired when the window is
resized.'); |
9 | 9 |
10 window.onload = t.step_func(function() { | 10 window.onload = t.step_func(function() { |
11 testRunner.useUnfortunateSynchronousResizeMode(); | 11 testRunner.useUnfortunateSynchronousResizeMode(); |
12 | 12 |
13 // Turn off smooth scrolling. | 13 // Turn off smooth scrolling. |
14 internals.settings.setScrollAnimatorEnabled(false); | 14 internals.settings.setScrollAnimatorEnabled(false); |
15 | 15 |
16 window.visualViewport.addEventListener('scroll', function(e) { | 16 window.view.addEventListener('scroll', function(e) { |
17 numCallsScroll++; | 17 numCallsScroll++; |
18 }); | 18 }); |
19 | 19 |
20 window.visualViewport.addEventListener('resize', function(e) { | 20 window.view.addEventListener('resize', function(e) { |
21 numCallsResize++; | 21 numCallsResize++; |
22 }); | 22 }); |
23 | 23 |
24 window.resizeTo(window.outerWidth - 24, window.outerHeight - 24); | 24 window.resizeTo(window.outerWidth - 24, window.outerHeight - 24); |
25 requestAnimationFrame(function() { | 25 requestAnimationFrame(function() { |
26 t.step(function() { | 26 t.step(function() { |
27 assert_equals(numCallsScroll, 0, "resize 1 doesn't fire scroll event"); | 27 assert_equals(numCallsScroll, 0, "resize 1 doesn't fire scroll event"); |
28 assert_equals(numCallsResize, 1, "resize 1 fires resize event"); | 28 assert_equals(numCallsResize, 1, "resize 1 fires resize event"); |
29 }); | 29 }); |
30 window.resizeTo(window.outerWidth + 24, window.outerHeight + 24); | 30 window.resizeTo(window.outerWidth + 24, window.outerHeight + 24); |
31 requestAnimationFrame(function() { | 31 requestAnimationFrame(function() { |
32 t.step(function() { | 32 t.step(function() { |
33 assert_equals(numCallsScroll, 0, "resize 2 doesn't fire scroll event")
; | 33 assert_equals(numCallsScroll, 0, "resize 2 doesn't fire scroll event")
; |
34 assert_equals(numCallsResize, 2, "resize 2 fires resize event"); | 34 assert_equals(numCallsResize, 2, "resize 2 fires resize event"); |
35 t.done(); | 35 t.done(); |
36 }); | 36 }); |
37 }); | 37 }); |
38 }); | 38 }); |
39 }); | 39 }); |
40 </script> | 40 </script> |
OLD | NEW |