mirror of
https://github.com/servo/servo.git
synced 2025-08-09 23:45:35 +01:00
Update web-platform-tests to revision af43e2eb32555059316b67fba4a1d7df6ea3148d
This commit is contained in:
parent
97c6246385
commit
2f89d25484
296 changed files with 21168 additions and 821 deletions
|
@ -47,25 +47,29 @@ class MockVRService {
|
|||
let device = new MockDevice(fakeDeviceInit, this);
|
||||
this.devices_.push(device);
|
||||
|
||||
if (this.client_) {
|
||||
this.client_.onDeviceChanged();
|
||||
}
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
// VRService implementation.
|
||||
requestDevice() {
|
||||
return Promise.resolve(
|
||||
{device: this.devices_[0] ? this.devices_[0].getDevicePtr() : null});
|
||||
}
|
||||
|
||||
setClient(client) {
|
||||
this.client_ = client;
|
||||
for (let i = 0; i < this.devices_.length; i++) {
|
||||
this.devices_[i].notifyClientOfDisplay();
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
// Implements both XRDeviceImpl and VRMagicWindowProvider. Maintains a mock for
|
||||
// Implements both XRDevice and VRMagicWindowProvider. Maintains a mock for
|
||||
// XRPresentationProvider.
|
||||
class MockDevice {
|
||||
constructor(fakeDeviceInit, service) {
|
||||
this.displayClient_ = new device.mojom.VRDisplayClientPtr();
|
||||
this.sessionClient_ = new device.mojom.XRSessionClientPtr();
|
||||
this.presentation_provider_ = new MockXRPresentationProvider();
|
||||
|
||||
this.pose_ = null;
|
||||
|
@ -80,23 +84,13 @@ class MockDevice {
|
|||
} else {
|
||||
this.displayInfo_ = this.getNonImmersiveDisplayInfo();
|
||||
}
|
||||
|
||||
if (service.client_) {
|
||||
this.notifyClientOfDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
// Functions for setup.
|
||||
// This function calls to the backend to add this device to the list.
|
||||
notifyClientOfDisplay() {
|
||||
getDevicePtr() {
|
||||
let devicePtr = new device.mojom.XRDevicePtr();
|
||||
let deviceRequest = mojo.makeRequest(devicePtr);
|
||||
let deviceBinding =
|
||||
new mojo.Binding(device.mojom.XRDevice, this, deviceRequest);
|
||||
|
||||
let clientRequest = mojo.makeRequest(this.displayClient_);
|
||||
this.service_.client_.onDisplayConnected(
|
||||
devicePtr, clientRequest, this.displayInfo_);
|
||||
new mojo.Binding(device.mojom.XRDevice, this, mojo.makeRequest(devicePtr));
|
||||
return devicePtr;
|
||||
}
|
||||
|
||||
// Test methods.
|
||||
|
@ -120,7 +114,7 @@ class MockDevice {
|
|||
}
|
||||
|
||||
if (changed) {
|
||||
this.displayClient_.onChanged(this.displayInfo_);
|
||||
this.sessionClient_.onChanged(this.displayInfo_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -279,8 +273,7 @@ class MockDevice {
|
|||
// do not have any use for this data at present.
|
||||
}
|
||||
|
||||
// XRDeviceImpl implementation.
|
||||
|
||||
// XRDevice implementation.
|
||||
requestSession(sessionOptions, was_activation) {
|
||||
return this.supportsSession(sessionOptions).then((result) => {
|
||||
// The JavaScript bindings convert c_style_names to camelCase names.
|
||||
|
@ -310,11 +303,15 @@ class MockDevice {
|
|||
device.mojom.XREnviromentIntegrationProvider, this,
|
||||
enviromentProviderRequest);
|
||||
|
||||
let clientRequest = mojo.makeRequest(this.sessionClient_);
|
||||
|
||||
return Promise.resolve({
|
||||
session: {
|
||||
submitFrameSink: submit_frame_sink,
|
||||
dataProvider: dataProviderPtr,
|
||||
enviromentProvider: enviromentProviderPtr
|
||||
enviromentProvider: enviromentProviderPtr,
|
||||
clientRequest: clientRequest,
|
||||
displayInfo: this.displayInfo_
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
@ -326,7 +323,7 @@ class MockDevice {
|
|||
supportsSession(options) {
|
||||
return Promise.resolve({
|
||||
supportsSession:
|
||||
!options.exclusive || this.displayInfo_.capabilities.canPresent
|
||||
!options.immersive || this.displayInfo_.capabilities.canPresent
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue