|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=452566 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 452566</title> |
|
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <script type="text/javascript" src="geolocation_common.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
11 </head> |
|
12 <body> |
|
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=452566">Mozilla Bug 452566</a> |
|
14 <p id="display"></p> |
|
15 <div id="content" style="display: none"> |
|
16 |
|
17 </div> |
|
18 <pre id="test"> |
|
19 <script class="testbody" type="text/javascript"> |
|
20 |
|
21 SimpleTest.waitForExplicitFinish(); |
|
22 |
|
23 // ensure we are using the right testing provider |
|
24 resume_geolocationProvider(function() { |
|
25 force_prompt(true, test1); |
|
26 }); |
|
27 |
|
28 /** Test for Bug 452566 **/ |
|
29 function test1() { |
|
30 ok(navigator.geolocation, "Should have geolocation"); |
|
31 |
|
32 var exception = null; |
|
33 try { |
|
34 navigator.geolocation.getCurrentPosition(); |
|
35 } catch(ex if ex instanceof TypeError) { |
|
36 exception = ex; |
|
37 } |
|
38 ok(exception, "Should have got an exception"); |
|
39 |
|
40 exception = null; |
|
41 try { |
|
42 navigator.geolocation.getCurrentPosition(function() {}); |
|
43 } catch(ex if ex instanceof TypeError) { |
|
44 exception = ex; |
|
45 } |
|
46 ok(!exception, exception); |
|
47 |
|
48 exception = null; |
|
49 try { |
|
50 navigator.geolocation.getCurrentPosition(function() {}, function() {}); |
|
51 } catch(ex if ex instanceof TypeError) { |
|
52 exception = ex; |
|
53 } |
|
54 ok(!exception, exception); |
|
55 |
|
56 exception = null; |
|
57 try { |
|
58 navigator.geolocation.getCurrentPosition(function() {}, function() {}, {}); |
|
59 } catch(ex if ex instanceof TypeError) { |
|
60 exception = ex; |
|
61 } |
|
62 ok(!exception, exception); |
|
63 |
|
64 exception = null; |
|
65 try { |
|
66 navigator.geolocation.watchPosition(); |
|
67 } catch(ex if ex instanceof TypeError) { |
|
68 exception = ex; |
|
69 } |
|
70 ok(exception, "Should have got an exception"); |
|
71 |
|
72 exception = null; |
|
73 try { |
|
74 navigator.geolocation.watchPosition(function() {}); |
|
75 } catch(ex if ex instanceof TypeError) { |
|
76 exception = ex; |
|
77 } |
|
78 ok(!exception, exception); |
|
79 |
|
80 exception = null; |
|
81 try { |
|
82 navigator.geolocation.watchPosition(function() {}, function() {}); |
|
83 } catch(ex if ex instanceof TypeError) { |
|
84 exception = ex; |
|
85 } |
|
86 ok(!exception, exception); |
|
87 |
|
88 exception = null; |
|
89 try { |
|
90 navigator.geolocation.watchPosition(function() {}, function() {}, {}); |
|
91 } catch(ex if ex instanceof TypeError) { |
|
92 exception = ex; |
|
93 } |
|
94 ok(!exception, exception); |
|
95 |
|
96 SimpleTest.finish(); |
|
97 } |
|
98 |
|
99 </script> |
|
100 </pre> |
|
101 </body> |
|
102 </html> |