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

Unified Diff: LayoutTests/resources/permissions-helper.js

Issue 1346213002: Permission TestRunner: only use permissions-helper.js from http/tests/. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@testrunner-setpermission-removal
Patch Set: Created 5 years, 3 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
« no previous file with comments | « LayoutTests/inspector/geolocation-emulation-tests.html ('k') | LayoutTests/webmidi/loopback-receive.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/resources/permissions-helper.js
diff --git a/LayoutTests/resources/permissions-helper.js b/LayoutTests/resources/permissions-helper.js
deleted file mode 100644
index 6428d750c2b650ee9e55a7ae0ff36038c8f94684..0000000000000000000000000000000000000000
--- a/LayoutTests/resources/permissions-helper.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// This file provides a PermissionsHelper object which can be used by
-// LayoutTests using testRunner to handle permissions. The methods in the object
-// return promises so can be used to write idiomatic, race-free code.
-//
-// The current available methods are:
-// - setPermission: given a permission name (known by testRunner) and a state,
-// it will set the permission to the specified state and resolve the promise
-// when done.
-// Example:
-// PermissionsHelper.setPermission('geolocation', 'prompt').then(runTest);
-"use strict";
-
-var PermissionsHelper = (function() {
- function nameToObject(permissionName) {
- switch (permissionName) {
- case "midi":
- return {name: "midi"};
- case "midi-sysex":
- return {name: "midi", sysex: true};
- case "push-messaging":
- return {name: "push", userVisibleOnly: true};
- case "notifications":
- return {name: "notifications"};
- case "geolocation":
- return {name: "geolocation"};
- default:
- throw "Invalid permission name provided";
- }
- }
-
- return {
- setPermission: function(name, state) {
- return new Promise(function(resolver, reject) {
- navigator.permissions.query(nameToObject(name)).then(function(result) {
- if (result.state == state) {
- resolver()
- return;
- }
-
- result.onchange = function() {
- result.onchange = null;
- resolver();
- };
-
- testRunner.setPermission(name, state, location.origin, location.origin);
- });
- });
- }
- }
-})();
« no previous file with comments | « LayoutTests/inspector/geolocation-emulation-tests.html ('k') | LayoutTests/webmidi/loopback-receive.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698