servo/tests/wpt/web-platform-tests/generic-sensor
2023-05-14 01:39:34 +00:00
..
resources Update web-platform-tests to revision b'bcf4a27c0a9dbb07d974a880acb26eb289a85c7e' 2023-02-17 01:52:51 +00:00
generic-sensor-feature-policy-test.sub.js Update web-platform-tests to revision fbe1d224ce01b0844030db54a3cc6060c6d6c17a 2020-09-24 10:34:25 +00:00
generic-sensor-iframe-tests.sub.js Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005' 2022-11-10 01:27:28 +00:00
generic-sensor-permission.https.html Update web-platform-tests to revision b'4a4653e088039aec186d6dc1d488120d77695c3a' 2022-12-11 01:19:52 +00:00
generic-sensor-tests.js Update web-platform-tests to revision b'c9946198c9ee19db3b4974a388fae45da844a94a' 2023-05-14 01:39:34 +00:00
idlharness.https.window.js Update web-platform-tests to revision b'ee6da9d71d0268d7fdb04e8e5b26858f46ee0cc4' 2022-01-20 20:57:54 +09:00
META.yml Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005' 2022-11-10 01:27:28 +00:00
README.md Update web-platform-tests to revision a3a4442b04c37155f81c4ad4ae9c06339f76ce14 2019-09-19 13:22:29 +00:00
SensorErrorEvent-constructor.https.html Update web-platform-tests to revision 7ec633bbfbc01de4972e65f81f593983d9cdc17d 2020-01-23 10:58:08 +00:00

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.