OLD | NEW |
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 <script> | 8 <script> |
9 let fakeDisplays = fakeVRDisplays(); | 9 let fakeDisplays = fakeVRDisplays(); |
10 | 10 |
11 vr_test( (t) => { | 11 vr_test( (t) => { |
12 return navigator.getVRDisplays().then( (displays) => { | 12 return navigator.getVRDisplays().then( (displays) => { |
13 t.step( () => { | 13 t.step( () => { |
14 assert_true(displays != null); | 14 assert_true(displays != null); |
15 assert_equals(displays.length, 2); | 15 assert_equals(displays.length, 2); |
16 }, "getVRDisplays returned correct results"); | 16 }, "getVRDisplays returned correct results"); |
17 let pixel = displays[0]; | 17 let pixel = displays[0]; |
18 let fake = displays[1]; | 18 let fake = displays[1]; |
19 | 19 |
20 t.step( () => { | 20 t.step( () => { |
21 assert_equals(pixel.displayName, "Google, Inc. Daydream View"); | 21 assert_equals(pixel.displayName, "Google, Inc. Daydream View"); |
22 assert_true(pixel.capabilities.hasOrientation); | |
23 assert_true(pixel.capabilities.canPresent); | 22 assert_true(pixel.capabilities.canPresent); |
24 assert_false(pixel.capabilities.hasPosition); | 23 assert_false(pixel.capabilities.hasPosition); |
25 assert_false(pixel.capabilities.hasExternalDisplay); | 24 assert_false(pixel.capabilities.hasExternalDisplay); |
26 assert_equals(pixel.capabilities.maxLayers, 1); | 25 assert_equals(pixel.capabilities.maxLayers, 1); |
27 assert_approx_equals(pixel.depthNear, 0.01, FLOAT_EPSILON); | 26 assert_approx_equals(pixel.depthNear, 0.01, FLOAT_EPSILON); |
28 assert_approx_equals(pixel.depthFar, 10000.0, FLOAT_EPSILON); | 27 assert_approx_equals(pixel.depthFar, 10000.0, FLOAT_EPSILON); |
29 }, "Pixel attributes are correct"); | 28 }, "Pixel attributes are correct"); |
30 | 29 |
31 t.step( () => { | 30 t.step( () => { |
32 assert_equals(fake.displayName, "FakeVRDisplay"); | 31 assert_equals(fake.displayName, "FakeVRDisplay"); |
33 assert_true(fake.capabilities.hasOrientation); | |
34 assert_false(fake.capabilities.canPresent); | 32 assert_false(fake.capabilities.canPresent); |
35 assert_false(fake.capabilities.hasPosition); | 33 assert_false(fake.capabilities.hasPosition); |
36 assert_false(fake.capabilities.hasExternalDisplay); | 34 assert_false(fake.capabilities.hasExternalDisplay); |
37 assert_equals(fake.capabilities.maxLayers, 0); | 35 assert_equals(fake.capabilities.maxLayers, 0); |
38 assert_approx_equals(fake.depthNear, 0.01, FLOAT_EPSILON); | 36 assert_approx_equals(fake.depthNear, 0.01, FLOAT_EPSILON); |
39 assert_approx_equals(fake.depthFar, 10000.0, FLOAT_EPSILON); | 37 assert_approx_equals(fake.depthFar, 10000.0, FLOAT_EPSILON); |
40 }, "Fake device attributes are correct"); | 38 }, "Fake device attributes are correct"); |
41 }, (err) => { | 39 }, (err) => { |
42 t.step( () => { | 40 t.step( () => { |
43 assert_unreached("getVRDisplays rejected"); | 41 assert_unreached("getVRDisplays rejected"); |
44 }); | 42 }); |
45 }).then( () => { | 43 }).then( () => { |
46 t.done(); | 44 t.done(); |
47 }); | 45 }); |
48 }, [fakeDisplays["Pixel"], fakeDisplays["FakeMagicWindowOnly"]], | 46 }, [fakeDisplays["Pixel"], fakeDisplays["FakeMagicWindowOnly"]], |
49 "Test that getVRDisplays properly returns two displays"); | 47 "Test that getVRDisplays properly returns two displays"); |
50 | 48 |
51 </script> | 49 </script> |
OLD | NEW |