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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/error.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/error.js
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/error.js b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/error.js
index 87b223af3deb42011edf4b80a49c7c2e6181d282..a2d730bec594cc6d5f940dc7b0b85b838ecf2150 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/error.js
+++ b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/error.js
@@ -2,18 +2,19 @@ description("Tests Geolocation error callback using the mock service.");
var mockMessage = "debug";
-if (!window.testRunner || !window.internals)
- debug('This test can not run without testRunner or internals');
-
-internals.setGeolocationClientMock(document);
-internals.setGeolocationPermission(document, true);
-internals.setGeolocationPositionUnavailableError(document, mockMessage);
+if (!window.testRunner || !window.mojo)
+ debug('This test can not run without testRunner or mojo');
var error;
-navigator.geolocation.getCurrentPosition(function(p) {
+
+geolocationServiceMock.then(mock => {
+ mock.setGeolocationPermission(true);
+ mock.setGeolocationPositionUnavailableError(mockMessage);
+
+ navigator.geolocation.getCurrentPosition(function(p) {
testFailed('Success callback invoked unexpectedly');
finishJSTest();
-}, function(e) {
+ }, function(e) {
error = e;
shouldBe('error.code', 'error.POSITION_UNAVAILABLE');
shouldBe('error.message', 'mockMessage');
@@ -22,6 +23,7 @@ navigator.geolocation.getCurrentPosition(function(p) {
shouldBe('error.POSITION_UNAVAILABLE', '2');
shouldBe('error.TIMEOUT', '3');
finishJSTest();
+ });
});
window.jsTestIsAsync = true;

Powered by Google App Engine
This is Rietveld 408576698