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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/multiple-requests.js

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 10 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
(Empty)
1 description("Tests that Geolocation correctly handles multiple concurrent reques ts.");
2
3 var mockLatitude = 51.478;
4 var mockLongitude = -0.166;
5 var mockAccuracy = 100;
6
7 var position;
8 var watchCallbackInvoked = false;
9 var oneShotCallbackInvoked = false;
10
11 geolocationServiceMock.then(mock => {
12 mock.setGeolocationPermission(true);
13 mock.setGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy);
14
15 navigator.geolocation.watchPosition(function(p) {
16 shouldBeFalse('watchCallbackInvoked');
17 watchCallbackInvoked = true;
18 maybeFinishTest(p);
19 }, function() {
20 testFailed('Error callback invoked unexpectedly');
21 finishJSTest();
22 });
23
24 navigator.geolocation.getCurrentPosition(function(p) {
25 shouldBeFalse('oneShotCallbackInvoked');
26 oneShotCallbackInvoked = true;
27 maybeFinishTest(p);
28 }, function() {
29 testFailed('Error callback invoked unexpectedly');
30 finishJSTest();
31 });
32
33 function maybeFinishTest(p) {
34 position = p;
35 shouldBe('position.coords.latitude', 'mockLatitude');
36 shouldBe('position.coords.longitude', 'mockLongitude');
37 shouldBe('position.coords.accuracy', 'mockAccuracy');
38 if (watchCallbackInvoked && oneShotCallbackInvoked)
39 finishJSTest();
40 }
41 });
42
43 window.jsTestIsAsync = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698