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

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

Issue 2888313002: WebVR: Defer GetVSync calls until the current frame is submitted. (Closed)
Patch Set: Rebase on crrev.com/2891033002#ps80001 (ps5) 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_submitFrame_combinations.html
diff --git a/third_party/WebKit/LayoutTests/vr/requestAnimationFrame_submitFrame_combinations.html b/third_party/WebKit/LayoutTests/vr/requestAnimationFrame_submitFrame_combinations.html
new file mode 100644
index 0000000000000000000000000000000000000000..4c115d16a59d187d225c55a8edd66ffc2ef67719
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/vr/requestAnimationFrame_submitFrame_combinations.html
@@ -0,0 +1,72 @@
+<!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];
+
+ function onFrameStartup() {
+ // Wait until presentation starts, then proceed
+ // with the remaining tests.
+ if (display.isPresenting) {
+ display.requestAnimationFrame(onFrame1);
+ display.submitFrame();
+ } else {
+ display.requestAnimationFrame(onFrameStartup);
+ }
+ }
+
+ function onFrame1() {
+ // case (b): submit frame first, then rAF
+ display.submitFrame();
+ display.requestAnimationFrame(onFrame2);
+ }
+
+ function onFrame2() {
+ // case (c): rAF first, then submit frame
+ display.requestAnimationFrame(onFrame3);
+ display.submitFrame();
+ }
+
+ function onFrame3(time) {
+ // case (d): don't submit a frame.
+ display.requestAnimationFrame(onFrame4);
+ }
+
+ function onFrame4(time) {
+ // If we get here, we're done.
+ t.done();
+ }
+
+ runWithUserGesture( () => {
+ display.requestPresent([{ source : webglCanvas }]).then( () => {
+ t.step( () => {
+ assert_true(display.isPresenting);
+ }, "Display should be presenting");
+ }, (err) => {
+ t.step( () => {
+ assert_unreached(err);
+ }, "requestPresent rejected");
+ });
+ });
+
+ // Start: case (a) outside animating context.
+ display.requestAnimationFrame(onFrameStartup);
+ }, (err) => {
+ t.step( () => {
+ assert_unreached("getVRDisplays rejected");
+ });
+ t.done();
+ });
+}, [fakeDisplays["Pixel"]],
+"multiple requestAnimationFrame requests call the correct callbacks");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698