Skip to content

Commit

Permalink
Fix some issues in geolocation-sensor(web-platform-tests#8403)
Browse files Browse the repository at this point in the history
* Add GeolocationSensor constant declaration in generic-sensor-tests.js and add untest idl 'EventHandler'
  • Loading branch information
xiuqijix authored and Honry committed Nov 23, 2017
1 parent 0ae7760 commit 1b13727
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
4 changes: 3 additions & 1 deletion generic-sensor/generic-sensor-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ const properties = {
'Gyroscope' : ['timestamp', 'x', 'y', 'z'],
'Magnetometer' : ['timestamp', 'x', 'y', 'z'],
'AbsoluteOrientationSensor' : ['timestamp', 'quaternion'],
'RelativeOrientationSensor' : ['timestamp', 'quaternion']
'RelativeOrientationSensor' : ['timestamp', 'quaternion'],
'GeolocationSensor' : ['timestamp', 'latitude', 'longitude', 'altitude',
'accuracy', 'altitudeAccuracy', 'heading', 'speed']
};

function assert_reading_not_null(sensor) {
Expand Down
23 changes: 14 additions & 9 deletions geolocation-sensor/idlharness.https.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
<!DOCTYPE html>
<meta charset="utf-8">
<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>
<link rel="help" href="https://wicg.github.io/geolocation-sensor/">
<link rel="help" href="https://w3c.github.io/sensors/">
<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();
const idl_array = new IdlArray();
idl_array.add_untested_idls('interface EventTarget {};');
idl_array.add_untested_idls('interface EventHandler {};');
idl_array.add_idls(generic_sensor, { only: ['Sensor'] });
idl_array.add_idls(geolocation_sensor);
idl_array.add_objects({
Expand All @@ -23,8 +27,9 @@
}

promise_test(() => {
return Promise.all(["/interfaces/generic-sensor.idl",
"/interfaces/geolocation-sensor.idl"].map(fetchText))
.then(doTest);
}, "Test driver");
return Promise.all([
"/interfaces/generic-sensor.idl",
"/interfaces/geolocation-sensor.idl"
].map(fetchText)).then(doTest);
}, "Test IDL implementation of Geolocation Sensor");
</script>
2 changes: 1 addition & 1 deletion interfaces/geolocation-sensor.idl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[Constructor(optional SensorOptions options), Exposed=Window]
[Constructor(optional SensorOptions options), SecureContext, Exposed=Window]
interface GeolocationSensor : Sensor {
readonly attribute unrestricted double? latitude;
readonly attribute unrestricted double? longitude;
Expand Down

0 comments on commit 1b13727

Please sign in to comment.