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

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

Issue 1336633002: Revert "Removal of getUserMedia() on insecure origins" (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/2490
Patch Set: Created 5 years, 3 months 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 | Annotate | Revision Log
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>
11 <div id="target"></div> 11 <div id="target"></div>
12 <script> 12 <script>
13 if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) { 13 if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) {
14 window.location = get_host_info().UNAUTHENTICATED_ORIGIN + window.location.p athname; 14 window.location = get_host_info().UNAUTHENTICATED_ORIGIN + window.location.p athname;
15 } else { 15 } else {
16 if (!window.internals) 16 if (!window.internals)
17 assert_unreached('window.internals is required for this test'); 17 assert_unreached('window.internals is required for this test');
18 18
19 var mockLatitude = 51.478; 19 var mockLatitude = 51.478;
20 var mockLongitude = -0.166; 20 var mockLongitude = -0.166;
21 var mockAccuracy = 100.0; 21 var mockAccuracy = 100.0;
22 22
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
31 // insecure origins
32 async_test(function() { 30 async_test(function() {
33 navigator.geolocation.getCurrentPosition( 31 navigator.geolocation.getCurrentPosition(
34 this.step_func(function() { 32 this.step_func(function() {
35 this.done(); 33 this.done();
36 }), 34 }),
37 this.step_func(function(error) { 35 this.step_func(function(error) {
38 assert_unreached('getCurrentPosition should succeed, but failed. '); 36 assert_unreached('getCurrentPosition should succeed, but failed. ');
39 this.done(); 37 this.done();
40 })); 38 }));
41 }, 'getCurrentPosition'); 39 }, 'getCurrentPosition');
(...skipping 23 matching lines...) Expand all
65 })); 63 }));
66 64
67 var request = element.requestFullscreen.bind(element); 65 var request = element.requestFullscreen.bind(element);
68 document.addEventListener("click", request); 66 document.addEventListener("click", request);
69 eventSender.mouseDown(); 67 eventSender.mouseDown();
70 eventSender.mouseUp(); 68 eventSender.mouseUp();
71 document.removeEventListener("click", request); 69 document.removeEventListener("click", request);
72 }, 'fullscreen'); 70 }, 'fullscreen');
73 71
74 async_test(function() { 72 async_test(function() {
73 navigator.webkitGetUserMedia({ audio: true, video: true },
74 this.step_func(function() {
75 this.done();
76 }),
77 this.step_func(function() {
78 assert_unreached('getUserMedia should succeed, but failed.') ;
79 this.done();
80 }));
81 }, 'getUserMedia');
82
83 async_test(function() {
75 testRunner.setMockDeviceMotion(true, 0, true, 0, true, 0, 84 testRunner.setMockDeviceMotion(true, 0, true, 0, true, 0,
76 true, 0, true, 0, true, 0, 85 true, 0, true, 0, true, 0,
77 true, 0, true, 0, true, 0, 86 true, 0, true, 0, true, 0,
78 0); 87 0);
79 88
80 window.addEventListener('devicemotion', this.step_func(function() { 89 window.addEventListener('devicemotion', this.step_func(function() {
81 this.done(); 90 this.done();
82 })); 91 }));
83 }, 'device motion'); 92 }, 'device motion');
84 93
85 async_test(function() { 94 async_test(function() {
86 testRunner.setMockDeviceOrientation(11.1, 22.2, 33.3, true); 95 testRunner.setMockDeviceOrientation(11.1, 22.2, 33.3, true);
87 96
88 window.addEventListener('deviceorientation', this.step_func(function() { 97 window.addEventListener('deviceorientation', this.step_func(function() {
89 this.done(); 98 this.done();
90 })); 99 }));
91 }, 'device orientation'); 100 }, 'device orientation');
92 101
93 promise_test(function(test) { 102 promise_test(function(test) {
94 return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]); 103 return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
95 }, 'requestMediaKeySystemAccess'); 104 }, 'requestMediaKeySystemAccess');
96
97 // Tests for APIs that have been turned off on insecure origins
98 async_test(function() {
99 navigator.webkitGetUserMedia({ audio: true, video: true },
100 this.unreached_func('getUserMedia should call the error callback, bu t called the success callback instead.'),
101 this.step_func_done());
102 }, 'getUserMedia');
103 } 105 }
104 </script> 106 </script>
105 </body> 107 </body>
106 </html> 108 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698