mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-09 12:51:09 +02:00
Backed out changeset 7baa72e0d62c (bug 1637486) Backed out changeset 24e38d0cf349 (bug 1635702) Backed out changeset a99469886218 (bug 1635702) Backed out changeset 0bd06c295951 (bug 1637211) Backed out changeset 893f40e8ac70 (bug 1637211) Backed out changeset 7e4449460eee (bug 1636952) Backed out changeset abc7724f7d24 (bug |
||
|---|---|---|
| .. | ||
| resources | ||
| generic-sensor-feature-policy-test.sub.js | ||
| generic-sensor-iframe-tests.sub.js | ||
| generic-sensor-permission.https.html | ||
| generic-sensor-tests.js | ||
| idlharness.https.window.js | ||
| META.yml | ||
| README.md | ||
| SensorErrorEvent-constructor.https.html | ||
The resources/generic-sensor-helpers.js tests require an implementation of
the GenericSensorTest interface, which should emulate platform
sensor backends. The GenericSensorTest interface is defined as:
class MockSensor {
// Sets fake data that is used to deliver sensor reading updates.
async setSensorReading(FrozenArray<double> readingData);
setStartShouldFail(boolean shouldFail); // Sets flag that forces sensor to fail.
getSamplingFrequency(); // Return the sampling frequency.
};
class MockSensorProvider {
// Sets flag that forces mock SensorProvider to fail when getSensor() is
// invoked.
setGetSensorShouldFail(DOMString sensorType, boolean shouldFail);
// Sets flag that forces mock SensorProvider to permissions denied when
// getSensor() is invoked.
setPermissionsDenied(DOMString sensorType, boolean permissionsDenied);
getCreatedSensor(DOMString sensorType); // Return `MockSensor` interface.
setMaximumSupportedFrequency(double frequency); // Sets the maximum frequency.
setMinimumSupportedFrequency(double frequency); // Sets the minimum frequency.
}
class GenericSensorTest {
initialize(); // Sets up the testing environment.
async reset(); // Frees the resources.
getSensorProvider(); // Returns `MockSensorProvider` interface.
};
The Chromium implementation of the GenericSensorTest interface is located in
generic_sensor_mocks.js.
Other browser vendors should provide their own implementations of
the GenericSensorTest interface.
Known issue: a WebDriver extension is a better approach for the Generic Sensor tests automation.