Migrate emulators to null safety (#92738)
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_tools/src/android/android_emulator.dart';
|
||||
@@ -125,7 +123,7 @@ void main() {
|
||||
});
|
||||
|
||||
group('Android emulator launch ', () {
|
||||
FakeAndroidSdk mockSdk;
|
||||
late FakeAndroidSdk mockSdk;
|
||||
|
||||
setUp(() {
|
||||
mockSdk = FakeAndroidSdk();
|
||||
@@ -198,10 +196,30 @@ void main() {
|
||||
|
||||
expect(logger.errorText, isEmpty);
|
||||
});
|
||||
|
||||
testWithoutContext('throws if emulator not found', () async {
|
||||
mockSdk.emulatorPath = null;
|
||||
|
||||
final AndroidEmulator emulator = AndroidEmulator(
|
||||
emulatorID,
|
||||
processManager: FakeProcessManager.empty(),
|
||||
androidSdk: mockSdk,
|
||||
logger: BufferLogger.test(),
|
||||
);
|
||||
|
||||
await expectLater(
|
||||
() => emulator.launch(startupDuration: Duration.zero),
|
||||
throwsA(isException.having(
|
||||
(Exception exception) => exception.toString(),
|
||||
'description',
|
||||
contains('Emulator is missing from the Android SDK'),
|
||||
)),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
class FakeAndroidSdk extends Fake implements AndroidSdk {
|
||||
@override
|
||||
String emulatorPath;
|
||||
String? emulatorPath;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,6 @@ void main() {
|
||||
stdout: 'existing-avd-1',
|
||||
),
|
||||
]),
|
||||
androidSdk: null,
|
||||
androidWorkflow: AndroidWorkflow(
|
||||
androidSdk: sdk,
|
||||
featureFlags: TestFeatureFlags(),
|
||||
|
||||
Reference in New Issue
Block a user