File tree 3 files changed +23
-3
lines changed 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -58,13 +58,18 @@ class AndroidWorkflow implements Workflow {
58
58
bool get appliesToHostPlatform => _featureFlags.isAndroidEnabled;
59
59
60
60
@override
61
- bool get canListDevices => _androidSdk != null && _androidSdk.adbPath != null ;
61
+ bool get canListDevices => _androidSdk != null
62
+ && _androidSdk.adbPath != null ;
62
63
63
64
@override
64
- bool get canLaunchDevices => _androidSdk != null && _androidSdk.validateSdkWellFormed ().isEmpty;
65
+ bool get canLaunchDevices => _androidSdk != null
66
+ && _androidSdk.adbPath != null
67
+ && _androidSdk.validateSdkWellFormed ().isEmpty;
65
68
66
69
@override
67
- bool get canListEmulators => _androidSdk != null && _androidSdk.emulatorPath != null ;
70
+ bool get canListEmulators => _androidSdk != null
71
+ && _androidSdk.adbPath != null
72
+ && _androidSdk.emulatorPath != null ;
68
73
}
69
74
70
75
class AndroidValidator extends DoctorValidator {
Original file line number Diff line number Diff line change @@ -68,6 +68,20 @@ void main() {
68
68
expect (androidWorkflow.canListEmulators, false );
69
69
});
70
70
71
+ testWithoutContext ('AndroidWorkflow handles a null adb' , () {
72
+ final MockAndroidSdk androidSdk = MockAndroidSdk ();
73
+ when (androidSdk.adbPath).thenReturn (null );
74
+ final AndroidWorkflow androidWorkflow = AndroidWorkflow (
75
+ featureFlags: TestFeatureFlags (),
76
+ androidSdk: androidSdk,
77
+ );
78
+
79
+ expect (androidWorkflow.canLaunchDevices, false );
80
+ expect (androidWorkflow.canListDevices, false );
81
+ expect (androidWorkflow.canListEmulators, false );
82
+ });
83
+
84
+
71
85
testUsingContext ('licensesAccepted returns LicensesAccepted.unknown if cannot find sdkmanager' , () async {
72
86
processManager.canRunSucceeds = false ;
73
87
when (sdk.sdkManagerPath).thenReturn ('/foo/bar/sdkmanager' );
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ void main() {
58
58
when (mockSdk.avdManagerPath).thenReturn ('avdmanager' );
59
59
when (mockSdk.getAvdManagerPath ()).thenReturn ('avdmanager' );
60
60
when (mockSdk.emulatorPath).thenReturn ('emulator' );
61
+ when (mockSdk.adbPath).thenReturn ('adb' );
61
62
});
62
63
63
64
group ('EmulatorManager' , () {
You can’t perform that action at this time.
0 commit comments