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

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

Issue 2622943002: Fix WebVR requestAnimationFrame leaking (Closed)
Patch Set: Rebase to see if CQ failure fixed 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/vr/requestAnimationFrame_unregister.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Intentionally display.rAF at the beginning, ensuring that there's an
18 // outstanding callback when t.done() is called. This is to make sure it
19 // doesn't cause any unexpected behavior like it did with
20 // crbug.com/679401
21 display.requestAnimationFrame(onAnimationFrame);
22 if (counter > 10) {
23 t.done();
24 }
25 if (counter > 0) {
26 counter++;
27 }
28 if (canFinish) {
29 canFinish = false;
30 counter++;
31 }
32 }
33
34 let handle = display.requestAnimationFrame(onAnimationFrame);
35 display.cancelAnimationFrame(0);
36 display.cancelAnimationFrame(-1);
37 display.cancelAnimationFrame(handle + 1);
38 display.cancelAnimationFrame(handle - 1);
39 display.cancelAnimationFrame(0.5);
40 display.cancelAnimationFrame(null);
41 canFinish = true;
42 }, (err) => {
43 t.step( () => {
44 assert_unreached("getVRDisplays rejected");
45 });
46 t.done();
47 });
48 }, [fakeDisplays["Pixel"]],
49 "cancelAnimationFrame does not have unexpected behavior when given invalid handl es");
50
51 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/vr/requestAnimationFrame_unregister.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698