OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Old Powerful Features on an Insecure Origin</title> | 4 <title>Old Powerful Features on an Insecure Origin</title> |
5 </head> | 5 </head> |
6 <script src="/resources/testharness.js"></script> | 6 <script src="/resources/testharness.js"></script> |
7 <script src="/resources/testharnessreport.js"></script> | 7 <script src="/resources/testharnessreport.js"></script> |
8 <script src="/resources/get-host-info.js"></script> | 8 <script src="/resources/get-host-info.js"></script> |
9 | 9 |
10 <body> | 10 <body> |
(...skipping 12 matching lines...) Expand all Loading... | |
23 internals.setGeolocationClientMock(document); | 23 internals.setGeolocationClientMock(document); |
24 internals.setGeolocationPermission(document, true); | 24 internals.setGeolocationPermission(document, true); |
25 internals.setGeolocationPosition(document, | 25 internals.setGeolocationPosition(document, |
26 mockLatitude, | 26 mockLatitude, |
27 mockLongitude, | 27 mockLongitude, |
28 mockAccuracy); | 28 mockAccuracy); |
29 | 29 |
30 // Tests for APIs that are deprecated, but still allowed, on | 30 // Tests for APIs that are deprecated, but still allowed, on |
31 // insecure origins | 31 // insecure origins |
32 async_test(function() { | 32 async_test(function() { |
33 navigator.geolocation.getCurrentPosition( | |
34 this.step_func(function() { | |
35 this.done(); | |
36 }), | |
37 this.step_func(function(error) { | |
38 assert_unreached('getCurrentPosition should succeed, but failed. '); | |
39 this.done(); | |
40 })); | |
41 }, 'getCurrentPosition'); | |
42 | |
43 // Note that the deprecation message for watchPosition() will be supressed | |
44 // because it is an exact duplicate of the getCurrentPosition() message. | |
45 // Thus, this test is really to confirm that it still executes. | |
46 async_test(function() { | |
47 navigator.geolocation.watchPosition( | |
48 this.step_func(function() { | |
49 this.done(); | |
50 }), | |
51 this.step_func(function(error) { | |
52 assert_unreached('watchPosition should succeed, but failed.'); | |
53 this.done(); | |
54 })); | |
55 }, 'watchPosition'); | |
56 | |
57 async_test(function() { | |
58 testRunner.setMockDeviceMotion(true, 0, true, 0, true, 0, | 33 testRunner.setMockDeviceMotion(true, 0, true, 0, true, 0, |
59 true, 0, true, 0, true, 0, | 34 true, 0, true, 0, true, 0, |
60 true, 0, true, 0, true, 0, | 35 true, 0, true, 0, true, 0, |
61 0); | 36 0); |
62 | 37 |
63 window.addEventListener('devicemotion', this.step_func(function() { | 38 window.addEventListener('devicemotion', this.step_func(function() { |
64 this.done(); | 39 this.done(); |
65 })); | 40 })); |
66 }, 'device motion'); | 41 }, 'device motion'); |
67 | 42 |
68 async_test(function() { | 43 async_test(function() { |
69 testRunner.setMockDeviceOrientation(11.1, 22.2, 33.3, true); | 44 testRunner.setMockDeviceOrientation(11.1, 22.2, 33.3, true); |
70 | 45 |
71 window.addEventListener('deviceorientation', this.step_func(function() { | 46 window.addEventListener('deviceorientation', this.step_func(function() { |
72 this.done(); | 47 this.done(); |
73 })); | 48 })); |
74 }, 'device orientation'); | 49 }, 'device orientation'); |
75 | 50 |
76 promise_test(function(test) { | 51 promise_test(function(test) { |
77 return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]); | 52 return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]); |
78 }, 'requestMediaKeySystemAccess'); | 53 }, 'requestMediaKeySystemAccess'); |
79 | 54 |
80 // Tests for APIs that have been turned off on insecure origins | 55 // Tests for APIs that have been turned off on insecure origins |
81 async_test(function() { | 56 async_test(function() { |
57 navigator.geolocation.getCurrentPosition( | |
58 this.step_func(function() { | |
59 assert_unreached('getCurrentPosition should fail, but succeeded. '); | |
60 this.done(); | |
philipj_slow
2015/12/01 08:45:21
This line won't be reached, because assert_unreach
jww
2015/12/01 18:31:54
Done.
| |
61 }), | |
62 this.step_func(function(error) { | |
philipj_slow
2015/12/01 08:45:21
And this could be just this.step_func_done().
jww
2015/12/01 18:31:54
Done.
| |
63 this.done(); | |
64 })); | |
65 }, 'getCurrentPosition'); | |
66 | |
67 // Note that the deprecation message for watchPosition() will be supressed | |
68 // because it is an exact duplicate of the getCurrentPosition() message. | |
69 // Thus, this test is really to confirm that it still executes (and fails). | |
70 | |
71 async_test(function() { | |
72 navigator.geolocation.watchPosition( | |
73 this.step_func(function() { | |
74 assert_unreached('watchPosition should fail, but succeeded.'); | |
75 this.done(); | |
76 }), | |
77 this.step_func(function(error) { | |
78 this.done(); | |
79 })); | |
80 }, 'watchPosition'); | |
81 | |
82 async_test(function() { | |
82 navigator.webkitGetUserMedia({ audio: true, video: true }, | 83 navigator.webkitGetUserMedia({ audio: true, video: true }, |
83 this.unreached_func('navigator.webkitGetUserMedia should call the er ror callback, but called the success callback instead.'), | 84 this.unreached_func('navigator.webkitGetUserMedia should call the er ror callback, but called the success callback instead.'), |
84 this.step_func_done()); | 85 this.step_func_done()); |
85 }, 'navigator.webkitGetUserMedia'); | 86 }, 'navigator.webkitGetUserMedia'); |
86 | 87 |
87 promise_test(function(test) { | 88 promise_test(function(test) { |
88 return navigator.mediaDevices.getUserMedia({audio: true, video: true}).t hen( | 89 return navigator.mediaDevices.getUserMedia({audio: true, video: true}).t hen( |
89 test.unreached_func("navigator.mediaDevices.getUserMedia should reje ct the promise, but resolved instead."), | 90 test.unreached_func("navigator.mediaDevices.getUserMedia should reje ct the promise, but resolved instead."), |
90 function(error) { | 91 function(error) { |
91 assert_equals(error.name, "NotSupportedError"); | 92 assert_equals(error.name, "NotSupportedError"); |
92 assert_equals(error.message, "Only secure origins are allowed (s ee: https://goo.gl/Y0ZkNV)."); | 93 assert_equals(error.message, "Only secure origins are allowed (s ee: https://goo.gl/Y0ZkNV)."); |
93 }); | 94 }); |
94 }, 'navigator.mediaDevices.getUserMedia'); | 95 }, 'navigator.mediaDevices.getUserMedia'); |
95 } | 96 } |
96 </script> | 97 </script> |
97 </body> | 98 </body> |
98 </html> | 99 </html> |
OLD | NEW |