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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/Geolocation/timestamp.html

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/dom/Geolocation/timestamp.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/timestamp.html b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/timestamp.html
index ea0a388f6e6abb3438b1cd3005f80886af1c40f4..ea25aa5d88f97f6311cced25b840c529e4af94eb 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/timestamp.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/timestamp.html
@@ -6,6 +6,40 @@
<script src="resources/geolocation-mock.js"></script>
</head>
<body>
-<script src="script-tests/timestamp.js"></script>
+<script>
+description("Tests that Geoposition timestamps are well-formed (non-zero and in the same units as Date.getTime).");
+
+var mockLatitude = 51.478;
+var mockLongitude = -0.166;
+var mockAccuracy = 100.0;
+
+var now = new Date().getTime();
+shouldBeTrue('now != 0');
+var t = null;
+var then = null;
+
+geolocationServiceMock.then(mock => {
+ mock.setGeolocationPermission(true);
+ mock.setGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy);
+
+ function checkPosition(p) {
+ t = p.timestamp;
+ var d = new Date();
+ then = d.getTime();
+ shouldBeTrue('t != 0');
+ shouldBeTrue('then != 0');
+ shouldBeTrue('now - 1 <= t'); // Avoid rounding errors
+ if (now - 1 > t) {
+ debug(" now - 1 = " + (now-1));
+ debug(" t = " + t);
+ }
+ shouldBeTrue('t <= then + 1'); // Avoid rounding errors
+ finishJSTest();
+ }
+
+ navigator.geolocation.getCurrentPosition(checkPosition);
+});
+window.jsTestIsAsync = true;
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698