Unverified Commit 584e4f25 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[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.
parent bb6c1e05
This diff is collapsed.
...@@ -293,6 +293,8 @@ class FlutterDevice { ...@@ -293,6 +293,8 @@ class FlutterDevice {
fsName, fsName,
rootDirectory, rootDirectory,
osUtils: globals.os, osUtils: globals.os,
fileSystem: globals.fs,
logger: globals.logger,
); );
return devFS.create(); return devFS.create();
} }
......
...@@ -85,16 +85,6 @@ CommandRunner<void> createTestCommandRunner([ FlutterCommand command ]) { ...@@ -85,16 +85,6 @@ CommandRunner<void> createTestCommandRunner([ FlutterCommand command ]) {
return runner; 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]. /// Matcher for functions that throw [AssertionError].
final Matcher throwsAssertionError = throwsA(isA<AssertionError>()); final Matcher throwsAssertionError = throwsA(isA<AssertionError>());
......
...@@ -16,7 +16,6 @@ import 'package:flutter_tools/src/base/io.dart'; ...@@ -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/base/platform.dart';
import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/compile.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/device.dart';
import 'package:flutter_tools/src/globals.dart' as globals; import 'package:flutter_tools/src/globals.dart' as globals;
import 'package:flutter_tools/src/ios/devices.dart'; import 'package:flutter_tools/src/ios/devices.dart';
...@@ -600,31 +599,6 @@ class BasicMock { ...@@ -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 { class MockResidentCompiler extends BasicMock implements ResidentCompiler {
@override @override
void accept() { } void accept() { }
......
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