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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/reentrant-success.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 reentrant calls to Geolocation methods from the success callback are OK.");
2
3 var mockLatitude = 51.478;
4 var mockLongitude = -0.166;
5 var mockAccuracy = 100.0;
6
7 var position;
8
9 geolocationServiceMock.then(mock => {
10 mock.setGeolocationPermission(true);
11 mock.setGeolocationPosition(mockLatitude,
12 mockLongitude,
13 mockAccuracy);
14
15 var successCallbackInvoked = false;
16 navigator.geolocation.getCurrentPosition(function(p) {
17 if (successCallbackInvoked) {
18 testFailed('Success callback invoked unexpectedly');
19 finishJSTest();
20 }
21 successCallbackInvoked = true;
22
23 position = p;
24 shouldBe('position.coords.latitude', 'mockLatitude');
25 shouldBe('position.coords.longitude', 'mockLongitude');
26 shouldBe('position.coords.accuracy', 'mockAccuracy');
27 debug('');
28 continueTest();
29 }, function(e) {
30 testFailed('Error callback invoked unexpectedly');
31 finishJSTest();
32 });
33
34 function continueTest() {
35 mock.setGeolocationPosition(++mockLatitude,
36 ++mockLongitude,
37 ++mockAccuracy);
38
39 navigator.geolocation.getCurrentPosition(function(p) {
40 position = p;
41 shouldBe('position.coords.latitude', 'mockLatitude');
42 shouldBe('position.coords.longitude', 'mockLongitude');
43 shouldBe('position.coords.accuracy', 'mockAccuracy');
44 finishJSTest();
45 }, function(e) {
46 testFailed('Error callback invoked unexpectedly');
47 finishJSTest();
48 });
49 }
50 });
51
52 window.jsTestIsAsync = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698