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

Side by Side Diff: third_party/WebKit/LayoutTests/vr/requestAnimationFrame_invalidhandle.html

Issue 2622943002: Fix WebVR requestAnimationFrame leaking (Closed)
Patch Set: Properly fix leak Created 3 years, 11 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
(Empty)
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <script src="../resources/mojo-helpers.js"></script>
5 <script src="resources/fake-vr-displays.js"></script>
6 <script src="resources/mock-vr-service.js"></script>
7 <script>
8 let fakeDisplays = fakeVRDisplays();
9
10 vr_test( (t) => {
11 return navigator.getVRDisplays().then( (displays) => {
12 let display = displays[0];
13 let canFinish = false;
14 let counter = 0;
15
16 function onAnimationFrame() {
17 display.requestAnimationFrame(onAnimationFrame);
18 if (counter > 10) {
19 t.done();
sof 2017/01/13 08:41:24 this looks like it is pumping onAnimationFrame() c
bsheedy 2017/01/13 18:02:01 See earlier reply to your message.
20 }
21 if (counter > 0) {
22 counter++;
23 }
24 if (canFinish) {
25 canFinish = false;
26 counter++;
27 }
28 }
29
30 let handle = display.requestAnimationFrame(onAnimationFrame);
31 display.cancelAnimationFrame(0);
32 display.cancelAnimationFrame(-1);
33 display.cancelAnimationFrame(handle + 1);
34 display.cancelAnimationFrame(handle - 1);
35 display.cancelAnimationFrame(0.5);
36 display.cancelAnimationFrame(null);
37 canFinish = true;
38 }, (err) => {
39 t.step( () => {
40 assert_unreached("getVRDisplays rejected");
41 });
42 t.done();
43 });
44 }, [fakeDisplays["Pixel"]],
45 "cancelAnimationFrame does not have unexpected behavior when given invalid handl es");
46
47 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698