feat: discover ADB devices from agent management

This commit is contained in:
tongtong committed 2026-11-12 22:30:05 +08:00
1 parent 8ecfe880cc
commit 3a7bb071f0
12 files changed
+132 -5

No files matched your search

+11
View File
@@ -37,6 +37,13 @@ class FakeApi implements AgentApi {
Future<Object?> request(String agent, JsonMap operation) async {
calls.add({...operation, 'agent': agent});
return switch (operation['op']) {
'devices_discover' => [
<String, Object?>{
'serial': '192.168.1.2:5555',
'state': 'device',
'configured': false,
},
],
'config_get' => {'id': agent, 'devices': <Object?>[]},
'logs' => {
'instance': 'i',
@@ -81,6 +88,10 @@ void main() {
await m.deviceOperation('device_enable', enabled: false);
expect(api.calls.last['id'], 'two-phone');
expect(api.calls.last['enabled'], false);
await m.discoverDevices();
m.chooseDiscovered(m.discoveredDevices.single);
expect(m.target, '192.168.1.2:5555');
expect(m.adbSerial, isEmpty);
await m.readLogs();
expect(m.logText, contains('[REDACTED]'));
expect(m.logText, isNot(contains('private-token')));