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

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

Issue 2624263003: Add more WebVR layout tests and fix small issues they found (Closed)
Patch Set: Added a few clarifying comments 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <script src="../resources/mojo-helpers.js"></script> 4 <script src="../resources/mojo-helpers.js"></script>
5 <script src="resources/fake-vr-displays.js"></script> 5 <script src="resources/fake-vr-displays.js"></script>
6 <script src="resources/mock-vr-service.js"></script> 6 <script src="resources/mock-vr-service.js"></script>
7 <script src="resources/test-constants.js"></script> 7 <script src="resources/test-constants.js"></script>
8 <canvas id="webgl-canvas"></canvas> 8 <canvas id="webgl-canvas"></canvas>
9 <script src="resources/presentation-setup.js"></script> 9 <script src="resources/presentation-setup.js"></script>
10 <script> 10 <script>
11 let fakeDisplays = fakeVRDisplays(); 11 let fakeDisplays = fakeVRDisplays();
12 12
13 vr_test( (t) => { 13 vr_test( (t) => {
14 return navigator.getVRDisplays().then( (displays) => { 14 return navigator.getVRDisplays().then( (displays) => {
15 var display = displays[0]; 15 var display = displays[0];
16 16
17 t.step( () => { 17 t.step( () => {
18 assert_equals(display.getLayers().length, 0); 18 assert_equals(display.getLayers().length, 0);
19 }, "No layers initially returned"); 19 }, "No layers initially returned");
20 20
21 runWithUserGesture( () => { 21 runWithUserGesture( () => {
22 display.requestPresent([{ source : webglCanvas }]).then( () => { 22 let expectedLeft = [0.0, 0.1, 0.2, 0.3];
23 let expectedRight = [0.4, 0.5, 0.6, 0.7];
24 display.requestPresent([{ source : webglCanvas,
25 leftBounds : expectedLeft,
26 rightBounds : expectedRight}]).then( () => {
23 t.step( () => { 27 t.step( () => {
24 let layers = display.getLayers(); 28 let layers = display.getLayers();
25 assert_equals(layers.length, 1); 29 assert_equals(layers.length, 1);
26 let layer = layers[0]; 30 let layer = layers[0];
27 31
28 assert_equals(layer.source, webglCanvas); 32 assert_equals(layer.source, webglCanvas);
29 assert_equals(layer.leftBounds.length, 4); 33 assert_equals(layer.leftBounds.length, 4);
30 assert_equals(layer.rightBounds.length, 4); 34 assert_equals(layer.rightBounds.length, 4);
31 35
32 let expectedLeft = [0.0, 0.0, 0.5, 1.0];
33 let expectedRight = [0.5, 0.0, 0.5, 1.0];
34 for (let i = 0; i < layer.leftBounds.length; i++) { 36 for (let i = 0; i < layer.leftBounds.length; i++) {
35 assert_approx_equals(layer.leftBounds[i], expectedLeft[i], 37 assert_approx_equals(layer.leftBounds[i], expectedLeft[i],
36 FLOAT_EPSILON); 38 FLOAT_EPSILON);
37 assert_approx_equals(layer.rightBounds[i], expectedRight[i], 39 assert_approx_equals(layer.rightBounds[i], expectedRight[i],
38 FLOAT_EPSILON); 40 FLOAT_EPSILON);
39 } 41 }
40 }, "Layer is correct"); 42 }, "Layer is correct");
41 }, (err) => { 43 }, (err) => {
42 t.step( () => { 44 t.step( () => {
43 assert_unreached(); 45 assert_unreached();
44 }, "requestPresent failed"); 46 }, "requestPresent failed");
45 }).then( () => { 47 }).then( () => {
46 t.done(); 48 t.done();
47 }); 49 });
48 }); 50 });
49 }, (err) => { 51 }, (err) => {
50 t.step( () => { 52 t.step( () => {
51 assert_unreached(); 53 assert_unreached();
52 }, "getVRDisplays rejected"); 54 }, "getVRDisplays rejected");
53 t.done(); 55 t.done();
54 }); 56 });
55 }, [fakeDisplays["Pixel"]], 57 }, [fakeDisplays["Pixel"]],
56 "Test getLayers returns an empty array when not presenting"); 58 "Test getLayers returns non-default bounds when specified in the layer");
57 59
58 </script> 60 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698