Unverified Commit 9dbc09de authored by Liam Appelbe's avatar Liam Appelbe Committed by GitHub

Null safety migration of packages/flutter_tools/test/commands.shard/hermetic, part 3/3 (#110709)

* Migrate packages/flutter_tools/test/commands.shard/hermetic, part 3/3

* Fix tests

* Chris's comment
parent 089d9551
...@@ -512,7 +512,7 @@ class RunCommand extends RunCommandBase { ...@@ -512,7 +512,7 @@ class RunCommand extends RunCommandBase {
} }
@visibleForTesting @visibleForTesting
Future<ResidentRunner?> createRunner({ Future<ResidentRunner> createRunner({
required bool hotMode, required bool hotMode,
required List<FlutterDevice> flutterDevices, required List<FlutterDevice> flutterDevices,
required String? applicationBinaryPath, required String? applicationBinaryPath,
...@@ -669,12 +669,12 @@ class RunCommand extends RunCommandBase { ...@@ -669,12 +669,12 @@ class RunCommand extends RunCommandBase {
), ),
]; ];
final ResidentRunner runner = await (createRunner( final ResidentRunner runner = await createRunner(
applicationBinaryPath: applicationBinaryPath, applicationBinaryPath: applicationBinaryPath,
flutterDevices: flutterDevices, flutterDevices: flutterDevices,
flutterProject: flutterProject, flutterProject: flutterProject,
hotMode: hotMode, hotMode: hotMode,
) as FutureOr<ResidentRunner>); );
DateTime? appStartedTime; DateTime? appStartedTime;
// Sync completer so the completing agent attaching to the resident doesn't // Sync completer so the completing agent attaching to the resident doesn't
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/file.dart'; import 'package:file/file.dart';
import 'package:file/memory.dart'; import 'package:file/memory.dart';
import 'package:flutter_tools/src/android/android_device.dart'; import 'package:flutter_tools/src/android/android_device.dart';
...@@ -27,7 +25,7 @@ void main() { ...@@ -27,7 +25,7 @@ void main() {
Cache.disableLocking(); Cache.disableLocking();
}); });
FileSystem fileSystem; late FileSystem fileSystem;
setUp(() { setUp(() {
fileSystem = MemoryFileSystem.test(); fileSystem = MemoryFileSystem.test();
fileSystem.file('pubspec.yaml').createSync(recursive: true); fileSystem.file('pubspec.yaml').createSync(recursive: true);
...@@ -114,7 +112,7 @@ class FakeApplicationPackageFactory extends Fake implements ApplicationPackageFa ...@@ -114,7 +112,7 @@ class FakeApplicationPackageFactory extends Fake implements ApplicationPackageFa
final ApplicationPackage app; final ApplicationPackage app;
@override @override
Future<ApplicationPackage> getPackageForPlatform(TargetPlatform platform, {BuildInfo buildInfo, File applicationBinary}) async { Future<ApplicationPackage> getPackageForPlatform(TargetPlatform platform, {BuildInfo? buildInfo, File? applicationBinary}) async {
return app; return app;
} }
} }
...@@ -131,13 +129,13 @@ class FakeIOSDevice extends Fake implements IOSDevice { ...@@ -131,13 +129,13 @@ class FakeIOSDevice extends Fake implements IOSDevice {
@override @override
Future<bool> isAppInstalled( Future<bool> isAppInstalled(
IOSApp app, { IOSApp app, {
String userIdentifier, String? userIdentifier,
}) async => false; }) async => false;
@override @override
Future<bool> installApp( Future<bool> installApp(
IOSApp app, { IOSApp app, {
String userIdentifier, String? userIdentifier,
}) async => true; }) async => true;
} }
...@@ -151,12 +149,12 @@ class FakeAndroidDevice extends Fake implements AndroidDevice { ...@@ -151,12 +149,12 @@ class FakeAndroidDevice extends Fake implements AndroidDevice {
@override @override
Future<bool> isAppInstalled( Future<bool> isAppInstalled(
AndroidApk app, { AndroidApk app, {
String userIdentifier, String? userIdentifier,
}) async => false; }) async => false;
@override @override
Future<bool> installApp( Future<bool> installApp(
AndroidApk app, { AndroidApk app, {
String userIdentifier, String? userIdentifier,
}) async => true; }) async => true;
} }
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/logs.dart'; import 'package:flutter_tools/src/commands/logs.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/cache.dart';
...@@ -16,7 +14,7 @@ import '../../src/fakes.dart'; ...@@ -16,7 +14,7 @@ import '../../src/fakes.dart';
import '../../src/test_flutter_command_runner.dart'; import '../../src/test_flutter_command_runner.dart';
void main() { void main() {
FakeCache cache; late FakeCache cache;
setUp(() { setUp(() {
cache = FakeCache(); cache = FakeCache();
...@@ -429,7 +427,7 @@ class FakeCache extends Fake implements Cache { ...@@ -429,7 +427,7 @@ class FakeCache extends Fake implements Cache {
bool isUpToDateValue = false; bool isUpToDateValue = false;
bool clearedStampFiles = false; bool clearedStampFiles = false;
bool locked = false; bool locked = false;
Set<DevelopmentArtifact> artifacts; Set<DevelopmentArtifact>? artifacts;
@override @override
Future<void> lock() async { Future<void> lock() async {
...@@ -455,7 +453,7 @@ class FakeCache extends Fake implements Cache { ...@@ -455,7 +453,7 @@ class FakeCache extends Fake implements Cache {
} }
@override @override
Set<String> platformOverrideArtifacts; Set<String>? platformOverrideArtifacts;
@override @override
bool includeAllPlatforms = false; bool includeAllPlatforms = false;
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:async'; import 'dart:async';
import 'package:file/memory.dart'; import 'package:file/memory.dart';
...@@ -24,18 +22,18 @@ import '../../src/context.dart'; ...@@ -24,18 +22,18 @@ import '../../src/context.dart';
import '../../src/fake_devices.dart'; import '../../src/fake_devices.dart';
void main() { void main() {
Daemon daemon; Daemon? daemon;
NotifyingLogger notifyingLogger; late NotifyingLogger notifyingLogger;
BufferLogger bufferLogger; late BufferLogger bufferLogger;
FakeAndroidDevice fakeDevice; late FakeAndroidDevice fakeDevice;
FakeApplicationPackageFactory applicationPackageFactory; late FakeApplicationPackageFactory applicationPackageFactory;
MemoryFileSystem memoryFileSystem; late MemoryFileSystem memoryFileSystem;
FakeProcessManager fakeProcessManager; late FakeProcessManager fakeProcessManager;
group('ProxiedDevices', () { group('ProxiedDevices', () {
DaemonConnection serverDaemonConnection; late DaemonConnection serverDaemonConnection;
DaemonConnection clientDaemonConnection; late DaemonConnection clientDaemonConnection;
setUp(() { setUp(() {
bufferLogger = BufferLogger.test(); bufferLogger = BufferLogger.test();
notifyingLogger = NotifyingLogger(verbose: false, parent: bufferLogger); notifyingLogger = NotifyingLogger(verbose: false, parent: bufferLogger);
...@@ -60,7 +58,7 @@ void main() { ...@@ -60,7 +58,7 @@ void main() {
tearDown(() async { tearDown(() async {
if (daemon != null) { if (daemon != null) {
return daemon.shutdown(); return daemon!.shutdown();
} }
notifyingLogger.dispose(); notifyingLogger.dispose();
await serverDaemonConnection.dispose(); await serverDaemonConnection.dispose();
...@@ -74,7 +72,7 @@ void main() { ...@@ -74,7 +72,7 @@ void main() {
); );
fakeDevice = FakeAndroidDevice(); fakeDevice = FakeAndroidDevice();
final FakePollingDeviceDiscovery discoverer = FakePollingDeviceDiscovery(); final FakePollingDeviceDiscovery discoverer = FakePollingDeviceDiscovery();
daemon.deviceDomain.addDeviceDiscoverer(discoverer); daemon!.deviceDomain.addDeviceDiscoverer(discoverer);
discoverer.addDevice(fakeDevice); discoverer.addDevice(fakeDevice);
final ProxiedDevices proxiedDevices = ProxiedDevices(clientDaemonConnection, logger: bufferLogger); final ProxiedDevices proxiedDevices = ProxiedDevices(clientDaemonConnection, logger: bufferLogger);
...@@ -95,7 +93,7 @@ void main() { ...@@ -95,7 +93,7 @@ void main() {
); );
fakeDevice = FakeAndroidDevice(); fakeDevice = FakeAndroidDevice();
final FakePollingDeviceDiscovery discoverer = FakePollingDeviceDiscovery(); final FakePollingDeviceDiscovery discoverer = FakePollingDeviceDiscovery();
daemon.deviceDomain.addDeviceDiscoverer(discoverer); daemon!.deviceDomain.addDeviceDiscoverer(discoverer);
discoverer.addDevice(fakeDevice); discoverer.addDevice(fakeDevice);
final ProxiedDevices proxiedDevices = ProxiedDevices(clientDaemonConnection, logger: bufferLogger); final ProxiedDevices proxiedDevices = ProxiedDevices(clientDaemonConnection, logger: bufferLogger);
...@@ -115,7 +113,7 @@ void main() { ...@@ -115,7 +113,7 @@ void main() {
); );
fakeDevice = FakeAndroidDevice(); fakeDevice = FakeAndroidDevice();
final FakePollingDeviceDiscovery discoverer = FakePollingDeviceDiscovery(); final FakePollingDeviceDiscovery discoverer = FakePollingDeviceDiscovery();
daemon.deviceDomain.addDeviceDiscoverer(discoverer); daemon!.deviceDomain.addDeviceDiscoverer(discoverer);
discoverer.addDevice(fakeDevice); discoverer.addDevice(fakeDevice);
final ProxiedDevices proxiedDevices = ProxiedDevices(clientDaemonConnection, logger: bufferLogger); final ProxiedDevices proxiedDevices = ProxiedDevices(clientDaemonConnection, logger: bufferLogger);
...@@ -145,7 +143,7 @@ void main() { ...@@ -145,7 +143,7 @@ void main() {
); );
fakeDevice = FakeAndroidDevice(); fakeDevice = FakeAndroidDevice();
final FakePollingDeviceDiscovery discoverer = FakePollingDeviceDiscovery(); final FakePollingDeviceDiscovery discoverer = FakePollingDeviceDiscovery();
daemon.deviceDomain.addDeviceDiscoverer(discoverer); daemon!.deviceDomain.addDeviceDiscoverer(discoverer);
discoverer.addDevice(fakeDevice); discoverer.addDevice(fakeDevice);
final ProxiedDevices proxiedDevices = ProxiedDevices(clientDaemonConnection, logger: bufferLogger); final ProxiedDevices proxiedDevices = ProxiedDevices(clientDaemonConnection, logger: bufferLogger);
...@@ -173,9 +171,9 @@ void main() { ...@@ -173,9 +171,9 @@ void main() {
expect(launchResult.started, true); expect(launchResult.started, true);
// The returned observatoryUri was a forwarded port, so we cannot compare them directly. // The returned observatoryUri was a forwarded port, so we cannot compare them directly.
expect(launchResult.observatoryUri.path, observatoryUri.path); expect(launchResult.observatoryUri!.path, observatoryUri.path);
expect(applicationPackageFactory.applicationBinaryRequested.readAsStringSync(), 'dummy content'); expect(applicationPackageFactory.applicationBinaryRequested!.readAsStringSync(), 'dummy content');
expect(applicationPackageFactory.platformRequested, TargetPlatform.android_arm); expect(applicationPackageFactory.platformRequested, TargetPlatform.android_arm);
expect(fakeDevice.startAppPackage, applicationPackage); expect(fakeDevice.startAppPackage, applicationPackage);
...@@ -197,7 +195,7 @@ void main() { ...@@ -197,7 +195,7 @@ void main() {
); );
fakeDevice = FakeAndroidDevice(); fakeDevice = FakeAndroidDevice();
final FakePollingDeviceDiscovery discoverer = FakePollingDeviceDiscovery(); final FakePollingDeviceDiscovery discoverer = FakePollingDeviceDiscovery();
daemon.deviceDomain.addDeviceDiscoverer(discoverer); daemon!.deviceDomain.addDeviceDiscoverer(discoverer);
discoverer.addDevice(fakeDevice); discoverer.addDevice(fakeDevice);
final ProxiedDevices proxiedDevices = ProxiedDevices(clientDaemonConnection, logger: bufferLogger); final ProxiedDevices proxiedDevices = ProxiedDevices(clientDaemonConnection, logger: bufferLogger);
...@@ -230,7 +228,7 @@ class FakeDaemonStreams implements DaemonStreams { ...@@ -230,7 +228,7 @@ class FakeDaemonStreams implements DaemonStreams {
} }
@override @override
void send(Map<String, dynamic> message, [ List<int> binary ]) { void send(Map<String, dynamic> message, [ List<int>? binary ]) {
outputs.add(DaemonMessage(message, binary != null ? Stream<List<int>>.value(binary) : null)); outputs.add(DaemonMessage(message, binary != null ? Stream<List<int>>.value(binary) : null));
} }
...@@ -294,48 +292,48 @@ class FakeAndroidDevice extends Fake implements AndroidDevice { ...@@ -294,48 +292,48 @@ class FakeAndroidDevice extends Fake implements AndroidDevice {
@override @override
bool get supportsStartPaused => true; bool get supportsStartPaused => true;
BuildMode supportsRuntimeModeCalledBuildMode; BuildMode? supportsRuntimeModeCalledBuildMode;
@override @override
Future<bool> supportsRuntimeMode(BuildMode buildMode) async { Future<bool> supportsRuntimeMode(BuildMode buildMode) async {
supportsRuntimeModeCalledBuildMode = buildMode; supportsRuntimeModeCalledBuildMode = buildMode;
return true; return true;
} }
DeviceLogReader logReader; late DeviceLogReader logReader;
@override @override
FutureOr<DeviceLogReader> getLogReader({ FutureOr<DeviceLogReader> getLogReader({
covariant ApplicationPackage app, covariant ApplicationPackage? app,
bool includePastLogs = false, bool includePastLogs = false,
}) => logReader; }) => logReader;
ApplicationPackage startAppPackage; ApplicationPackage? startAppPackage;
LaunchResult launchResult; late LaunchResult launchResult;
@override @override
Future<LaunchResult> startApp( Future<LaunchResult> startApp(
ApplicationPackage package, { ApplicationPackage package, {
String mainPath, String? mainPath,
String route, String? route,
DebuggingOptions debuggingOptions, DebuggingOptions? debuggingOptions,
Map<String, Object> platformArgs = const <String, Object>{}, Map<String, Object?> platformArgs = const <String, Object>{},
bool prebuiltApplication = false, bool prebuiltApplication = false,
bool ipv6 = false, bool ipv6 = false,
String userIdentifier, String? userIdentifier,
}) async { }) async {
startAppPackage = package; startAppPackage = package;
return launchResult; return launchResult;
} }
ApplicationPackage stopAppPackage; ApplicationPackage? stopAppPackage;
@override @override
Future<bool> stopApp( Future<bool> stopApp(
ApplicationPackage app, { ApplicationPackage app, {
String userIdentifier, String? userIdentifier,
}) async { }) async {
stopAppPackage = app; stopAppPackage = app;
return true; return true;
} }
List<int> screenshot; late List<int> screenshot;
@override @override
Future<void> takeScreenshot(File outputFile) { Future<void> takeScreenshot(File outputFile) {
return outputFile.writeAsBytes(screenshot); return outputFile.writeAsBytes(screenshot);
...@@ -347,10 +345,10 @@ class FakeDeviceLogReader implements DeviceLogReader { ...@@ -347,10 +345,10 @@ class FakeDeviceLogReader implements DeviceLogReader {
bool disposeCalled = false; bool disposeCalled = false;
@override @override
int appPid; int? appPid;
@override @override
FlutterVmService connectedVMService; FlutterVmService? connectedVMService;
@override @override
void dispose() { void dispose() {
...@@ -366,12 +364,12 @@ class FakeDeviceLogReader implements DeviceLogReader { ...@@ -366,12 +364,12 @@ class FakeDeviceLogReader implements DeviceLogReader {
} }
class FakeApplicationPackageFactory implements ApplicationPackageFactory { class FakeApplicationPackageFactory implements ApplicationPackageFactory {
TargetPlatform platformRequested; TargetPlatform? platformRequested;
File applicationBinaryRequested; File? applicationBinaryRequested;
ApplicationPackage applicationPackage; ApplicationPackage? applicationPackage;
@override @override
Future<ApplicationPackage> getPackageForPlatform(TargetPlatform platform, {BuildInfo buildInfo, File applicationBinary}) async { Future<ApplicationPackage?> getPackageForPlatform(TargetPlatform platform, {BuildInfo? buildInfo, File? applicationBinary}) async {
platformRequested = platform; platformRequested = platform;
applicationBinaryRequested = applicationBinary; applicationBinaryRequested = applicationBinary;
return applicationPackage; return applicationPackage;
...@@ -382,5 +380,5 @@ class FakeApplicationPackage extends Fake implements ApplicationPackage {} ...@@ -382,5 +380,5 @@ class FakeApplicationPackage extends Fake implements ApplicationPackage {}
class FakePrebuiltApplicationPackage extends Fake implements PrebuiltApplicationPackage { class FakePrebuiltApplicationPackage extends Fake implements PrebuiltApplicationPackage {
@override @override
File applicationPackage; late File applicationPackage;
} }
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:async'; import 'dart:async';
import 'package:file/file.dart'; import 'package:file/file.dart';
...@@ -31,7 +29,6 @@ import 'package:flutter_tools/src/reporting/reporting.dart'; ...@@ -31,7 +29,6 @@ import 'package:flutter_tools/src/reporting/reporting.dart';
import 'package:flutter_tools/src/resident_runner.dart'; import 'package:flutter_tools/src/resident_runner.dart';
import 'package:flutter_tools/src/runner/flutter_command.dart'; import 'package:flutter_tools/src/runner/flutter_command.dart';
import 'package:flutter_tools/src/vmservice.dart'; import 'package:flutter_tools/src/vmservice.dart';
import 'package:meta/meta.dart';
import 'package:test/fake.dart'; import 'package:test/fake.dart';
import 'package:vm_service/vm_service.dart'; import 'package:vm_service/vm_service.dart';
...@@ -47,8 +44,8 @@ void main() { ...@@ -47,8 +44,8 @@ void main() {
}); });
group('run', () { group('run', () {
FakeDeviceManager mockDeviceManager; late FakeDeviceManager mockDeviceManager;
FileSystem fileSystem; late FileSystem fileSystem;
setUp(() { setUp(() {
mockDeviceManager = FakeDeviceManager(); mockDeviceManager = FakeDeviceManager();
...@@ -142,10 +139,10 @@ void main() { ...@@ -142,10 +139,10 @@ void main() {
}); });
group('run app', () { group('run app', () {
MemoryFileSystem fs; late MemoryFileSystem fs;
Artifacts artifacts; late Artifacts artifacts;
TestUsage usage; late TestUsage usage;
FakeAnsiTerminal fakeTerminal; late FakeAnsiTerminal fakeTerminal;
setUpAll(() { setUpAll(() {
Cache.disableLocking(); Cache.disableLocking();
...@@ -555,8 +552,8 @@ void main() { ...@@ -555,8 +552,8 @@ void main() {
}); });
group('Fatal Logs', () { group('Fatal Logs', () {
TestRunCommandWithFakeResidentRunner command; late TestRunCommandWithFakeResidentRunner command;
MemoryFileSystem fs; late MemoryFileSystem fs;
setUp(() { setUp(() {
command = TestRunCommandWithFakeResidentRunner() command = TestRunCommandWithFakeResidentRunner()
...@@ -666,7 +663,7 @@ void main() { ...@@ -666,7 +663,7 @@ void main() {
}); });
group('dart-defines and web-renderer options', () { group('dart-defines and web-renderer options', () {
List<String> dartDefines; late List<String> dartDefines;
setUp(() { setUp(() {
dartDefines = <String>[]; dartDefines = <String>[];
...@@ -707,7 +704,7 @@ void main() { ...@@ -707,7 +704,7 @@ void main() {
}); });
group('terminal', () { group('terminal', () {
FakeAnsiTerminal fakeTerminal; late FakeAnsiTerminal fakeTerminal;
setUp(() { setUp(() {
fakeTerminal = FakeAnsiTerminal(); fakeTerminal = FakeAnsiTerminal();
...@@ -877,7 +874,7 @@ void main() { ...@@ -877,7 +874,7 @@ void main() {
expect(options.webLaunchUrl, 'http://flutter.dev'); expect(options.webLaunchUrl, 'http://flutter.dev');
final RegExp pattern = RegExp(r'^((http)?:\/\/)[^\s]+'); final RegExp pattern = RegExp(r'^((http)?:\/\/)[^\s]+');
expect(pattern.hasMatch(options.webLaunchUrl), true); expect(pattern.hasMatch(options.webLaunchUrl!), true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
Logger: () => BufferLogger.test(), Logger: () => BufferLogger.test(),
...@@ -889,7 +886,7 @@ class FakeDeviceManager extends Fake implements DeviceManager { ...@@ -889,7 +886,7 @@ class FakeDeviceManager extends Fake implements DeviceManager {
List<Device> targetDevices = <Device>[]; List<Device> targetDevices = <Device>[];
@override @override
String specifiedDeviceId; String? specifiedDeviceId;
@override @override
bool hasSpecifiedAllDevices = false; bool hasSpecifiedAllDevices = false;
...@@ -903,7 +900,7 @@ class FakeDeviceManager extends Fake implements DeviceManager { ...@@ -903,7 +900,7 @@ class FakeDeviceManager extends Fake implements DeviceManager {
} }
@override @override
Future<List<Device>> findTargetDevices(FlutterProject flutterProject, {Duration timeout}) async { Future<List<Device>> findTargetDevices(FlutterProject? flutterProject, {Duration? timeout}) async {
return targetDevices; return targetDevices;
} }
...@@ -950,7 +947,7 @@ class FakeDevice extends Fake implements Device { ...@@ -950,7 +947,7 @@ class FakeDevice extends Fake implements Device {
@override @override
String get id => 'fake_device'; String get id => 'fake_device';
void _throwToolExit(int code) => throwToolExit('FakeDevice tool exit', exitCode: code); Never _throwToolExit(int code) => throwToolExit('FakeDevice tool exit', exitCode: code);
@override @override
Future<bool> get isLocalEmulator => Future<bool>.value(_isLocalEmulator); Future<bool> get isLocalEmulator => Future<bool>.value(_isLocalEmulator);
...@@ -987,7 +984,7 @@ class FakeDevice extends Fake implements Device { ...@@ -987,7 +984,7 @@ class FakeDevice extends Fake implements Device {
@override @override
DeviceLogReader getLogReader({ DeviceLogReader getLogReader({
ApplicationPackage app, ApplicationPackage? app,
bool includePastLogs = false, bool includePastLogs = false,
}) { }) {
return FakeDeviceLogReader(); return FakeDeviceLogReader();
...@@ -1002,27 +999,27 @@ class FakeDevice extends Fake implements Device { ...@@ -1002,27 +999,27 @@ class FakeDevice extends Fake implements Device {
@override @override
PlatformType get platformType => _platformType; PlatformType get platformType => _platformType;
bool startAppSuccess; late bool startAppSuccess;
@override @override
DevFSWriter createDevFSWriter( DevFSWriter? createDevFSWriter(
covariant ApplicationPackage app, covariant ApplicationPackage? app,
String userIdentifier, String? userIdentifier,
) { ) {
return null; return null;
} }
@override @override
Future<LaunchResult> startApp( Future<LaunchResult> startApp(
ApplicationPackage package, { ApplicationPackage? package, {
String mainPath, String? mainPath,
String route, String? route,
DebuggingOptions debuggingOptions, required DebuggingOptions debuggingOptions,
Map<String, dynamic> platformArgs, Map<String, Object?> platformArgs = const <String, Object?>{},
bool prebuiltApplication = false, bool prebuiltApplication = false,
bool usesTerminalUi = true, bool usesTerminalUi = true,
bool ipv6 = false, bool ipv6 = false,
String userIdentifier, String? userIdentifier,
}) async { }) async {
if (startAppSuccess == false) { if (startAppSuccess == false) {
return LaunchResult.failed(); return LaunchResult.failed();
...@@ -1045,19 +1042,18 @@ class FakeDevice extends Fake implements Device { ...@@ -1045,19 +1042,18 @@ class FakeDevice extends Fake implements Device {
} }
_throwToolExit(kSuccess); _throwToolExit(kSuccess);
} }
return null;
} }
} }
class TestRunCommandWithFakeResidentRunner extends RunCommand { class TestRunCommandWithFakeResidentRunner extends RunCommand {
FakeResidentRunner fakeResidentRunner; late FakeResidentRunner fakeResidentRunner;
@override @override
Future<ResidentRunner> createRunner({ Future<ResidentRunner> createRunner({
@required bool hotMode, required bool hotMode,
@required List<FlutterDevice> flutterDevices, required List<FlutterDevice> flutterDevices,
@required String applicationBinaryPath, required String? applicationBinaryPath,
@required FlutterProject flutterProject, required FlutterProject flutterProject,
}) async { }) async {
return fakeResidentRunner; return fakeResidentRunner;
} }
...@@ -1077,26 +1073,26 @@ class TestRunCommandThatOnlyValidates extends RunCommand { ...@@ -1077,26 +1073,26 @@ class TestRunCommandThatOnlyValidates extends RunCommand {
} }
class FakeResidentRunner extends Fake implements ResidentRunner { class FakeResidentRunner extends Fake implements ResidentRunner {
RPCError rpcError; RPCError? rpcError;
@override @override
Future<int> run({ Future<int> run({
Completer<DebugConnectionInfo> connectionInfoCompleter, Completer<DebugConnectionInfo>? connectionInfoCompleter,
Completer<void> appStartedCompleter, Completer<void>? appStartedCompleter,
bool enableDevTools = false, bool enableDevTools = false,
String route, String? route,
}) async { }) async {
await null; await null;
if (rpcError != null) { if (rpcError != null) {
throw rpcError; throw rpcError!;
} }
return 0; return 0;
} }
} }
class DaemonCapturingRunCommand extends RunCommand { class DaemonCapturingRunCommand extends RunCommand {
/*late*/ Daemon daemon; late Daemon daemon;
/*late*/ CapturingAppDomain appDomain; late CapturingAppDomain appDomain;
@override @override
Daemon createMachineDaemon() { Daemon createMachineDaemon() {
...@@ -1108,29 +1104,29 @@ class DaemonCapturingRunCommand extends RunCommand { ...@@ -1108,29 +1104,29 @@ class DaemonCapturingRunCommand extends RunCommand {
} }
class CapturingAppDomain extends AppDomain { class CapturingAppDomain extends AppDomain {
CapturingAppDomain(Daemon daemon) : super(daemon); CapturingAppDomain(super.daemon);
bool /*?*/ multidexEnabled; bool? multidexEnabled;
String /*?*/ userIdentifier; String? userIdentifier;
@override @override
Future<AppInstance> startApp( Future<AppInstance> startApp(
Device device, Device device,
String projectDirectory, String projectDirectory,
String target, String target,
String route, String? route,
DebuggingOptions options, DebuggingOptions options,
bool enableHotReload, { bool enableHotReload, {
File applicationBinary, File? applicationBinary,
@required bool trackWidgetCreation, required bool trackWidgetCreation,
String projectRootPath, String? projectRootPath,
String packagesFilePath, String? packagesFilePath,
String dillOutputPath, String? dillOutputPath,
bool ipv6 = false, bool ipv6 = false,
bool multidexEnabled = false, bool multidexEnabled = false,
String isolateFilter, String? isolateFilter,
bool machine = true, bool machine = true,
String userIdentifier, String? userIdentifier,
}) async { }) async {
this.multidexEnabled = multidexEnabled; this.multidexEnabled = multidexEnabled;
this.userIdentifier = userIdentifier; this.userIdentifier = userIdentifier;
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/cache.dart';
...@@ -23,7 +21,7 @@ void main() { ...@@ -23,7 +21,7 @@ void main() {
testUsingContext('rasterizer and skia screenshots do not require a device', () async { testUsingContext('rasterizer and skia screenshots do not require a device', () async {
// Throw a specific exception when attempting to make a VM Service connection to // Throw a specific exception when attempting to make a VM Service connection to
// verify that we've made it past the initial validation. // verify that we've made it past the initial validation.
openChannelForTesting = (String url, {CompressionOptions compression, Logger logger}) async { openChannelForTesting = (String url, {CompressionOptions? compression, Logger? logger}) async {
expect(url, 'ws://localhost:8181/ws'); expect(url, 'ws://localhost:8181/ws');
throw Exception('dummy'); throw Exception('dummy');
}; };
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/memory.dart'; import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
...@@ -18,7 +16,7 @@ import '../../src/test_flutter_command_runner.dart'; ...@@ -18,7 +16,7 @@ import '../../src/test_flutter_command_runner.dart';
void main() { void main() {
group('shell_completion', () { group('shell_completion', () {
FakeStdio fakeStdio; late FakeStdio fakeStdio;
setUp(() { setUp(() {
Cache.disableLocking(); Cache.disableLocking();
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:async'; import 'dart:async';
import 'dart:typed_data'; import 'dart:typed_data';
...@@ -15,7 +13,6 @@ import 'package:flutter_tools/src/base/terminal.dart'; ...@@ -15,7 +13,6 @@ import 'package:flutter_tools/src/base/terminal.dart';
import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/symbolize.dart'; import 'package:flutter_tools/src/commands/symbolize.dart';
import 'package:flutter_tools/src/convert.dart'; import 'package:flutter_tools/src/convert.dart';
import 'package:meta/meta.dart';
import 'package:test/fake.dart'; import 'package:test/fake.dart';
import '../../src/common.dart'; import '../../src/common.dart';
...@@ -24,8 +21,8 @@ import '../../src/fakes.dart'; ...@@ -24,8 +21,8 @@ import '../../src/fakes.dart';
import '../../src/test_flutter_command_runner.dart'; import '../../src/test_flutter_command_runner.dart';
void main() { void main() {
MemoryFileSystem fileSystem; late MemoryFileSystem fileSystem;
FakeStdio stdio; late FakeStdio stdio;
setUpAll(() { setUpAll(() {
Cache.disableLocking(); Cache.disableLocking();
...@@ -154,9 +151,9 @@ void main() { ...@@ -154,9 +151,9 @@ void main() {
class ThrowingDwarfSymbolizationService extends Fake implements DwarfSymbolizationService { class ThrowingDwarfSymbolizationService extends Fake implements DwarfSymbolizationService {
@override @override
Future<void> decode({ Future<void> decode({
@required Stream<List<int>> input, required Stream<List<int>> input,
@required IOSink output, required IOSink output,
@required Uint8List symbols, required Uint8List symbols,
}) async { }) async {
throwToolExit('test'); throwToolExit('test');
} }
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
...@@ -12,7 +10,8 @@ import 'package:file/memory.dart'; ...@@ -12,7 +10,8 @@ import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/base/terminal.dart';
import 'package:flutter_tools/src/base/user_messages.dart';
import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/test.dart'; import 'package:flutter_tools/src/commands/test.dart';
import 'package:flutter_tools/src/device.dart'; import 'package:flutter_tools/src/device.dart';
...@@ -22,7 +21,6 @@ import 'package:flutter_tools/src/test/runner.dart'; ...@@ -22,7 +21,6 @@ import 'package:flutter_tools/src/test/runner.dart';
import 'package:flutter_tools/src/test/test_time_recorder.dart'; import 'package:flutter_tools/src/test/test_time_recorder.dart';
import 'package:flutter_tools/src/test/test_wrapper.dart'; import 'package:flutter_tools/src/test/test_wrapper.dart';
import 'package:flutter_tools/src/test/watcher.dart'; import 'package:flutter_tools/src/test/watcher.dart';
import 'package:meta/meta.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
...@@ -59,8 +57,8 @@ final String _packageConfigContents = json.encode(<String, Object>{ ...@@ -59,8 +57,8 @@ final String _packageConfigContents = json.encode(<String, Object>{
void main() { void main() {
Cache.disableLocking(); Cache.disableLocking();
MemoryFileSystem fs; late MemoryFileSystem fs;
LoggingLogger logger; late LoggingLogger logger;
setUp(() { setUp(() {
fs = MemoryFileSystem.test(); fs = MemoryFileSystem.test();
...@@ -790,51 +788,47 @@ class FakeFlutterTestRunner implements FlutterTestRunner { ...@@ -790,51 +788,47 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
FakeFlutterTestRunner(this.exitCode, [this.leastRunTime]); FakeFlutterTestRunner(this.exitCode, [this.leastRunTime]);
int exitCode; int exitCode;
Duration leastRunTime; Duration? leastRunTime;
bool lastEnableObservatoryValue; bool? lastEnableObservatoryValue;
DebuggingOptions lastDebuggingOptionsValue; late DebuggingOptions lastDebuggingOptionsValue;
@override @override
Future<int> runTests( Future<int> runTests(
TestWrapper testWrapper, TestWrapper testWrapper,
List<String> testFiles, { List<String> testFiles, {
@required DebuggingOptions debuggingOptions, required DebuggingOptions debuggingOptions,
Directory workDir,
List<String> names = const <String>[], List<String> names = const <String>[],
List<String> plainNames = const <String>[], List<String> plainNames = const <String>[],
String tags, String? tags,
String excludeTags, String? excludeTags,
bool enableObservatory = false, bool enableObservatory = false,
bool ipv6 = false, bool ipv6 = false,
bool machine = false, bool machine = false,
String precompiledDillPath, String? precompiledDillPath,
Map<String, String> precompiledDillFiles, Map<String, String>? precompiledDillFiles,
BuildMode buildMode,
bool trackWidgetCreation = false,
bool updateGoldens = false, bool updateGoldens = false,
TestWatcher watcher, TestWatcher? watcher,
int concurrency, required int? concurrency,
String testAssetDirectory, String? testAssetDirectory,
FlutterProject flutterProject, FlutterProject? flutterProject,
String icudtlPath, String? icudtlPath,
Directory coverageDirectory, Directory? coverageDirectory,
bool web = false, bool web = false,
String randomSeed, String? randomSeed,
@override List<String> extraFrontEndOptions, String? reporter,
String reporter, String? timeout,
String timeout,
bool runSkipped = false, bool runSkipped = false,
int shardIndex, int? shardIndex,
int totalShards, int? totalShards,
Device integrationTestDevice, Device? integrationTestDevice,
String integrationTestUserIdentifier, String? integrationTestUserIdentifier,
TestTimeRecorder testTimeRecorder, TestTimeRecorder? testTimeRecorder,
}) async { }) async {
lastEnableObservatoryValue = enableObservatory; lastEnableObservatoryValue = enableObservatory;
lastDebuggingOptionsValue = debuggingOptions; lastDebuggingOptionsValue = debuggingOptions;
if (leastRunTime != null) { if (leastRunTime != null) {
await Future<void>.delayed(leastRunTime); await Future<void>.delayed(leastRunTime!);
} }
return exitCode; return exitCode;
...@@ -842,7 +836,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner { ...@@ -842,7 +836,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
} }
class FakePackageTest implements TestWrapper { class FakePackageTest implements TestWrapper {
List<String> lastArgs; List<String>? lastArgs;
@override @override
Future<void> main(List<String> args) async { Future<void> main(List<String> args) async {
...@@ -857,7 +851,7 @@ class FakePackageTest implements TestWrapper { ...@@ -857,7 +851,7 @@ class FakePackageTest implements TestWrapper {
} }
class _FakeDeviceManager extends DeviceManager { class _FakeDeviceManager extends DeviceManager {
_FakeDeviceManager(this._connectedDevices); _FakeDeviceManager(this._connectedDevices) : super(logger: testLogger, terminal: Terminal.test(), userMessages: userMessages);
final List<Device> _connectedDevices; final List<Device> _connectedDevices;
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:async'; import 'dart:async';
import 'package:args/command_runner.dart'; import 'package:args/command_runner.dart';
...@@ -20,12 +18,12 @@ import '../../src/fakes.dart' show FakeFlutterVersion; ...@@ -20,12 +18,12 @@ import '../../src/fakes.dart' show FakeFlutterVersion;
import '../../src/test_flutter_command_runner.dart'; import '../../src/test_flutter_command_runner.dart';
void main() { void main() {
FileSystem fileSystem; late FileSystem fileSystem;
BufferLogger logger; late BufferLogger logger;
FakeProcessManager processManager; late FakeProcessManager processManager;
UpgradeCommand command; UpgradeCommand command;
CommandRunner<void> runner; late CommandRunner<void> runner;
FlutterVersion flutterVersion; late FlutterVersion flutterVersion;
setUpAll(() { setUpAll(() {
Cache.disableLocking(); Cache.disableLocking();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment