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

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

Issue 2888313002: WebVR: Defer GetVSync calls until the current frame is submitted. (Closed)
Patch Set: Tweak test to run a few frames in magic window mode 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/vr/requestAnimationFrame_submitFrame_combinations.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 <canvas id="webgl-canvas"></canvas>
8 <script src="resources/presentation-setup.js"></script>
9 <script>
10 let fakeDisplays = fakeVRDisplays();
11
12 // This test verifies that an application can hand off from window.rAF
13 // to vrDisplay.rAF, specifically where there is no pending vrDisplay.rAF
14 // at the time presentation starts.
15 //
16 // Caveat: This does *not* suffice to fully verify the current Android/GVR
17 // implementation. In the real implementation, the normal window VSync events
18 // (including window.rAF processing tied to them) are shut down, but in the
19 // layout test they continue running. So it's possible for this test to pass
20 // even though the scenario doesn't work in the real implementation. Keeping
21 // it as a layout test anyway as a sanity check - if this fails, we definitely
22 // have a problem.
23
24 vr_test( (t) => {
25 return navigator.getVRDisplays().then( (displays) => {
26 let display = displays[0];
27
28 let usingDisplayRAF = false;
29
30 function onAnimationFrame() {
31 if (display.isPresenting) {
32 if (usingDisplayRAF) {
33 t.done();
34 }
35
36 usingDisplayRAF = true;
37 display.requestAnimationFrame(onAnimationFrame);
38 } else {
39 window.requestAnimationFrame(onAnimationFrame);
40 }
41 }
42
43 runWithUserGesture( () => {
44 display.requestPresent([{ source : webglCanvas }]).then( () => {
45 t.step( () => {
46 assert_true(display.isPresenting);
47 }, "Display should be presenting");
48 }, (err) => {
49 t.step( () => {
50 assert_unreached(err);
51 }, "requestPresent rejected");
52 });
53 });
54
55 window.requestAnimationFrame(onAnimationFrame);
56 }, (err) => {
57 t.step( () => {
58 assert_unreached("getVRDisplays rejected");
59 });
60 t.done();
61 });
62 }, [fakeDisplays["Pixel"]],
63 "requestAnimationFrame properly switches from window to vrDisplay");
64
65 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/vr/requestAnimationFrame_submitFrame_combinations.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698