Skip to content

Commit

Permalink
Test Geolocation Sensor IDL
Browse files Browse the repository at this point in the history
  • Loading branch information
foolip committed Nov 15, 2017
1 parent 0e58b54 commit 2feb59d
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions geolocation-sensor/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@anssiko
30 changes: 30 additions & 0 deletions geolocation-sensor/idlharness.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<title>Geolocation Sensor IDL tests</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>
<script>
"use strict";

function doTest([generic_sensor, geolocation_sensor]) {
var idl_array = new IdlArray();
idl_array.add_untested_idls('interface EventTarget {};');
idl_array.add_idls(generic_sensor, { only: ['Sensor'] });
idl_array.add_idls(geolocation_sensor);
idl_array.add_objects({
GeolocationSensor: ['new GeolocationSensor'],
});
idl_array.test();
}

function fetchText(url) {
return fetch(url).then((response) => response.text());
}

promise_test(() => {
return Promise.all(["/interfaces/generic-sensor.idl",
"/interfaces/geolocation-sensor.idl"].map(fetchText))
.then(doTest);
}, "Test driver");
</script>
10 changes: 10 additions & 0 deletions interfaces/geolocation-sensor.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Constructor(optional SensorOptions options), Exposed=Window]
interface GeolocationSensor : Sensor {
readonly attribute unrestricted double? latitude;
readonly attribute unrestricted double? longitude;
readonly attribute unrestricted double? altitude;
readonly attribute unrestricted double? accuracy;
readonly attribute unrestricted double? altitudeAccuracy;
readonly attribute unrestricted double? heading;
readonly attribute unrestricted double? speed;
};

0 comments on commit 2feb59d

Please sign in to comment.