blob: 0003e36bad04accd1647f61759d48c7a708cc663 [file] [log] [blame]
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../vr/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/vr_service.mojom.js"></script>
<script src="../vr/resources/mock-vr-service.js"></script>
<canvas id="webgl-canvas"></canvas>
<script src="../vr/resources/presentation-setup.js"></script>
<script>
let fakeDisplays = fakeVRDisplays();
vr_test((t, mockService) => {
let watcherDone = new Event("watcherdone");
navigator.xr.requestDevice().then( (device) => {
runWithUserGesture( () => {
device.requestSession({ exclusive: true }).then( (session) => {
let eventWatcher = new EventWatcher(t, session, ["end", "watcherdone"]);
let eventPromise = eventWatcher.wait_for(["end", "watcherdone"]);
function onSessionEnd(event) {
t.step( () => {
assert_equals(event.session, session);
session.dispatchEvent(watcherDone);
});
}
session.addEventListener("end", onSessionEnd, false);
session.end();
return eventPromise;
}, (err) => {
t.step( () => {
assert_unreached("requestSession rejected");
});
}).then( () => {
t.done();
});
});
}, (err) => {
t.step( () => {
assert_unreached("requestDevice rejected");
});
});
}, [fakeDisplays["Pixel"]],
"Test deviceconnect fires when devices are connected.");
</script>