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

Side by Side Diff: LayoutTests/fast/events/scroll-event-raf-timing.html

Issue 615033002: Refactor of various layout tests to use RAF (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months 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 <style> 2 <style>
3 #scrollable { overflow: scroll; height: 100px; width: 100px; } 3 #scrollable { overflow: scroll; height: 100px; width: 100px; }
4 #scrollable div { height: 2000px; } 4 #scrollable div { height: 2000px; }
5 </style> 5 </style>
6 6
7 <p>Tests that we only fire one scroll event per frame (and by association that i t happens at raf time).</p> 7 <p>Tests that we only fire one scroll event per frame (and by association that i t happens at raf time).</p>
8 8
9 <div id="scrollable"> 9 <div id="scrollable">
10 <div></div> 10 <div></div>
(...skipping 14 matching lines...) Expand all
25 var remainingTicks = 20; 25 var remainingTicks = 20;
26 26
27 scrollable.onscroll = function() { 27 scrollable.onscroll = function() {
28 ++scrollsSinceLastFrame; 28 ++scrollsSinceLastFrame;
29 }; 29 };
30 30
31 var timerId = setInterval(function() { 31 var timerId = setInterval(function() {
32 scrollable.scrollTop += 1; 32 scrollable.scrollTop += 1;
33 if (!--remainingTicks) 33 if (!--remainingTicks)
34 clearInterval(timerId); 34 clearInterval(timerId);
35 }, 0); 35 }, 1);
Julien - ping for review 2014/10/03 22:22:32 Those delay changes are separated from the rAF cha
alex clarke (OOO till 29th) 2014/10/10 17:46:02 Done.
36 36
37 function raf() { 37 function raf() {
38 if (scrollsSinceLastFrame > 1) { 38 if (scrollsSinceLastFrame > 1) {
39 document.body.appendChild(document.createTextNode('FAIL')); 39 document.body.appendChild(document.createTextNode('FAIL'));
40 ++failures; 40 ++failures;
41 } 41 }
42 if (remainingTicks) { 42 if (remainingTicks) {
43 requestAnimationFrame(raf); 43 requestAnimationFrame(raf);
44 } else { 44 } else {
45 if (!failures) 45 if (!failures)
46 document.body.appendChild(document.createTextNode('PASS')); 46 document.body.appendChild(document.createTextNode('PASS'));
47 if (window.testRunner) 47 if (window.testRunner)
48 testRunner.notifyDone(); 48 testRunner.notifyDone();
49 } 49 }
50 scrollsSinceLastFrame = 0; 50 scrollsSinceLastFrame = 0;
51 } 51 }
52 52
53 requestAnimationFrame(raf); 53 requestAnimationFrame(raf);
54 } 54 }
55 </script> 55 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698