| 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> | |
| 8 <script> | 7 <script> |
| 9 let fakeDisplays = fakeVRDisplays(); | 8 let fakeDisplays = fakeVRDisplays(); |
| 10 | 9 |
| 11 vr_test( (t) => { | 10 vr_test((service) => { |
| 12 return navigator.getVRDisplays().then( (displays) => { | 11 return navigator.getVRDisplays().then(devices => { |
| 13 t.step( () => { | 12 assert_true(devices != null); |
| 14 assert_true(displays != null); | 13 assert_equals(2, devices.length); |
| 15 assert_equals(displays.length, 2); | 14 assert_equals(devices[0].displayName, 'Google, Inc. Daydream View'); |
| 16 }, "getVRDisplays returned correct results"); | 15 assert_equals(devices[1].displayName, 'FakeVRDisplay'); |
| 17 let pixel = displays[0]; | 16 assert_true(devices[0].capabilities.hasOrientation); |
| 18 let fake = displays[1]; | 17 assert_true(devices[1].capabilities.hasOrientation); |
| 19 | 18 assert_true(devices[0].capabilities.canPresent); |
| 20 t.step( () => { | 19 assert_false(devices[1].capabilities.canPresent); |
| 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"); | |
| 44 }); | 20 }); |
| 45 }).then( () => { | 21 }, [fakeDisplays['Pixel'], fakeDisplays['FakeMagicWindowOnly']], |
| 46 t.done(); | 22 'Test 2 VRDisplays'); |
| 47 }); | |
| 48 }, [fakeDisplays["Pixel"], fakeDisplays["FakeMagicWindowOnly"]], | |
| 49 "Test that getVRDisplays properly returns two displays"); | |
| 50 | 23 |
| 51 </script> | 24 </script> |
| OLD | NEW |