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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/powerfulFeatureRestrictions/resources/geolocation.html

Issue 1948033003: Convert most geolocation layout tests to use a JS mock implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission-disconnect
Patch Set: Created 4 years, 7 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Geolocation On A Secure Origin</title> 2 <title>Geolocation On A Secure Origin</title>
3 <script src="/js-test-resources/mojo-helpers.js"></script>
4 <script src="/fast/dom/Geolocation/js-test-resources/geolocation-mock.js"></scri pt>
3 <script> 5 <script>
4 var mockLatitude = 51.478; 6 var mockLatitude = 51.478;
5 var mockLongitude = -0.166; 7 var mockLongitude = -0.166;
6 var mockAccuracy = 100.0; 8 var mockAccuracy = 100.0;
7 9
8 if (!window.internals) 10 if (!window.mojo)
9 console.error('This test can not run without internals'); 11 console.error('This test can not run without mojo');
10 12
11 internals.setGeolocationClientMock(document); 13 geolocationServiceMock.then(mock => {
12 internals.setGeolocationPermission(document, true); 14 mock.setGeolocationPermission(true);
13 internals.setGeolocationPosition(document, 15 mock.setGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy);
14 mockLatitude,
15 mockLongitude,
16 mockAccuracy);
17 16
18 navigator.geolocation.getCurrentPosition( 17 navigator.geolocation.getCurrentPosition(
19 function () { 18 function () {
20 window.parent.postMessage({ success: true }, "*"); 19 window.parent.postMessage({ success: true }, "*");
21 }, 20 },
22 function (error) { 21 function (error) {
23 window.parent.postMessage({ message: error.message }, "*"); 22 window.parent.postMessage({ message: error.message }, "*");
24 }, { maximumAge: 10000 }); 23 }, { maximumAge: 10000 });
24 });
25 </script> 25 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698