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() { |
33 testRunner.setMockDeviceMotion(true, 0, true, 0, true, 0, | 58 testRunner.setMockDeviceMotion(true, 0, true, 0, true, 0, |
34 true, 0, true, 0, true, 0, | 59 true, 0, true, 0, true, 0, |
35 true, 0, true, 0, true, 0, | 60 true, 0, true, 0, true, 0, |
36 0); | 61 0); |
37 window.addEventListener('devicemotion', this.step_func_done()); | 62 |
| 63 window.addEventListener('devicemotion', this.step_func(function() { |
| 64 this.done(); |
| 65 })); |
38 }, 'device motion'); | 66 }, 'device motion'); |
39 | 67 |
40 async_test(function() { | 68 async_test(function() { |
41 testRunner.setMockDeviceOrientation(11.1, 22.2, 33.3, true); | 69 testRunner.setMockDeviceOrientation(11.1, 22.2, 33.3, true); |
42 window.addEventListener('deviceorientation', this.step_func_done()); | 70 |
| 71 window.addEventListener('deviceorientation', this.step_func(function() { |
| 72 this.done(); |
| 73 })); |
43 }, 'device orientation'); | 74 }, 'device orientation'); |
44 | 75 |
45 promise_test(function(test) { | 76 promise_test(function(test) { |
46 return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]); | 77 return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]); |
47 }, 'requestMediaKeySystemAccess'); | 78 }, 'requestMediaKeySystemAccess'); |
48 | 79 |
49 // Tests for APIs that have been turned off on insecure origins | 80 // Tests for APIs that have been turned off on insecure origins |
50 async_test(function() { | 81 async_test(function() { |
51 navigator.geolocation.getCurrentPosition( | |
52 this.unreached_func('getCurrentPosition should fail, but succeeded.'
), | |
53 this.step_func_done()); | |
54 }, 'getCurrentPosition'); | |
55 | |
56 // Note that the deprecation message for watchPosition() will be supressed | |
57 // because it is an exact duplicate of the getCurrentPosition() message. | |
58 // Thus, this test is really to confirm that it still executes (and fails). | |
59 async_test(function() { | |
60 navigator.geolocation.watchPosition( | |
61 this.unreached_func('watchPosition should fail, but succeeded.'), | |
62 this.step_func_done()); | |
63 }, 'watchPosition'); | |
64 | |
65 async_test(function() { | |
66 navigator.webkitGetUserMedia({ audio: true, video: true }, | 82 navigator.webkitGetUserMedia({ audio: true, video: true }, |
67 this.unreached_func('navigator.webkitGetUserMedia should call the er
ror callback, but called the success callback instead.'), | 83 this.unreached_func('navigator.webkitGetUserMedia should call the er
ror callback, but called the success callback instead.'), |
68 this.step_func_done()); | 84 this.step_func_done()); |
69 }, 'navigator.webkitGetUserMedia'); | 85 }, 'navigator.webkitGetUserMedia'); |
70 | 86 |
71 promise_test(function(test) { | 87 promise_test(function(test) { |
72 return navigator.mediaDevices.getUserMedia({audio: true, video: true}).t
hen( | 88 return navigator.mediaDevices.getUserMedia({audio: true, video: true}).t
hen( |
73 test.unreached_func("navigator.mediaDevices.getUserMedia should reje
ct the promise, but resolved instead."), | 89 test.unreached_func("navigator.mediaDevices.getUserMedia should reje
ct the promise, but resolved instead."), |
74 function(error) { | 90 function(error) { |
75 assert_equals(error.name, "NotSupportedError"); | 91 assert_equals(error.name, "NotSupportedError"); |
76 assert_equals(error.message, "Only secure origins are allowed (s
ee: https://goo.gl/Y0ZkNV)."); | 92 assert_equals(error.message, "Only secure origins are allowed (s
ee: https://goo.gl/Y0ZkNV)."); |
77 }); | 93 }); |
78 }, 'navigator.mediaDevices.getUserMedia'); | 94 }, 'navigator.mediaDevices.getUserMedia'); |
79 } | 95 } |
80 </script> | 96 </script> |
81 </body> | 97 </body> |
82 </html> | 98 </html> |
OLD | NEW |