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