OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 * | 48 * |
49 * @type {!permissionStatus.PermissionStatus} | 49 * @type {!permissionStatus.PermissionStatus} |
50 */ | 50 */ |
51 this.permissionStatus_ = permissionStatus.PermissionStatus.ASK; | 51 this.permissionStatus_ = permissionStatus.PermissionStatus.ASK; |
52 this.rejectPermissionConnections_ = false; | 52 this.rejectPermissionConnections_ = false; |
53 this.rejectGeolocationConnections_ = false; | 53 this.rejectGeolocationConnections_ = false; |
54 } | 54 } |
55 | 55 |
56 connectGeolocation_(handle) { | 56 connectGeolocation_(handle) { |
57 if (this.rejectGeolocationConnections_) { | 57 if (this.rejectGeolocationConnections_) { |
58 mojo.core.close(handle); | 58 handle.close(); |
59 return; | 59 return; |
60 } | 60 } |
61 this.geolocationStub_ = new geolocation.GeolocationService.stubClass( | 61 this.geolocationStub_ = new geolocation.GeolocationService.stubClass( |
62 this); | 62 this); |
63 this.geolocationRouter_ = new router.Router(handle); | 63 this.geolocationRouter_ = new router.Router(handle); |
64 this.geolocationRouter_.setIncomingReceiver(this.geolocationStub_); | 64 this.geolocationRouter_.setIncomingReceiver(this.geolocationStub_); |
65 } | 65 } |
66 | 66 |
67 connectPermission_(handle) { | 67 connectPermission_(handle) { |
68 if (this.rejectPermissionConnections_) { | 68 if (this.rejectPermissionConnections_) { |
69 mojo.core.close(handle); | 69 handle.close(); |
70 return; | 70 return; |
71 } | 71 } |
72 this.permissionStub_ = new permission.PermissionService.stubClass(this); | 72 this.permissionStub_ = new permission.PermissionService.stubClass(this); |
73 this.permissionRouter_ = new router.Router(handle); | 73 this.permissionRouter_ = new router.Router(handle); |
74 this.permissionRouter_.setIncomingReceiver(this.permissionStub_); | 74 this.permissionRouter_.setIncomingReceiver(this.permissionStub_); |
75 } | 75 } |
76 | 76 |
77 setHighAccuracy(highAccuracy) { | 77 setHighAccuracy(highAccuracy) { |
78 // FIXME: We need to add some tests regarding "high accuracy" mode. | 78 // FIXME: We need to add some tests regarding "high accuracy" mode. |
79 // See https://bugs.webkit.org/show_bug.cgi?id=49438 | 79 // See https://bugs.webkit.org/show_bug.cgi?id=49438 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 }); |
OLD | NEW |