Index: third_party/WebKit/LayoutTests/fast/dom/Geolocation/coordinates-interface-attributes.html |
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/coordinates-interface-attributes.html b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/coordinates-interface-attributes.html |
index cfda7af88308af74ce04e88c75f56e7baa1f2212..073a3748d798134038af5afd9d917b65876a0a98 100644 |
--- a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/coordinates-interface-attributes.html |
+++ b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/coordinates-interface-attributes.html |
@@ -2,20 +2,19 @@ |
<html> |
<head> |
<script src="../../../resources/js-test.js"></script> |
+<script src="../../../resources/mojo-helpers.js"></script> |
+<script src="resources/geolocation-mock.js"></script> |
</head> |
<body> |
<script> |
description("Test the attribute handling of the Coordinates interface"); |
window.jsTestIsAsync = true; |
-if (!window.testRunner || !window.internals) |
- debug('This test can not run without testRunner or internals'); |
- |
-internals.setGeolocationClientMock(document); |
-internals.setGeolocationPermission(document, true); |
+if (!window.testRunner || !window.mojo) |
+ debug('This test can not run without testRunner or mojo'); |
// Format: [Input], [Expected] |
-// Input: latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed. |
+// Input: latitude, longitude, accuracy, altitude, altitudeAccuracy, heading, speed. |
// Expected: latitude, longitude, accuracy, altitude, altitudeAccuracy, heading, speed. |
var testSet = [ |
[[1, 2, 3], [1, 2, 3, null, null, null, null]], |
@@ -28,40 +27,44 @@ var testSet = [ |
var currentTestIndex = -1; |
var globalCoordinates = null; |
-function runNextTest() |
-{ |
- ++currentTestIndex; |
- internals.setGeolocationPosition.apply(internals, [document].concat(testSet[currentTestIndex][0])); |
-} |
+geolocationServiceMock.then(mock => { |
+ mock.setGeolocationPermission(true); |
+ |
+ function runNextTest() |
+ { |
+ ++currentTestIndex; |
+ mock.setGeolocationPosition(...testSet[currentTestIndex][0]); |
+ } |
-function verifyResults() |
-{ |
- shouldBe('globalCoordinates.latitude', 'testSet[currentTestIndex][1][0]'); |
- shouldBe('globalCoordinates.longitude', 'testSet[currentTestIndex][1][1]'); |
- shouldBe('globalCoordinates.accuracy', 'testSet[currentTestIndex][1][2]'); |
- shouldBe('globalCoordinates.altitude', 'testSet[currentTestIndex][1][3]'); |
- shouldBe('globalCoordinates.altitudeAccuracy', 'testSet[currentTestIndex][1][4]'); |
- shouldBe('globalCoordinates.heading', 'testSet[currentTestIndex][1][5]'); |
- shouldBe('globalCoordinates.speed', 'testSet[currentTestIndex][1][6]'); |
- debug(''); |
-} |
+ function verifyResults() |
+ { |
+ shouldBe('globalCoordinates.latitude', 'testSet[currentTestIndex][1][0]'); |
+ shouldBe('globalCoordinates.longitude', 'testSet[currentTestIndex][1][1]'); |
+ shouldBe('globalCoordinates.accuracy', 'testSet[currentTestIndex][1][2]'); |
+ shouldBe('globalCoordinates.altitude', 'testSet[currentTestIndex][1][3]'); |
+ shouldBe('globalCoordinates.altitudeAccuracy', 'testSet[currentTestIndex][1][4]'); |
+ shouldBe('globalCoordinates.heading', 'testSet[currentTestIndex][1][5]'); |
+ shouldBe('globalCoordinates.speed', 'testSet[currentTestIndex][1][6]'); |
+ debug(''); |
+ } |
-var watchId = navigator.geolocation.watchPosition(function(position) { |
- globalCoordinates = position.coords; |
- verifyResults(); |
+ var watchId = navigator.geolocation.watchPosition(function(position) { |
+ globalCoordinates = position.coords; |
+ verifyResults(); |
- if (currentTestIndex + 1 === testSet.length) { |
+ if (currentTestIndex + 1 === testSet.length) { |
+ finishJSTest(); |
+ return; |
+ } |
+ runNextTest(); |
+ }, function(e) { |
+ debug("Error!: the error callback was called."); |
finishJSTest(); |
- return; |
- } |
+ }); |
+ |
runNextTest(); |
-}, function(e) { |
- debug("Error!: the error callback was called."); |
- finishJSTest(); |
}); |
-runNextTest(); |
- |
</script> |
</body> |
</html> |