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