| <!DOCTYPE html> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="resources/fake-vr-displays.js"></script> |
| <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> |
| <script src="file:///gen/device/vr/public/mojom/vr_service.mojom.js"></script> |
| <script src="resources/mock-vr-service.js"></script> |
| <script src="resources/test-constants.js"></script> |
| <script> |
| let fakeDisplays = fakeVRDisplays(); |
| |
| vr_test( (t) => { |
| return navigator.getVRDisplays().then( (displays) => { |
| t.step( () => { |
| assert_true(displays != null); |
| assert_equals(displays.length, 2); |
| }, "getVRDisplays returned correct results"); |
| let pixel = displays[0]; |
| let fake = displays[1]; |
| |
| t.step( () => { |
| assert_equals(pixel.displayName, "Google, Inc. Daydream View"); |
| assert_true(pixel.capabilities.canPresent); |
| assert_false(pixel.capabilities.hasPosition); |
| assert_false(pixel.capabilities.hasExternalDisplay); |
| assert_equals(pixel.capabilities.maxLayers, 1); |
| assert_approx_equals(pixel.depthNear, 0.01, FLOAT_EPSILON); |
| assert_approx_equals(pixel.depthFar, 10000.0, FLOAT_EPSILON); |
| }, "Pixel attributes are correct"); |
| |
| t.step( () => { |
| assert_equals(fake.displayName, "FakeVRDisplay"); |
| assert_false(fake.capabilities.canPresent); |
| assert_false(fake.capabilities.hasPosition); |
| assert_false(fake.capabilities.hasExternalDisplay); |
| assert_equals(fake.capabilities.maxLayers, 0); |
| assert_approx_equals(fake.depthNear, 0.01, FLOAT_EPSILON); |
| assert_approx_equals(fake.depthFar, 10000.0, FLOAT_EPSILON); |
| }, "Fake device attributes are correct"); |
| }, (err) => { |
| t.step( () => { |
| assert_unreached("getVRDisplays rejected"); |
| }); |
| }).then( () => { |
| t.done(); |
| }); |
| }, [fakeDisplays["Pixel"], fakeDisplays["FakeMagicWindowOnly"]], |
| "Test that getVRDisplays properly returns two displays"); |
| |
| </script> |