OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Geolocation On An Insecure Origin</title> | 2 <title>Geolocation On An Insecure Origin</title> |
3 <script src="/resources/testharness.js"></script> | 3 <script src="/resources/testharness.js"></script> |
4 <script src="/resources/testharnessreport.js"></script> | 4 <script src="/resources/testharnessreport.js"></script> |
5 <!-- FIXME: We should extract the get_host_info() bits of this file out to somew
here useful. --> | 5 <!-- FIXME: We should extract the get_host_info() bits of this file out to somew
here useful. --> |
6 <script src="/serviceworker/resources/test-helpers.js"></script> | 6 <script src="/serviceworker/resources/test-helpers.js"></script> |
7 <script> | 7 <script> |
8 if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) { | 8 if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) { |
9 window.location = get_host_info().UNAUTHENTICATED_ORIGIN + window.location.p
athname; | 9 window.location = get_host_info().UNAUTHENTICATED_ORIGIN + window.location.p
athname; |
10 } else { | 10 } else { |
11 if (window.testRunner) | 11 if (window.testRunner) |
12 testRunner.overridePreference("WebKitStrictPowerfulFeatureRestrictions",
true); | 12 testRunner.overridePreference("WebKitStrictPowerfulFeatureRestrictions",
true); |
13 | 13 |
14 async_test(function() { | 14 async_test(function() { |
15 navigator.geolocation.getCurrentPosition( | 15 navigator.geolocation.getCurrentPosition( |
16 this.step_func(function() { | 16 this.step_func(function() { |
17 assert_unreached('getCurrentPosition should fail, but succeeded.
'); | 17 assert_unreached('getCurrentPosition should fail, but succeeded.
'); |
18 this.done(); | 18 this.done(); |
19 }), | 19 }), |
20 this.step_func(function(error) { | 20 this.step_func(function(error) { |
21 assert_equals(error.message, 'Only secure origins are allowed. h
ttp://goo.gl/lq4gCo'); | 21 assert_equals(error.message, 'Only secure origins are allowed (s
ee: https://goo.gl/Y0ZkNV).'); |
22 this.done(); | 22 this.done(); |
23 })); | 23 })); |
24 }, 'getCurrentPosition'); | 24 }, 'getCurrentPosition'); |
25 | 25 |
26 async_test(function() { | 26 async_test(function() { |
27 navigator.geolocation.watchPosition( | 27 navigator.geolocation.watchPosition( |
28 this.step_func(function() { | 28 this.step_func(function() { |
29 assert_unreached('watchPosition should fail, but succeeded.'); | 29 assert_unreached('watchPosition should fail, but succeeded.'); |
30 this.done(); | 30 this.done(); |
31 }), | 31 }), |
32 this.step_func(function(error) { | 32 this.step_func(function(error) { |
33 assert_equals(error.message, 'Only secure origins are allowed. h
ttp://goo.gl/lq4gCo'); | 33 assert_equals(error.message, 'Only secure origins are allowed (s
ee: https://goo.gl/Y0ZkNV).'); |
34 this.done(); | 34 this.done(); |
35 })); | 35 })); |
36 }, 'watchPosition'); | 36 }, 'watchPosition'); |
37 } | 37 } |
38 </script> | 38 </script> |
OLD | NEW |