Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: third_party/WebKit/LayoutTests/virtual/threaded/fast/scroll-behavior/smooth-scroll/main-thread-scrolling-reason-added.html

Issue 2511473003: Round the scroll offset synced back to main instead of flooring. (Closed)
Patch Set: Wait for scroll animation to complete before checking main thread scrolling reasons. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../../../../resources/js-test.js"></script> 2 <script src="../../../../../resources/js-test.js"></script>
3 <style> 3 <style>
4 body { 4 body {
5 width: 2000px; 5 width: 2000px;
6 height: 2000px; 6 height: 2000px;
7 } 7 }
8 </style> 8 </style>
9 9
10 <script> 10 <script>
11 var jsTestIsAsync = true; 11 var jsTestIsAsync = true;
12 12
13 description("This test verifies that smooth scrolls initiated on the main " + 13 description("This test verifies that smooth scrolls initiated on the main " +
14 "thread add the appropriate main thread scrolling reason."); 14 "thread add the appropriate main thread scrolling reason.");
15 15
16 // From ScrollingCoordinator::mainThreadScrollingReasonsAsText. 16 // From ScrollingCoordinator::mainThreadScrollingReasonsAsText.
17 var ANIMATING_TEXT = "Handling scroll from main thread"; 17 var ANIMATING_TEXT = "Handling scroll from main thread";
18 var IDLE = "Idle";
18 var RUNNING_ON_COMPOSITOR = "RunningOnCompositor"; 19 var RUNNING_ON_COMPOSITOR = "RunningOnCompositor";
19 20
20 function finishTest() { 21 function finishTest() {
21 requestAnimationFrame(function() { 22 requestAnimationFrame(function() {
23 shouldBe("document.scrollingElement.scrollTop", "40");
22 // Check that main thread scrolling reason is removed. 24 // Check that main thread scrolling reason is removed.
23 shouldBeTrue("internals.mainThreadScrollingReasons(document) == ''"); 25 shouldBeTrue("internals.mainThreadScrollingReasons(document) == ''");
24 finishJSTest(); 26 finishJSTest();
25 }); 27 });
26 } 28 }
27 29
28 function runTest() { 30 function runTest() {
29 if (document.scrollingElement.scrollTop == 0) { 31 if (document.scrollingElement.scrollTop == 0) {
30 requestAnimationFrame(runTest); 32 requestAnimationFrame(runTest);
31 } else { 33 } else {
32 // Check that initiated by main thread and running on the compositor. 34 // Check that initiated by main thread and running on the compositor.
33 shouldBe("internals.getScrollAnimationState(document)", 35 shouldBe("internals.getScrollAnimationState(document)",
34 "RUNNING_ON_COMPOSITOR"); 36 "RUNNING_ON_COMPOSITOR");
35 // Check that main thread scrolling reason is added. 37 // Check that main thread scrolling reason is added.
36 shouldBe("internals.mainThreadScrollingReasons(document)", 38 shouldBe("internals.mainThreadScrollingReasons(document)",
37 "ANIMATING_TEXT"); 39 "ANIMATING_TEXT");
38 shouldBecomeEqual("document.scrollingElement.scrollTop == 40", 40 // Wait for scroll animation to complete.
39 "true", finishTest); 41 shouldBecomeEqual("internals.getScrollAnimationState(document)",
42 "IDLE", finishTest);
40 } 43 }
41 } 44 }
42 45
43 onload = function() { 46 onload = function() {
44 if (!window.eventSender || !window.internals) { 47 if (!window.eventSender || !window.internals) {
45 debug("This test requires window.eventSender.") 48 debug("This test requires window.eventSender.")
46 finishJSTest(); 49 finishJSTest();
47 return; 50 return;
48 } 51 }
49 internals.settings.setScrollAnimatorEnabled(true); 52 internals.settings.setScrollAnimatorEnabled(true);
50 53
51 document.scrollingElement.scrollTop = 0; 54 document.scrollingElement.scrollTop = 0;
52 55
53 // Scroll 1 ticks down. 56 // Scroll 1 ticks down.
54 eventSender.mouseMoveTo(20, 20); 57 eventSender.mouseMoveTo(20, 20);
55 eventSender.mouseScrollBy(0, -1); 58 eventSender.mouseScrollBy(0, -1);
56 runTest(); 59 runTest();
57 }; 60 };
58 61
59 </script> 62 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698