forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathidlharness.https.window.js
More file actions
28 lines (24 loc) · 981 Bytes
/
idlharness.https.window.js
File metadata and controls
28 lines (24 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// https://www.w3.org/TR/geolocation-API/
window.onload = async () => {
await test_driver.set_permission({ name: "geolocation" }, "denied");
const positionError = await new Promise((resolve, reject) => {
navigator.geolocation.getCurrentPosition(reject, resolve);
});
await test_driver.set_permission({ name: "geolocation" }, "granted");
const position = await new Promise((resolve, reject) => {
navigator.geolocation.getCurrentPosition(resolve, reject);
});
idl_test(["geolocation"], ["hr-time", "html"], (idl_array) => {
idl_array.add_objects({
Navigator: ["navigator"],
Geolocation: ["navigator.geolocation"],
GeolocationPositionError: [positionError],
GeolocationPosition: [position],
GeolocationCoordinates: [position.coords],
});
});
};