1/* 2 * Copyright (C) 2025 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 { 18 AdbDeviceConnection, 19 AdbDeviceConnectionListener, 20 AdbDeviceState, 21} from 'trace_collection/adb/adb_device_connection'; 22import {TraceTarget} from 'trace_collection/trace_target'; 23 24/** 25 * Represents an ADB device. 26 */ 27export class MockAdbDeviceConnection extends AdbDeviceConnection { 28 startTraceSuccess = true; 29 30 constructor( 31 id: string, 32 model: string, 33 state: AdbDeviceState, 34 listener: AdbDeviceConnectionListener, 35 displays: string[] = [], 36 multiDisplayScreenRecording = false, 37 ) { 38 super(id, listener); 39 this.state = state; 40 this.model = model; 41 this.displays = displays; 42 this.multiDisplayScreenRecording = multiDisplayScreenRecording; 43 } 44 45 override async startTrace(target: TraceTarget) {} 46 47 override async endTrace(target: TraceTarget): Promise<void> {} 48 49 override async tryAuthorize(): Promise<void> {} 50 override async runShellCommand(cmd: string): Promise<string> { 51 return ''; 52 } 53 54 override async pullFile(filepath: string): Promise<Uint8Array> { 55 return Uint8Array.from([]); 56 } 57 58 override onDestroy() { 59 // do nothing 60 } 61 62 protected override updatePropertiesFromResponse(resp: object) {} 63} 64