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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-permission-denied.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/disconnected-frame-permission-denied.js
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-permission-denied.js b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-permission-denied.js
index 6ff63c99b2ee6ae539f9aee5f76c3551c5c38e8c..66a5fea2cd7c8d40cc427fd0fbdb5ff47490ea53 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-permission-denied.js
+++ b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-permission-denied.js
@@ -1,16 +1,11 @@
description("Tests that when a request is made on a Geolocation object, permission is denied and its Frame is disconnected before a callback is made, no callbacks are made.");
-if (!window.testRunner || !window.internals)
- debug('This test can not run without testRunner or internals');
-
-internals.setGeolocationClientMock(document);
-
-// Prime the Geolocation instance by denying permission. This makes sure that we execute the
-// same code path for both preemptive and non-preemptive permissions policies.
-internals.setGeolocationPermission(document, false);
-internals.setGeolocationPosition(document, 51.478, -0.166, 100);
+if (!window.testRunner || !window.mojo)
+ debug('This test can not run without testRunner or mojo');
var error;
+var iframe = document.createElement('iframe');
+
function onIframeLoaded() {
iframeGeolocation = iframe.contentWindow.navigator.geolocation;
iframeGeolocation.getCurrentPosition(function() {
@@ -40,8 +35,15 @@ function onIframeUnloaded() {
}, 100);
}
-var iframe = document.createElement('iframe');
-iframe.src = 'resources/disconnected-frame-inner.html';
-document.body.appendChild(iframe);
+
+geolocationServiceMock.then(mock => {
+ // Prime the Geolocation instance by denying permission. This makes sure that we execute the
+ // same code path for both preemptive and non-preemptive permissions policies.
+ mock.setGeolocationPermission(false);
+ mock.setGeolocationPosition(51.478, -0.166, 100);
+
+ iframe.src = 'resources/disconnected-frame-inner.html';
+ document.body.appendChild(iframe);
+});
window.jsTestIsAsync = true;

Powered by Google App Engine
This is Rietveld 408576698