1/* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17import {AdbDeviceState} from 'trace_collection/adb/adb_device_connection'; 18import {AdbHostConnection} from 'trace_collection/adb/adb_host_connection'; 19import {AdbConnectionType} from 'trace_collection/adb_connection_type'; 20import {ConnectionState} from 'trace_collection/connection_state'; 21import {MockAdbDeviceConnection} from 'trace_collection/mock/mock_adb_device_connection'; 22 23export class MockAdbHostConnection extends AdbHostConnection<MockAdbDeviceConnection> { 24 readonly connectionType = AdbConnectionType.MOCK; 25 26 override devices: MockAdbDeviceConnection[] = [ 27 new MockAdbDeviceConnection( 28 '35562', 29 'Pixel 6', 30 AdbDeviceState.AVAILABLE, 31 this.listener, 32 ), 33 ]; 34 35 override initializeExtraParameters() {} 36 37 override destroyHost() {} 38 39 override setSecurityToken(token: string) { 40 // do nothing 41 } 42 43 override cancelDeviceRequests() { 44 // do nothing 45 } 46 47 override async requestDevices(): Promise<void> { 48 this.listener.onDevicesChange(this.devices); 49 await this.setState(ConnectionState.IDLE); 50 } 51} 52