OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <script src="../../../../../resources/js-test.js"></script> | |
3 <style> | |
4 body { | |
5 width: 2000px; | |
6 height: 2000px; | |
7 } | |
8 </style> | |
9 | |
10 <script> | |
11 var jsTestIsAsync = true; | |
12 | |
13 description("This test verifies that smooth scrolls initiated on the main " + | |
14 "thread add the appropriate main thread scrolling reason."); | |
15 | |
16 // From ScrollingCoordinator::mainThreadScrollingReasonsAsText. | |
17 var ANIMATING_TEXT = 'Animating scroll on main thread'; | |
18 | |
19 function finishTest() { | |
20 requestAnimationFrame(function() { | |
21 // Check that main thread scrolling reason is removed. | |
22 shouldBe("internals.mainThreadScrollingReasons(document)" + | |
23 ".localeCompare('')", "0"); | |
skobes
2016/02/05 19:31:43
Curious, why do you need localeCompare instead of
ymalik
2016/02/06 21:49:05
No good reason. Just remembered comparing strings
| |
24 finishJSTest(); | |
25 }); | |
26 } | |
27 | |
28 onload = function() { | |
29 if (!window.eventSender || !window.internals) { | |
30 debug("This test requires window.eventSender.") | |
31 finishJSTest(); | |
32 return; | |
33 } | |
34 internals.settings.setScrollAnimatorEnabled(true); | |
35 | |
36 // Scroll 1 ticks down. | |
37 eventSender.mouseMoveTo(20, 20); | |
38 eventSender.mouseScrollBy(0, -1); | |
39 | |
40 requestAnimationFrame(function() { | |
41 // Check that main thread scrolling reason is added. | |
42 shouldBe("internals.mainThreadScrollingReasons(document)" + | |
43 ".localeCompare(ANIMATING_TEXT)", "0"); | |
44 shouldBecomeEqual("document.scrollingElement.scrollTop == 40", | |
45 "true", finishTest); | |
46 }); | |
47 }; | |
48 | |
49 </script> | |
OLD | NEW |