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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/dom/Geolocation/watchPosition-unique.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/watchPosition-unique.html b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/watchPosition-unique.html
index 3d98033c48e35f180dab4e5ece7110bce2d4e606..ed31f26d9037add1068749927987687bb5230ad2 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/watchPosition-unique.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/watchPosition-unique.html
@@ -2,29 +2,38 @@
<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("Tests that navigator.geolocation.watchPosition returns unique results within its script execution context.");
-if (!window.testRunner || !window.internals)
- debug('This test can not run without testRunner or internals');
+if (!window.testRunner || !window.mojo)
+ debug('This test can not run without testRunner or mojo');
-internals.setGeolocationClientMock(document);
-internals.setGeolocationPosition(document, 51.478, -0.166, 100.0);
+var watchID1;
+var watchID2;
+var watchID3;
-var watchID1 = navigator.geolocation.watchPosition(function() { });
-var watchID2 = navigator.geolocation.watchPosition(function() { });
-var watchID3 = navigator.geolocation.watchPosition(function() { });
+geolocationServiceMock.then(mock => {
+ mock.setGeolocationPosition(51.478, -0.166, 100.0);
-shouldBeTrue("watchID1 > 0");
-shouldBeTrue("watchID2 > 0");
-shouldBeTrue("watchID3 > 0");
-shouldBeTrue("watchID1 !== watchID2");
-shouldBeTrue("watchID1 !== watchID3");
-shouldBeTrue("watchID2 !== watchID3");
+ watchID1 = navigator.geolocation.watchPosition(function() { });
+ watchID2 = navigator.geolocation.watchPosition(function() { });
+ watchID3 = navigator.geolocation.watchPosition(function() { });
+ shouldBeTrue("watchID1 > 0");
+ shouldBeTrue("watchID2 > 0");
+ shouldBeTrue("watchID3 > 0");
+ shouldBeTrue("watchID1 !== watchID2");
+ shouldBeTrue("watchID1 !== watchID3");
+ shouldBeTrue("watchID2 !== watchID3");
+ finishJSTest();
+});
+
+window.jsTestIsAsync = true;
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698