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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/timestamp.js

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/script-tests/timestamp.js
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/timestamp.js b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/timestamp.js
index 9cf1dfd82be67a0fd062545e2856e3dc282ac431..6e5e8aa707cfae70be6fa12b612def80bcc8d08c 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/timestamp.js
+++ b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/timestamp.js
@@ -9,27 +9,28 @@ shouldBeTrue('now != 0');
var t = null;
var then = null;
-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.setGeolocationPermission(document, true);
-internals.setGeolocationPosition(document, mockLatitude, mockLongitude, mockAccuracy);
+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);
+ 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();
}
- shouldBeTrue('t <= then + 1'); // Avoid rounding errors
- finishJSTest();
-}
-navigator.geolocation.getCurrentPosition(checkPosition);
+ navigator.geolocation.getCurrentPosition(checkPosition);
+});
window.jsTestIsAsync = true;

Powered by Google App Engine
This is Rietveld 408576698