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

Side by Side Diff: LayoutTests/http/tests/resources/permissions-helper.js

Issue 1312623003: Flakyness: fix notifications/ tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@webmidi-flakyness
Patch Set: add missing file 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 unified diff | Download patch
OLDNEW
1 // This file provides a PermissionsHelper object which can be used by 1 // This file provides a PermissionsHelper object which can be used by
2 // LayoutTests using testRunner to handle permissions. The methods in the object 2 // LayoutTests using testRunner to handle permissions. The methods in the object
3 // return promises so can be used to write idiomatic, race-free code. 3 // return promises so can be used to write idiomatic, race-free code.
4 // 4 //
5 // The current available methods are: 5 // The current available methods are:
6 // - setPermission: given a permission name (known by testRunner) and a state, 6 // - setPermission: given a permission name (known by testRunner) and a state,
7 // it will set the permission to the specified state and resolve the promise 7 // it will set the permission to the specified state and resolve the promise
8 // when done. 8 // when done.
9 // Example: 9 // Example:
10 // PermissionsHelper.setPermission('geolocation', 'prompt').then(runTest); 10 // PermissionsHelper.setPermission('geolocation', 'prompt').then(runTest);
11 "use strict"; 11 "use strict";
12 12
13 var PermissionsHelper = (function() { 13 var PermissionsHelper = (function() {
14 function nameToObject(permissionName) { 14 function nameToObject(permissionName) {
15 switch (permissionName) { 15 switch (permissionName) {
16 case "midi": 16 case "midi":
17 return {name: "midi"}; 17 return {name: "midi"};
18 case "midi-sysex": 18 case "midi-sysex":
19 return {name: "midi", sysex: true}; 19 return {name: "midi", sysex: true};
20 case "push-messaging": 20 case "push-messaging":
johnme 2015/08/26 12:27:32 It's a bit weird for push-messaging to pass userVi
mlamouri (slow - plz ping) 2015/08/31 16:31:42 I don't mind either way. Feel free to file a bug.
21 return {name: "push", userVisibleOnly: true}; 21 return {name: "push", userVisibleOnly: true};
22 case "notifications": 22 case "notifications":
23 return {name: "notifications"}; 23 return {name: "notifications"};
24 case "geolocation": 24 case "geolocation":
25 return {name: "geolocation"}; 25 return {name: "geolocation"};
26 default: 26 default:
27 throw "Invalid permission name provided"; 27 throw "Invalid permission name provided";
28 } 28 }
29 } 29 }
30 30
(...skipping 10 matching lines...) Expand all
41 result.onchange = null; 41 result.onchange = null;
42 resolver(); 42 resolver();
43 }; 43 };
44 44
45 testRunner.setPermission(name, state, location.origin, location.orig in); 45 testRunner.setPermission(name, state, location.origin, location.orig in);
46 }); 46 });
47 }); 47 });
48 } 48 }
49 } 49 }
50 })(); 50 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698