File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Expand file tree Collapse file tree 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 {
5858 bool get appliesToHostPlatform => _featureFlags.isAndroidEnabled;
5959
6060 @override
61- bool get canListDevices => _androidSdk != null && _androidSdk.adbPath != null ;
61+ bool get canListDevices => _androidSdk != null
62+ && _androidSdk.adbPath != null ;
6263
6364 @override
64- bool get canLaunchDevices => _androidSdk != null && _androidSdk.validateSdkWellFormed ().isEmpty;
65+ bool get canLaunchDevices => _androidSdk != null
66+ && _androidSdk.adbPath != null
67+ && _androidSdk.validateSdkWellFormed ().isEmpty;
6568
6669 @override
67- bool get canListEmulators => _androidSdk != null && _androidSdk.emulatorPath != null ;
70+ bool get canListEmulators => _androidSdk != null
71+ && _androidSdk.adbPath != null
72+ && _androidSdk.emulatorPath != null ;
6873}
6974
7075class AndroidValidator extends DoctorValidator {
Original file line number Diff line number Diff line change @@ -68,6 +68,20 @@ void main() {
6868 expect (androidWorkflow.canListEmulators, false );
6969 });
7070
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+
7185 testUsingContext ('licensesAccepted returns LicensesAccepted.unknown if cannot find sdkmanager' , () async {
7286 processManager.canRunSucceeds = false ;
7387 when (sdk.sdkManagerPath).thenReturn ('/foo/bar/sdkmanager' );
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ void main() {
5858 when (mockSdk.avdManagerPath).thenReturn ('avdmanager' );
5959 when (mockSdk.getAvdManagerPath ()).thenReturn ('avdmanager' );
6060 when (mockSdk.emulatorPath).thenReturn ('emulator' );
61+ when (mockSdk.adbPath).thenReturn ('adb' );
6162 });
6263
6364 group ('EmulatorManager' , () {
You can’t perform that action at this time.
0 commit comments