aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/xr.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-05-30 22:04:22 -0400
committerGitHub <noreply@github.com>2019-05-30 22:04:22 -0400
commit7c8a4ecead45d576bec3aaba02a13d8f21434eb4 (patch)
tree30371c01567eadc86858796c438ab3304e3987bc /components/script/dom/xr.rs
parenta5506365d6f1e8a75db7e7fa2f9e0b1ef73972ee (diff)
parentc2d4900c1616cb7acfd21a7ae7a5d1d134c085f9 (diff)
downloadservo-7c8a4ecead45d576bec3aaba02a13d8f21434eb4.tar.gz
servo-7c8a4ecead45d576bec3aaba02a13d8f21434eb4.zip
Auto merge of #23485 - Manishearth:xrtest, r=asajeffrey
Basic XR Testing support This adds support for the XRTest and FakeXRDeviceController APIs from https://github.com/immersive-web/webxr-test-api, and plugs them into the `mock` backend of rust-webvr. Tested with [a modified webxr test page](https://github.com/immersive-web/webxr-test-api) r? @jdm @asajeffrey <!-- 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/23485) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/xr.rs')
-rw-r--r--components/script/dom/xr.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/components/script/dom/xr.rs b/components/script/dom/xr.rs
index 3ff67b0042c..1626ad4e00e 100644
--- a/components/script/dom/xr.rs
+++ b/components/script/dom/xr.rs
@@ -21,6 +21,7 @@ use crate::dom::promise::Promise;
use crate::dom::vrdisplay::VRDisplay;
use crate::dom::vrdisplayevent::VRDisplayEvent;
use crate::dom::xrsession::XRSession;
+use crate::dom::xrtest::XRTest;
use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
use profile_traits::ipc;
@@ -36,6 +37,7 @@ pub struct XR {
gamepads: DomRefCell<Vec<Dom<Gamepad>>>,
pending_immersive_session: Cell<bool>,
active_immersive_session: MutNullableDom<VRDisplay>,
+ test: MutNullableDom<XRTest>,
}
impl XR {
@@ -46,6 +48,7 @@ impl XR {
gamepads: DomRefCell::new(Vec::new()),
pending_immersive_session: Cell::new(false),
active_immersive_session: Default::default(),
+ test: Default::default(),
}
}
@@ -141,6 +144,11 @@ impl XRMethods for XR {
session.xr_present(promise.clone());
promise
}
+
+ // https://github.com/immersive-web/webxr-test-api/blob/master/explainer.md
+ fn Test(&self) -> DomRoot<XRTest> {
+ self.test.or_init(|| XRTest::new(&self.global()))
+ }
}
impl XR {