forked from firka/flutter
This reverts commit 59a6ba7cf8.
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
// 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:file/memory.dart';
|
||||
@@ -16,6 +18,7 @@ import 'package:flutter_tools/src/device.dart';
|
||||
import 'package:flutter_tools/src/device_port_forwarder.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:test/fake.dart';
|
||||
|
||||
import '../src/common.dart';
|
||||
@@ -47,8 +50,8 @@ void main() {
|
||||
testWithoutContext('Install checks always return true', () async {
|
||||
final FakeDesktopDevice device = setUpDesktopDevice();
|
||||
|
||||
expect(await device.isAppInstalled(FakeApplicationPackage()), true);
|
||||
expect(await device.isLatestBuildInstalled(FakeApplicationPackage()), true);
|
||||
expect(await device.isAppInstalled(null), true);
|
||||
expect(await device.isLatestBuildInstalled(null), true);
|
||||
expect(device.category, Category.desktop);
|
||||
});
|
||||
|
||||
@@ -86,7 +89,7 @@ void main() {
|
||||
),
|
||||
]);
|
||||
final FakeDesktopDevice device = setUpDesktopDevice(processManager: processManager, fileSystem: fileSystem);
|
||||
final String? executableName = device.executablePathForDevice(FakeApplicationPackage(), BuildMode.debug);
|
||||
final String executableName = device.executablePathForDevice(null, BuildMode.debug);
|
||||
fileSystem.file(executableName).writeAsStringSync('\n');
|
||||
final FakeApplicationPackage package = FakeApplicationPackage();
|
||||
final LaunchResult result = await device.startApp(
|
||||
@@ -245,7 +248,7 @@ void main() {
|
||||
testWithoutContext('createDevFSWriter returns a LocalDevFSWriter', () {
|
||||
final FakeDesktopDevice device = setUpDesktopDevice();
|
||||
|
||||
expect(device.createDevFSWriter(FakeApplicationPackage(), ''), isA<LocalDevFSWriter>());
|
||||
expect(device.createDevFSWriter(null, ''), isA<LocalDevFSWriter>());
|
||||
});
|
||||
|
||||
testWithoutContext('startApp supports dartEntrypointArgs', () async {
|
||||
@@ -305,10 +308,10 @@ void main() {
|
||||
}
|
||||
|
||||
FakeDesktopDevice setUpDesktopDevice({
|
||||
FileSystem? fileSystem,
|
||||
Logger? logger,
|
||||
ProcessManager? processManager,
|
||||
OperatingSystemUtils? operatingSystemUtils,
|
||||
FileSystem fileSystem,
|
||||
Logger logger,
|
||||
ProcessManager processManager,
|
||||
OperatingSystemUtils operatingSystemUtils,
|
||||
bool nullExecutablePathForDevice = false,
|
||||
}) {
|
||||
return FakeDesktopDevice(
|
||||
@@ -323,11 +326,11 @@ FakeDesktopDevice setUpDesktopDevice({
|
||||
/// A trivial subclass of DesktopDevice for testing the shared functionality.
|
||||
class FakeDesktopDevice extends DesktopDevice {
|
||||
FakeDesktopDevice({
|
||||
required ProcessManager processManager,
|
||||
required Logger logger,
|
||||
required FileSystem fileSystem,
|
||||
required OperatingSystemUtils operatingSystemUtils,
|
||||
this.nullExecutablePathForDevice = false,
|
||||
@required ProcessManager processManager,
|
||||
@required Logger logger,
|
||||
@required FileSystem fileSystem,
|
||||
@required OperatingSystemUtils operatingSystemUtils,
|
||||
this.nullExecutablePathForDevice,
|
||||
}) : super(
|
||||
'dummy',
|
||||
platformType: PlatformType.linux,
|
||||
@@ -339,10 +342,10 @@ class FakeDesktopDevice extends DesktopDevice {
|
||||
);
|
||||
|
||||
/// The [mainPath] last passed to [buildForDevice].
|
||||
String? lastBuiltMainPath;
|
||||
String lastBuiltMainPath;
|
||||
|
||||
/// The [buildInfo] last passed to [buildForDevice].
|
||||
BuildInfo? lastBuildInfo;
|
||||
BuildInfo lastBuildInfo;
|
||||
|
||||
final bool nullExecutablePathForDevice;
|
||||
|
||||
@@ -361,8 +364,8 @@ class FakeDesktopDevice extends DesktopDevice {
|
||||
@override
|
||||
Future<void> buildForDevice(
|
||||
ApplicationPackage package, {
|
||||
String? mainPath,
|
||||
BuildInfo? buildInfo,
|
||||
String mainPath,
|
||||
BuildInfo buildInfo,
|
||||
}) async {
|
||||
lastBuiltMainPath = mainPath;
|
||||
lastBuildInfo = buildInfo;
|
||||
@@ -370,7 +373,7 @@ class FakeDesktopDevice extends DesktopDevice {
|
||||
|
||||
// Dummy implementation that just returns the build mode name.
|
||||
@override
|
||||
String? executablePathForDevice(ApplicationPackage package, BuildMode buildMode) {
|
||||
String executablePathForDevice(ApplicationPackage package, BuildMode buildMode) {
|
||||
if (nullExecutablePathForDevice) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user