update Android device detection to handle adb error messages (#6521)

This commit is contained in:
Dan Rubel
2016-10-27 12:06:47 +01:00
committed by GitHub
parent ca90656fba
commit 7acc996547
2 changed files with 25 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'package:flutter_tools/src/android/android_device.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:test/test.dart';
import 'src/context.dart';
@@ -41,11 +42,25 @@ emulator-5612 host features:shell_2
testUsingContext('android n', () {
List<AndroidDevice> devices = getAdbDevices(mockAdbOutput: '''
List of devices attached
ZX1G22JJWR device usb:3-3 product:shamu model:Nexus_6 device:shamu features:cmd,shell_v2
''');
expect(devices, hasLength(1));
expect(devices.first.name, 'Nexus 6');
});
BufferLogger logger = new BufferLogger();
testUsingContext('adb error message', () {
List<AndroidDevice> devices = getAdbDevices(mockAdbOutput: '''
It appears you do not have 'Android SDK Platform-tools' installed.
Use the 'android' tool to install them:
android update sdk --no-ui --filter 'platform-tools'
''');
expect(devices, hasLength(0));
expect(logger.errorText, contains('you do not have'));
}, overrides: <Type, dynamic>{
Logger : logger,
});
});
group('parseAdbDeviceProperties', () {