Chromium Code Reviews| 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 scroll events get fired when the window is resized.'); | |
|
bokan
2016/06/24 21:52:36
This should be testing the resize event is fired w
ymalik
2016/06/27 14:10:01
Absolutely!
| |
| 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 assert_equals(numCallsScroll, 1); | |
| 27 assert_equals(numCallsResize, 0); | |
| 28 window.resizeTo(window.outerWidth + 24, window.outerHeight + 24); | |
| 29 requestAnimationFrame(function() { | |
| 30 assert_equals(numCallsScroll, 2); | |
| 31 assert_equals(numCallsResize, 0); | |
| 32 t.done(); | |
| 33 }); | |
| 34 }); | |
| 35 }); | |
| 36 </script> | |
| OLD | NEW |