| 352 | }); |
| 353 | |
| 354 | class FakeFlutterDaemon extends FakeProcessStdIOService<unknown> implements IFlutterDaemon { |
| 355 | public capabilities = DaemonCapabilities.empty; |
| 356 | public supportedPlatforms: f.PlatformType[] | undefined; |
| 357 | public supportedPlatformsDelaySeconds: number | undefined; |
| 358 | |
| 359 | public async enablePlatformGlobally(_platformType: string): Promise<void> { } |
| 360 | |
| 361 | public async enablePlatform(platformType: string): Promise<void> { |
| 362 | this.supportedPlatforms = this.supportedPlatforms ?? []; |
| 363 | this.supportedPlatforms.push(platformType); |
| 364 | } |
| 365 | |
| 366 | public async checkIfPlatformGloballyDisabled(_platformType: string): Promise<boolean> { |
| 367 | return false; |
| 368 | } |
| 369 | |
| 370 | public async connect(d: f.Device, markTypeAsValid: boolean): Promise<void> { |
| 371 | if (markTypeAsValid && d.platformType) |
| 372 | await this.enablePlatform(d.platformType); |
| 373 | |
| 374 | await this.notify(this.deviceAddedSubscriptions, d); |
| 375 | } |
| 376 | |
| 377 | public async disconnect(d: f.Device): Promise<void> { |
| 378 | await this.notify(this.deviceRemovedSubscriptions, d); |
| 379 | } |
| 380 | |
| 381 | // Subscription lists. |
| 382 | |
| 383 | private daemonConnectedSubscriptions: Array<(notification: f.DaemonConnected) => void> = []; |
| 384 | private deviceAddedSubscriptions: Array<(notification: f.Device) => void> = []; |
| 385 | private deviceRemovedSubscriptions: Array<(notification: f.Device) => void> = []; |
| 386 | private daemonLogMessageSubscriptions: Array<(notification: f.DaemonLogMessage) => void> = []; |
| 387 | private daemonLogSubscriptions: Array<(notification: f.DaemonLog) => void> = []; |
| 388 | private daemonShowMessageSubscriptions: Array<(notification: f.ShowMessage) => void> = []; |
| 389 | |
| 390 | // Request methods. |
| 391 | |
| 392 | public deviceEnable(): Thenable<UnknownResponse> { |
| 393 | throw new Error("Method not implemented."); |
| 394 | } |
| 395 | public emulators: f.FlutterEmulator[] = [androidEmulator, androidBogusEmulatorId, androidBogusEmulatorName, androidEmulatorToOverride]; |
| 396 | |
| 397 | public async getEmulators(): Promise<f.FlutterEmulator[]> { |
| 398 | return this.emulators; |
| 399 | } |
| 400 | public launchEmulator(_emulatorId: string): Thenable<void> { |
| 401 | throw new Error("Method not implemented."); |
| 402 | } |
| 403 | public createEmulator(_name?: string): Thenable<{ success: boolean; emulatorName: string; error: string; }> { |
| 404 | throw new Error("Method not implemented."); |
| 405 | } |
| 406 | public async getSupportedPlatforms(projectRoot: string): Promise<f.SupportedPlatformsResponse> { |
| 407 | if (!projectRoot) |
| 408 | throw new Error("projectRoot must be specified!"); |
| 409 | |
| 410 | if (this.supportedPlatformsDelaySeconds) |
| 411 | await delay(this.supportedPlatformsDelaySeconds * 1000); |
nothing calls this directly
no outgoing calls
no test coverage detected