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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/Geolocation/resources/geolocation-mock.js

Issue 2255933002: Add PermissionDescriptor to the permissions Mojo interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_notification_dispatcher
Patch Set: Print the unexpected permission type. Created 4 years, 2 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 /* 1 /*
2 * geolocation-mock contains a mock implementation of GeolocationService and 2 * geolocation-mock contains a mock implementation of GeolocationService and
3 * PermissionService. 3 * PermissionService.
4 */ 4 */
5 5
6 "use strict"; 6 "use strict";
7 7
8 let geolocationServiceMock = loadMojoModules( 8 let geolocationServiceMock = loadMojoModules(
9 'geolocationServiceMock', 9 'geolocationServiceMock',
10 ['device/geolocation/public/interfaces/geolocation.mojom', 10 ['device/geolocation/public/interfaces/geolocation.mojom',
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 rejectGeolocationConnections() { 142 rejectGeolocationConnections() {
143 this.rejectGeolocationConnections_ = true; 143 this.rejectGeolocationConnections_ = true;
144 } 144 }
145 145
146 /** 146 /**
147 * A mock implementation of PermissionService.requestPermission(). This 147 * A mock implementation of PermissionService.requestPermission(). This
148 * returns the result set by a call to setGeolocationPermission(), waiting 148 * returns the result set by a call to setGeolocationPermission(), waiting
149 * for a call if necessary. Any permission request that is not for 149 * for a call if necessary. Any permission request that is not for
150 * geolocation is always denied. 150 * geolocation is always denied.
151 */ 151 */
152 requestPermission(permissionName) { 152 requestPermission(permissionDescriptor) {
153 if (permissionName != permission.PermissionName.GEOLOCATION) 153 if (permissionDescriptor.name != permission.PermissionName.GEOLOCATION)
154 return Promise.resolve(permissionStatus.PermissionStatus.DENIED); 154 return Promise.resolve(permissionStatus.PermissionStatus.DENIED);
155 155
156 return new Promise(resolve => { 156 return new Promise(resolve => {
157 if (this.pendingPermissionRequest_) 157 if (this.pendingPermissionRequest_)
158 this.pendingPermissionRequest_(permissionStatus.PermissionStatus.ASK); 158 this.pendingPermissionRequest_(permissionStatus.PermissionStatus.ASK);
159 this.pendingPermissionRequest_ = resolve; 159 this.pendingPermissionRequest_ = resolve;
160 this.runPermissionCallback_(); 160 this.runPermissionCallback_();
161 }); 161 });
162 } 162 }
163 163
(...skipping 13 matching lines...) Expand all
177 setGeolocationPermission(allowed) { 177 setGeolocationPermission(allowed) {
178 this.permissionStatus_ = allowed ? 178 this.permissionStatus_ = allowed ?
179 permissionStatus.PermissionStatus.GRANTED : 179 permissionStatus.PermissionStatus.GRANTED :
180 permissionStatus.PermissionStatus.DENIED; 180 permissionStatus.PermissionStatus.DENIED;
181 this.runPermissionCallback_(); 181 this.runPermissionCallback_();
182 } 182 }
183 183
184 } 184 }
185 return new GeolocationServiceMock(mojo.frameInterfaces); 185 return new GeolocationServiceMock(mojo.frameInterfaces);
186 }); 186 });
OLDNEW
« no previous file with comments | « content/renderer/media/media_permission_dispatcher.cc ('k') | third_party/WebKit/Source/modules/geolocation/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698