forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwatchPosition_TypeError.https.html
More file actions
65 lines (57 loc) · 2.24 KB
/
watchPosition_TypeError.https.html
File metadata and controls
65 lines (57 loc) · 2.24 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Geolocation Test: watchPosition TypeError tests</title>
<link rel="help" href="http://www.w3.org/TR/geolocation-API/" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00058
test(() => {
assert_throws_js(TypeError, () => {
navigator.geolocation.watchPosition();
});
}, "Call watchPosition without arguments, check that exception is thrown");
// Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00015
test(() => {
assert_throws_js(TypeError, () => {
navigator.geolocation.watchPosition(null);
});
}, "Call watchPosition with null success callback, check that exception is thrown");
// Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00017
test(() => {
assert_throws_js(TypeError, () => {
navigator.geolocation.watchPosition(null, null);
});
}, "Call watchPosition with null success and error callbacks, check that exception is thrown");
// Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00059
test(() => {
assert_throws_js(TypeError, () => {
navigator.geolocation.watchPosition(3);
});
}, "Call watchPosition() with wrong type for first argument. Exception expected.");
// Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00060
test(() => {
assert_throws_js(TypeError, () => {
navigator.geolocation.watchPosition(() => {}, 4);
});
}, "Call watchPosition() with wrong type for second argument. Exception expected.");
// Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00061
test(() => {
assert_throws_js(TypeError, () => {
navigator.geolocation.watchPosition(
() => {},
() => {},
4
);
});
}, "Call watchPosition() with wrong type for third argument. Exception expected.");
test(function () {
const handleEvent = function(){};
assert_throws_js(TypeError, function () {
navigator.geolocation.watchPosition({ handleEvent });
});
assert_throws_js(TypeError, function () {
navigator.geolocation.watchPosition(()=>{}, { handleEvent });
});
}, "Calling watchPosition() with a legacy event handler object.");
</script>