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

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

Issue 2642873002: Moves mojo.define -> gin.define. (Closed)
Patch Set: rebaseline Created 3 years, 11 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 description("Tests that the PositionOptions.maximumAge parameter is correctly ap plied."); 1 description("Tests that the PositionOptions.maximumAge parameter is correctly ap plied.");
2 2
3 var mockLatitude = 51.478; 3 var mockLatitude = 51.478;
4 var mockLongitude = -0.166; 4 var mockLongitude = -0.166;
5 var mockAccuracy = 100.0; 5 var mockAccuracy = 100.0;
6 6
7 var mockMessage = 'test'; 7 var mockMessage = 'test';
8 8
9 var position; 9 var position;
10 var error; 10 var error;
11 11
12 function checkPosition(p) { 12 function checkPosition(p) {
13 debug(''); 13 debug('');
14 position = p; 14 position = p;
15 shouldBe('position.coords.latitude', 'mockLatitude'); 15 shouldBe('position.coords.latitude', 'mockLatitude');
16 shouldBe('position.coords.longitude', 'mockLongitude'); 16 shouldBe('position.coords.longitude', 'mockLongitude');
17 shouldBe('position.coords.accuracy', 'mockAccuracy'); 17 shouldBe('position.coords.accuracy', 'mockAccuracy');
18 } 18 }
19 19
20 function checkError(e) { 20 function checkError(e) {
21 debug(''); 21 debug('');
22 error = e; 22 error = e;
23 shouldBe('error.code', 'error.POSITION_UNAVAILABLE'); 23 shouldBe('error.code', 'error.POSITION_UNAVAILABLE');
24 shouldBe('error.message', 'mockMessage'); 24 shouldBe('error.message', 'mockMessage');
25 } 25 }
26 26
27 if (!window.testRunner || !window.mojo)
28 debug('This test can not run without testRunner or mojo');
29
30 geolocationServiceMock.then(mock => { 27 geolocationServiceMock.then(mock => {
31 mock.setGeolocationPermission(true); 28 mock.setGeolocationPermission(true);
32 mock.setGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy); 29 mock.setGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy);
33 30
34 // Initialize the cached Position 31 // Initialize the cached Position
35 navigator.geolocation.getCurrentPosition(function(p) { 32 navigator.geolocation.getCurrentPosition(function(p) {
36 checkPosition(p); 33 checkPosition(p);
37 testZeroMaximumAge(); 34 testZeroMaximumAge();
38 }, function(e) { 35 }, function(e) {
39 testFailed('Error callback invoked unexpectedly'); 36 testFailed('Error callback invoked unexpectedly');
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 testFailed('Success callback invoked unexpectedly'); 108 testFailed('Success callback invoked unexpectedly');
112 finishJSTest(); 109 finishJSTest();
113 }, function(e) { 110 }, function(e) {
114 checkError(e); 111 checkError(e);
115 finishJSTest(); 112 finishJSTest();
116 }); 113 });
117 } 114 }
118 }); 115 });
119 116
120 window.jsTestIsAsync = true; 117 window.jsTestIsAsync = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698