Auto merge of #23641 - Manishearth:newtest, r=asajeffrey

Update to newest XRTest API

requires https://github.com/servo/rust-webvr/pull/88 and https://github.com/servo/servo/pull/23575

Incorporates changes from https://github.com/immersive-web/webxr-test-api/pull/10 (and various minor improvements on that, like https://github.com/immersive-web/webxr-test-api/pull/20). Test no longer relies on racy state setting functions.

We're nearing consensus on what the test API should look like, thought I'd implement the updated model so I can start poking at the tests.

Fixes https://github.com/servo/servo/issues/23634 by setting everything at initialization.

This is based on https://github.com/servo/servo/pull/23575, so we can't merge it yet.

r? @asajeffrey (only the last commit)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23641)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-07-02 15:10:14 -04:00 committed by GitHub
commit b4ed3b6f3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 263 additions and 194 deletions

View file

@ -19683,15 +19683,15 @@
"testharness"
],
"webxr/create_session.html": [
"306ab85d3b1b914d2dd7c11a3b03dccd990148ae",
"ddec5add27b84e8e2febe3789d326f1e9fb7f508",
"testharness"
],
"webxr/obtain_frame.html": [
"99d8fd1ef152e4030444c3ca42482d28c3e855d3",
"e2b4424d5779baedf6bdb50f1b3151336f31a4cb",
"testharness"
],
"webxr/resources/webxr-util.js": [
"b644ba72ac801bc8f659e9678d31ab23db0b7281",
"554c1c183d3710e54dc60704dad0aac542ffd67c",
"support"
]
},

View file

@ -2,11 +2,16 @@
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./resources/webxr-util.js"></script>
</head>
<body>
<script>
async_test(function(t) {
navigator.xr.test.simulateDeviceConnection({supportsImmersive: true}).then((m) => {
navigator.xr.test.simulateDeviceConnection({
supportsImmersive: true,
views: TEST_VIEWS,
viewerOrigin: {position: [0.5, 0.1, 0.1], orientation: [1, 0, 0, 1] }
}).then((m) => {
return navigator.xr.requestSession({mode: "immersive-vr"})
}).then(() => t.done());
});

View file

@ -11,9 +11,11 @@
let canvas = document.getElementById("canvas");
let gl = canvas.getContext('webgl');
promise_test(async function() {
let mock = await navigator.xr.test.simulateDeviceConnection({supportsImmersive: true});
mock.setViewerOrigin({position: [0.5, 0.1, 0.1, 1], orientation: [1, 0, 0, 1] });
mock.setViews(TEST_VIEWS);
let mock = await navigator.xr.test.simulateDeviceConnection({
supportsImmersive: true,
views: TEST_VIEWS,
viewerOrigin: {position: [0.5, 0.1, 0.1], orientation: [1, 0, 0, 1] }
});
let session = await navigator.xr.requestSession({mode: "immersive-vr"});
await session.updateRenderState({"baseLayer": new XRWebGLLayer(session, gl, {})});
let resolve;

View file

@ -3,7 +3,8 @@
const VALID_PROJECTION_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 3, 2, -1, -1, 0, 0, -0.2, 0];
const LEFT_OFFSET = {position: [-0.1, 0, 0], orientation: [0,0,0,0]};
const RIGHT_OFFSET = {position: [0.1, 0, 0], orientation: [0,0,0,0]};
const LEFT_VIEWPORT = {x: 0, y: 0, width: 320, height: 480};
const RIGHT_VIEWPORT = {x: 320, y: 0, width: 320, height: 480};
let assert_matrix_approx_equals = function(m1, m2, epsilon, prefix = "") {
assert_equals(m1.length, m2.length, prefix + "Matrix lengths should match");
for(var i = 0; i < m1.length; ++i) {
@ -12,6 +13,6 @@ let assert_matrix_approx_equals = function(m1, m2, epsilon, prefix = "") {
}
const TEST_VIEWS = [
{eye: "left", projectionMatrix: VALID_PROJECTION_MATRIX, viewOffset: LEFT_OFFSET},
{eye: "right", projectionMatrix: VALID_PROJECTION_MATRIX, viewOffset: RIGHT_OFFSET}
{eye: "left", projectionMatrix: VALID_PROJECTION_MATRIX, viewOffset: LEFT_OFFSET, viewport: LEFT_VIEWPORT},
{eye: "right", projectionMatrix: VALID_PROJECTION_MATRIX, viewOffset: RIGHT_OFFSET, viewport: RIGHT_VIEWPORT}
];