Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/powerfulFeatureRestrictions/old-powerful-features-on-insecure-origin.html

Issue 1485973002: Removal of geolocation APIs on insecure origins (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Fix WebView tests Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 window.addEventListener('devicemotion', this.step_func_done());
63 window.addEventListener('devicemotion', this.step_func(function() {
64 this.done();
65 }));
66 }, 'device motion'); 38 }, 'device motion');
67 39
68 async_test(function() { 40 async_test(function() {
69 testRunner.setMockDeviceOrientation(11.1, 22.2, 33.3, true); 41 testRunner.setMockDeviceOrientation(11.1, 22.2, 33.3, true);
70 42 window.addEventListener('deviceorientation', this.step_func_done());
71 window.addEventListener('deviceorientation', this.step_func(function() {
72 this.done();
73 }));
74 }, 'device orientation'); 43 }, 'device orientation');
75 44
76 promise_test(function(test) { 45 promise_test(function(test) {
77 return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]); 46 return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
78 }, 'requestMediaKeySystemAccess'); 47 }, 'requestMediaKeySystemAccess');
79 48
80 // Tests for APIs that have been turned off on insecure origins 49 // Tests for APIs that have been turned off on insecure origins
81 async_test(function() { 50 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() {
82 navigator.webkitGetUserMedia({ audio: true, video: true }, 66 navigator.webkitGetUserMedia({ audio: true, video: true },
83 this.unreached_func('navigator.webkitGetUserMedia should call the er ror callback, but called the success callback instead.'), 67 this.unreached_func('navigator.webkitGetUserMedia should call the er ror callback, but called the success callback instead.'),
84 this.step_func_done()); 68 this.step_func_done());
85 }, 'navigator.webkitGetUserMedia'); 69 }, 'navigator.webkitGetUserMedia');
86 70
87 promise_test(function(test) { 71 promise_test(function(test) {
88 return navigator.mediaDevices.getUserMedia({audio: true, video: true}).t hen( 72 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."), 73 test.unreached_func("navigator.mediaDevices.getUserMedia should reje ct the promise, but resolved instead."),
90 function(error) { 74 function(error) {
91 assert_equals(error.name, "NotSupportedError"); 75 assert_equals(error.name, "NotSupportedError");
92 assert_equals(error.message, "Only secure origins are allowed (s ee: https://goo.gl/Y0ZkNV)."); 76 assert_equals(error.message, "Only secure origins are allowed (s ee: https://goo.gl/Y0ZkNV).");
93 }); 77 });
94 }, 'navigator.mediaDevices.getUserMedia'); 78 }, 'navigator.mediaDevices.getUserMedia');
95 } 79 }
96 </script> 80 </script>
97 </body> 81 </body>
98 </html> 82 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698