servo/tests/wpt/web-platform-tests/generic-sensor
2019-10-15 13:26:56 +00:00
..
resources Update web-platform-tests to revision 4ab3cef83d73c2b6dd3616e0fe9165b3a6eed808 2019-09-28 13:38:48 +00:00
generic-sensor-feature-policy-test.sub.js Update web-platform-tests to revision be959408023fe02cf79abe70f6018598a7004a88 2018-06-11 23:36:57 -04:00
generic-sensor-iframe-tests.sub.js Update web-platform-tests to revision e29e596073468910d8655a8ec23262f17543e147 2018-10-03 23:02:48 -04:00
generic-sensor-tests.js Update web-platform-tests to revision 9f31d497bf87bdf5ebc3ba70b5cb9f87786f4071 2019-10-15 13:26:56 +00:00
idlharness.https.window.js Update web-platform-tests to revision c792ea26624bde49b72afce348de07ab72fb9ad7 2018-08-13 23:36:02 -04:00
META.yml Update web-platform-tests to revision 2d68590d46a990bf28a08d6384a59962d2e56bf6 2019-03-14 23:41:26 -04: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 26e8a76d7fbea0721468e791a325444ac9939a4f 2018-03-21 22:47:14 -04: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.