Migrate assemble and integration_test_device to null safety (#96630)
This commit is contained in:
@@ -750,21 +750,6 @@ class FakeDevice extends Fake implements Device {
|
||||
}
|
||||
}
|
||||
|
||||
class FakeApplicationPackageFactory extends Fake implements ApplicationPackageFactory {
|
||||
FakeApplicationPackageFactory(this.applicationPackage);
|
||||
|
||||
ApplicationPackage applicationPackage;
|
||||
|
||||
@override
|
||||
Future<ApplicationPackage> getPackageForPlatform(
|
||||
TargetPlatform platform, {
|
||||
BuildInfo buildInfo,
|
||||
File applicationBinary,
|
||||
}) async => applicationPackage;
|
||||
}
|
||||
|
||||
class FakeApplicationPackage extends Fake implements ApplicationPackage { }
|
||||
|
||||
class TestRunCommandWithFakeResidentRunner extends RunCommand {
|
||||
FakeResidentRunner fakeResidentRunner;
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:flutter_tools/src/application_package.dart';
|
||||
import 'package:flutter_tools/src/base/io.dart' as io;
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
@@ -12,8 +14,10 @@ import 'package:flutter_tools/src/test/integration_test_device.dart';
|
||||
import 'package:flutter_tools/src/test/test_device.dart';
|
||||
import 'package:flutter_tools/src/vmservice.dart';
|
||||
import 'package:stream_channel/stream_channel.dart';
|
||||
import 'package:test/fake.dart';
|
||||
import 'package:vm_service/vm_service.dart' as vm_service;
|
||||
|
||||
import '../src/common.dart';
|
||||
import '../src/context.dart';
|
||||
import '../src/fake_devices.dart';
|
||||
import '../src/fake_vm_services.dart';
|
||||
@@ -121,12 +125,26 @@ void main() {
|
||||
]);
|
||||
});
|
||||
|
||||
testUsingContext('will not start when package missing', () async {
|
||||
await expectLater(
|
||||
testDevice.start('entrypointPath'),
|
||||
throwsA(
|
||||
isA<TestDeviceException>().having(
|
||||
(Exception e) => e.toString(),
|
||||
'description',
|
||||
contains('No application found for TargetPlatform.android_arm'),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
testUsingContext('Can start the entrypoint', () async {
|
||||
await testDevice.start('entrypointPath');
|
||||
|
||||
expect(await testDevice.observatoryUri, observatoryUri);
|
||||
expect(testDevice.finished, doesNotComplete);
|
||||
}, overrides: <Type, Generator>{
|
||||
ApplicationPackageFactory: () => FakeApplicationPackageFactory(),
|
||||
VMServiceConnector: () => (Uri httpUri, {
|
||||
ReloadSources reloadSources,
|
||||
Restart restart,
|
||||
@@ -145,6 +163,7 @@ void main() {
|
||||
|
||||
expect(testDevice.finished, completes);
|
||||
}, overrides: <Type, Generator>{
|
||||
ApplicationPackageFactory: () => FakeApplicationPackageFactory(),
|
||||
VMServiceConnector: () => (Uri httpUri, {
|
||||
ReloadSources reloadSources,
|
||||
Restart restart,
|
||||
@@ -218,6 +237,7 @@ void main() {
|
||||
await fakeVmServiceHost.vmService.dispose();
|
||||
expect(await channel.stream.isEmpty, true);
|
||||
}, overrides: <Type, Generator>{
|
||||
ApplicationPackageFactory: () => FakeApplicationPackageFactory(),
|
||||
VMServiceConnector: () => (Uri httpUri, {
|
||||
ReloadSources reloadSources,
|
||||
Restart restart,
|
||||
@@ -230,3 +250,14 @@ void main() {
|
||||
}) async => fakeVmServiceHost.vmService,
|
||||
});
|
||||
}
|
||||
|
||||
class FakeApplicationPackageFactory extends Fake implements ApplicationPackageFactory {
|
||||
@override
|
||||
Future<ApplicationPackage> getPackageForPlatform(
|
||||
TargetPlatform platform, {
|
||||
BuildInfo buildInfo,
|
||||
File applicationBinary,
|
||||
}) async => FakeApplicationPackage();
|
||||
}
|
||||
|
||||
class FakeApplicationPackage extends Fake implements ApplicationPackage { }
|
||||
|
||||
Reference in New Issue
Block a user