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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/vr/requestAnimationFrame_unregister.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/vr/requestAnimationFrame_invalidhandle.html
diff --git a/third_party/WebKit/LayoutTests/vr/requestAnimationFrame_invalidhandle.html b/third_party/WebKit/LayoutTests/vr/requestAnimationFrame_invalidhandle.html
new file mode 100644
index 0000000000000000000000000000000000000000..5ce86969dca748ae5c7535abb8f44f37ee4ccc88
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/vr/requestAnimationFrame_invalidhandle.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../resources/mojo-helpers.js"></script>
+<script src="resources/fake-vr-displays.js"></script>
+<script src="resources/mock-vr-service.js"></script>
+<script>
+let fakeDisplays = fakeVRDisplays();
+
+vr_test( (t) => {
+ return navigator.getVRDisplays().then( (displays) => {
+ let display = displays[0];
+ let canFinish = false;
+ let counter = 0;
+
+ function onAnimationFrame() {
+ // Intentionally display.rAF at the beginning, ensuring that there's an
+ // outstanding callback when t.done() is called. This is to make sure it
+ // doesn't cause any unexpected behavior like it did with
+ // crbug.com/679401
+ display.requestAnimationFrame(onAnimationFrame);
+ if (counter > 10) {
+ t.done();
+ }
+ if (counter > 0) {
+ counter++;
+ }
+ if (canFinish) {
+ canFinish = false;
+ counter++;
+ }
+ }
+
+ let handle = display.requestAnimationFrame(onAnimationFrame);
+ display.cancelAnimationFrame(0);
+ display.cancelAnimationFrame(-1);
+ display.cancelAnimationFrame(handle + 1);
+ display.cancelAnimationFrame(handle - 1);
+ display.cancelAnimationFrame(0.5);
+ display.cancelAnimationFrame(null);
+ canFinish = true;
+ }, (err) => {
+ t.step( () => {
+ assert_unreached("getVRDisplays rejected");
+ });
+ t.done();
+ });
+}, [fakeDisplays["Pixel"]],
+"cancelAnimationFrame does not have unexpected behavior when given invalid handles");
+
+</script>
« 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