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

Unified Diff: third_party/WebKit/LayoutTests/vr/requestAnimationFrame_handoff.html

Issue 2888313002: WebVR: Defer GetVSync calls until the current frame is submitted. (Closed)
Patch Set: Refactor RequestVSync, add comments and test Created 3 years, 7 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
Index: third_party/WebKit/LayoutTests/vr/requestAnimationFrame_handoff.html
diff --git a/third_party/WebKit/LayoutTests/vr/requestAnimationFrame_handoff.html b/third_party/WebKit/LayoutTests/vr/requestAnimationFrame_handoff.html
new file mode 100644
index 0000000000000000000000000000000000000000..94730ede223da0e3062bce2a79d7e68dab7a7652
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/vr/requestAnimationFrame_handoff.html
@@ -0,0 +1,55 @@
+<!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>
+<canvas id="webgl-canvas"></canvas>
+<script src="resources/presentation-setup.js"></script>
+<script>
+let fakeDisplays = fakeVRDisplays();
+
+vr_test( (t) => {
+ return navigator.getVRDisplays().then( (displays) => {
+ let display = displays[0];
+
+ let usingDisplayRAF = false;
+
+ function onAnimationFrame() {
+ //console.log("Animating, isPresenting=" + display.isPresenting);
+ if (display.isPresenting) {
+ if (usingDisplayRAF) {
+ t.done();
+ }
+
+ usingDisplayRAF = true;
+ display.requestAnimationFrame(onAnimationFrame);
+ } else {
+ window.requestAnimationFrame(onAnimationFrame);
+ }
+ }
+
+ runWithUserGesture( () => {
+ //document.write("requestPresent");
+ display.requestPresent([{ source : webglCanvas }]).then( () => {
+ t.step( () => {
+ assert_true(display.isPresenting);
+ }, "Display should be presenting");
+ }, (err) => {
+ t.step( () => {
+ assert_unreached(err);
+ }, "requestPresent rejected");
+ });
+ });
+
+ window.requestAnimationFrame(onAnimationFrame);
+ }, (err) => {
+ t.step( () => {
+ assert_unreached("getVRDisplays rejected");
+ });
+ t.done();
+ });
+}, [fakeDisplays["Pixel"]],
+"requestAnimationFrame properly switches from window to vrDisplay");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698