[flutter_tools] cleanup to devfs Operations (#58332)
removes globals from devFS operations and cleans up testing to be context free. Removes unused and unnecessarily temp directory in testing.
This commit is contained in:
@@ -85,16 +85,6 @@ CommandRunner<void> createTestCommandRunner([ FlutterCommand command ]) {
|
||||
return runner;
|
||||
}
|
||||
|
||||
/// Updates [path] to have a modification time [seconds] from now.
|
||||
void updateFileModificationTime(
|
||||
String path,
|
||||
DateTime baseTime,
|
||||
int seconds,
|
||||
) {
|
||||
final DateTime modificationTime = baseTime.add(Duration(seconds: seconds));
|
||||
globals.fs.file(path).setLastModifiedSync(modificationTime);
|
||||
}
|
||||
|
||||
/// Matcher for functions that throw [AssertionError].
|
||||
final Matcher throwsAssertionError = throwsA(isA<AssertionError>());
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import 'package:flutter_tools/src/base/io.dart';
|
||||
import 'package:flutter_tools/src/base/platform.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/compile.dart';
|
||||
import 'package:flutter_tools/src/devfs.dart';
|
||||
import 'package:flutter_tools/src/device.dart';
|
||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
||||
import 'package:flutter_tools/src/ios/devices.dart';
|
||||
@@ -600,31 +599,6 @@ class BasicMock {
|
||||
}
|
||||
}
|
||||
|
||||
class MockDevFSOperations extends BasicMock implements DevFSOperations {
|
||||
Map<Uri, DevFSContent> devicePathToContent = <Uri, DevFSContent>{};
|
||||
|
||||
@override
|
||||
Future<Uri> create(String fsName) async {
|
||||
messages.add('create $fsName');
|
||||
return Uri.parse('file:///$fsName');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<dynamic> destroy(String fsName) async {
|
||||
messages.add('destroy $fsName');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<dynamic> writeFile(String fsName, Uri deviceUri, DevFSContent content) async {
|
||||
String message = 'writeFile $fsName $deviceUri';
|
||||
if (content is DevFSFileContent) {
|
||||
message += ' ${content.file.path}';
|
||||
}
|
||||
messages.add(message);
|
||||
devicePathToContent[deviceUri] = content;
|
||||
}
|
||||
}
|
||||
|
||||
class MockResidentCompiler extends BasicMock implements ResidentCompiler {
|
||||
@override
|
||||
void accept() { }
|
||||
|
||||
Reference in New Issue
Block a user