Update web-platform-tests to revision 33c263fb308d1c3f6ac6d2590d7292317262819d

This commit is contained in:
WPT Sync Bot 2019-08-23 10:24:44 +00:00
parent 5bf00c07c2
commit 482fda3a78
524 changed files with 14686 additions and 3270 deletions

View file

@ -116,7 +116,6 @@ class MockVRService {
if (index >= 0) {
this.runtimes_.splice(index, 1);
if (this.client_) {
console.error("Notifying client");
this.client_.onDeviceChanged();
}
}
@ -153,7 +152,7 @@ class MockVRService {
// If there were no successful results, returns a null session.
return {
result: {
failureReason : device.mojom.RequestSessionResult.NO_RUNTIME_FOUND,
failureReason : device.mojom.RequestSessionError.NO_RUNTIME_FOUND,
$tag : 1
}
};
@ -224,6 +223,9 @@ class MockRuntime {
this.setBoundsGeometry(fakeDeviceInit.boundsCoordinates);
this.setViews(fakeDeviceInit.views);
// Need to support webVR which doesn't have a notion of features
this.setFeatures(fakeDeviceInit.supportedFeatures || []);
}
// Test API methods.
@ -421,6 +423,34 @@ class MockRuntime {
};
}
setFeatures(supportedFeatures) {
function convertFeatureToMojom(feature) {
switch (feature) {
case "viewer":
return device.mojom.XRSessionFeature.REF_SPACE_VIEWER;
case "local":
return device.mojom.XRSessionFeature.REF_SPACE_LOCAL;
case "local-floor":
return device.mojom.XRSessionFeature.REF_SPACE_LOCAL_FLOOR;
case "bounded-floor":
return device.mojom.XRSessionFeature.REF_SPACE_BOUNDED_FLOOR;
case "unbounded":
return device.mojom.XRSessionFeature.REF_SPACE_UNBOUNDED;
default:
return device.mojom.XRSessionFeature.INVALID;
}
}
this.supportedFeatures_ = [];
for (let i = 0; i < supportedFeatures.length; i++) {
let feature = convertFeatureToMojom(supportedFeatures[i]);
if (feature !== device.mojom.XRSessionFeature.INVALID) {
this.supportedFeatures_.push(feature);
}
}
}
// These methods are intended to be used by MockXRInputSource only.
addInputSource(source) {
let index = this.input_sources_.indexOf(source);
@ -525,12 +555,28 @@ class MockRuntime {
let clientRequest = mojo.makeRequest(this.sessionClient_);
let enabled_features = [];
for(let i = 0; i < sessionOptions.requiredFeatures.length; i++) {
if (this.supportedFeatures_.indexOf(sessionOptions.requiredFeatures[i]) !== -1) {
enabled_features.push(sessionOptions.requiredFeatures[i]);
} else {
return Promise.resolve({session: null});
}
}
for (let i =0; i < sessionOptions.optionalFeatures.length; i++) {
if (this.supportedFeatures_.indexOf(sessionOptions.optionalFeatures[i]) !== -1) {
enabled_features.push(sessionOptions.optionalFeatures[i]);
}
}
return Promise.resolve({
session: {
submitFrameSink: submit_frame_sink,
dataProvider: dataProviderPtr,
clientRequest: clientRequest,
displayInfo: this.displayInfo_
displayInfo: this.displayInfo_,
enabledFeatures: enabled_features,
}
});
} else {