add a regression test for daemon device notification (#9618)

* add a regression test for daemon device notification

* revert event send simplification
This commit is contained in:
Devon Carew
2017-04-27 09:30:47 -07:00
committed by GitHub
parent d2c6b0a637
commit 9ac2e44ee7
3 changed files with 71 additions and 18 deletions

View File

@@ -29,6 +29,35 @@ class MockApplicationPackageStore extends ApplicationPackageStore {
);
}
class MockPollingDeviceDiscovery extends PollingDeviceDiscovery {
List<Device> _devices = <Device>[];
StreamController<Device> _onAddedController = new StreamController<Device>.broadcast();
StreamController<Device> _onRemovedController = new StreamController<Device>.broadcast();
MockPollingDeviceDiscovery() : super('mock');
@override
List<Device> pollingGetDevices() => _devices;
@override
bool get supportsPlatform => true;
void addDevice(MockAndroidDevice device) {
_devices.add(device);
_onAddedController.add(device);
}
@override
List<Device> get devices => _devices;
@override
Stream<Device> get onAdded => _onAddedController.stream;
@override
Stream<Device> get onRemoved => _onRemovedController.stream;
}
class MockAndroidDevice extends Mock implements AndroidDevice {
@override
Future<TargetPlatform> get targetPlatform async => TargetPlatform.android_arm;