Move FakeOperatingSystemUtils from context.dart to fakes.dart (#80916)

This commit is contained in:
Jenn Magder
2021-04-22 10:44:02 -07:00
committed by GitHub
parent 7750482308
commit a99fba01f1
14 changed files with 162 additions and 124 deletions

View File

@@ -296,46 +296,6 @@ class MockSimControl extends Mock implements SimControl {
}
}
class FakeOperatingSystemUtils implements OperatingSystemUtils {
FakeOperatingSystemUtils({this.hostPlatform = HostPlatform.linux_x64});
@override
ProcessResult makeExecutable(File file) => null;
@override
HostPlatform hostPlatform = HostPlatform.linux_x64;
@override
void chmod(FileSystemEntity entity, String mode) { }
@override
File which(String execName) => null;
@override
List<File> whichAll(String execName) => <File>[];
@override
File makePipe(String path) => null;
@override
void unzip(File file, Directory targetDirectory) { }
@override
void unpack(File gzippedTarFile, Directory targetDirectory) { }
@override
Stream<List<int>> gzipLevel1Stream(Stream<List<int>> stream) => stream;
@override
String get name => 'fake OS name and version';
@override
String get pathVarSeparator => ';';
@override
Future<int> findFreePort({bool ipv6 = false}) async => 12345;
}
class MockIOSSimulatorUtils extends Mock implements IOSSimulatorUtils {}
class FakeXcodeProjectInterpreter implements XcodeProjectInterpreter {

View File

@@ -15,6 +15,7 @@ import 'package:flutter_tools/src/convert.dart';
import 'package:flutter_tools/src/features.dart';
import 'package:flutter_tools/src/ios/plist_parser.dart';
import 'package:flutter_tools/src/version.dart';
import 'package:test/fake.dart';
/// Environment with DYLD_LIBRARY_PATH=/path/to/libraries
class FakeDyldEnvironmentArtifact extends ArtifactSet {
@@ -493,3 +494,40 @@ class FakeStatusLogger extends DelegatingLogger {
int progressIndicatorPadding = kDefaultStatusPadding,
}) => status;
}
class FakeOperatingSystemUtils extends Fake implements OperatingSystemUtils {
FakeOperatingSystemUtils({this.hostPlatform = HostPlatform.linux_x64});
@override
void makeExecutable(File file) { }
@override
HostPlatform hostPlatform = HostPlatform.linux_x64;
@override
void chmod(FileSystemEntity entity, String mode) { }
@override
File? which(String execName) => null;
@override
List<File> whichAll(String execName) => <File>[];
@override
void unzip(File file, Directory targetDirectory) { }
@override
void unpack(File gzippedTarFile, Directory targetDirectory) { }
@override
Stream<List<int>> gzipLevel1Stream(Stream<List<int>> stream) => stream;
@override
String get name => 'fake OS name and version';
@override
String get pathVarSeparator => ';';
@override
Future<int> findFreePort({bool ipv6 = false}) async => 12345;
}