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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/Geolocation/watchPosition-unique.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 PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 <script src="../../../resources/mojo-helpers.js"></script>
6 <script src="resources/geolocation-mock.js"></script>
5 </head> 7 </head>
6 <body> 8 <body>
7 <script> 9 <script>
8 10
9 description("Tests that navigator.geolocation.watchPosition returns unique resul ts within its script execution context."); 11 description("Tests that navigator.geolocation.watchPosition returns unique resul ts within its script execution context.");
10 12
11 if (!window.testRunner || !window.internals) 13 if (!window.testRunner || !window.mojo)
12 debug('This test can not run without testRunner or internals'); 14 debug('This test can not run without testRunner or mojo');
13 15
14 internals.setGeolocationClientMock(document); 16 var watchID1;
15 internals.setGeolocationPosition(document, 51.478, -0.166, 100.0); 17 var watchID2;
18 var watchID3;
16 19
17 var watchID1 = navigator.geolocation.watchPosition(function() { }); 20 geolocationServiceMock.then(mock => {
18 var watchID2 = navigator.geolocation.watchPosition(function() { }); 21 mock.setGeolocationPosition(51.478, -0.166, 100.0);
19 var watchID3 = navigator.geolocation.watchPosition(function() { });
20 22
21 shouldBeTrue("watchID1 > 0"); 23 watchID1 = navigator.geolocation.watchPosition(function() { });
22 shouldBeTrue("watchID2 > 0"); 24 watchID2 = navigator.geolocation.watchPosition(function() { });
23 shouldBeTrue("watchID3 > 0"); 25 watchID3 = navigator.geolocation.watchPosition(function() { });
24 shouldBeTrue("watchID1 !== watchID2");
25 shouldBeTrue("watchID1 !== watchID3");
26 shouldBeTrue("watchID2 !== watchID3");
27 26
27 shouldBeTrue("watchID1 > 0");
28 shouldBeTrue("watchID2 > 0");
29 shouldBeTrue("watchID3 > 0");
30 shouldBeTrue("watchID1 !== watchID2");
31 shouldBeTrue("watchID1 !== watchID3");
32 shouldBeTrue("watchID2 !== watchID3");
33 finishJSTest();
34 });
35
36 window.jsTestIsAsync = true;
28 </script> 37 </script>
29 </body> 38 </body>
30 </html> 39 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698