Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Unified Diff: pkg/front_end/test/memory_file_system_test.dart

Issue 2852463004: Revert "Extend file-system abstraction with a couple methods, remove context." (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/test/dependency_grapher_test.dart ('k') | pkg/front_end/test/physical_file_system_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/test/memory_file_system_test.dart
diff --git a/pkg/front_end/test/memory_file_system_test.dart b/pkg/front_end/test/memory_file_system_test.dart
index 1f7d6c3f9c4c439ef545cf4849f5cfdcbc6ed7f6..365cd43af7646e6dd85e65debe207a275a713eec 100644
--- a/pkg/front_end/test/memory_file_system_test.dart
+++ b/pkg/front_end/test/memory_file_system_test.dart
@@ -46,7 +46,7 @@ class FileTest extends _BaseTestNative {
}
test_path() {
- expect(file.uri, context.toUri(path));
+ expect(file.uri, fileSystem.context.toUri(path));
}
test_readAsBytes_badUtf8() async {
@@ -86,32 +86,6 @@ class FileTest extends _BaseTestNative {
expect(await file.readAsString(), '\u20ac');
}
- test_exists_doesNotExist() async {
- expect(await file.exists(), false);
- }
-
- test_exists_exists() async {
- file.writeAsStringSync('x');
- expect(await file.exists(), true);
- }
-
- test_lastModified_doesNotExist() async {
- expect(file.lastModified(), throwsException);
- }
-
- test_lastModified_increasesOnEachChange() async {
- file.writeAsStringSync('x');
- var mod1 = await file.lastModified();
- file.writeAsStringSync('y');
- var mod2 = await file.lastModified();
- expect(mod2.isAfter(mod1), isTrue);
-
- var file2 = entityForPath(join(tempPath, 'file2.txt'));
- file2.writeAsStringSync('z');
- var mod3 = await file2.lastModified();
- expect(mod3.isAfter(mod2), isTrue);
- }
-
test_writeAsBytesSync_modifyAfterRead() async {
file.writeAsBytesSync([1]);
(await file.readAsBytes())[0] = 2;
@@ -148,7 +122,7 @@ abstract class MemoryFileSystemTestMixin extends _BaseTest {
setUp() {
super.setUp();
- tempUri = context.toUri(tempPath);
+ tempUri = fileSystem.context.toUri(tempPath);
}
test_currentDirectory_trailingSlash() {
@@ -159,11 +133,15 @@ abstract class MemoryFileSystemTestMixin extends _BaseTest {
var path = fileSystem.currentDirectory.path;
var currentDirectoryWithoutSlash = fileSystem.currentDirectory
.replace(path: path.substring(0, path.length - 1));
- expect(new MemoryFileSystem(currentDirectoryWithoutSlash).currentDirectory,
+ expect(
+ new MemoryFileSystem(fileSystem.context, currentDirectoryWithoutSlash)
+ .currentDirectory,
fileSystem.currentDirectory);
// If the currentDirectory supplied to the MemoryFileSystem constructor
// already has a trailing slash, no further trailing slash should be added.
- expect(new MemoryFileSystem(fileSystem.currentDirectory).currentDirectory,
+ expect(
+ new MemoryFileSystem(fileSystem.context, fileSystem.currentDirectory)
+ .currentDirectory,
fileSystem.currentDirectory);
}
@@ -235,13 +213,12 @@ class MemoryFileSystemTestWindows extends _BaseTestWindows
with MemoryFileSystemTestMixin {}
abstract class _BaseTest {
- pathos.Context get context;
MemoryFileSystem get fileSystem;
String get tempPath;
MemoryFileSystemEntity entityForPath(String path) =>
- fileSystem.entityForUri(context.toUri(path));
+ fileSystem.entityForUri(fileSystem.context.toUri(path));
String join(String path1, String path2, [String path3, String path4]);
@@ -249,7 +226,6 @@ abstract class _BaseTest {
}
class _BaseTestNative extends _BaseTest {
- final pathos.Context context = pathos.context;
MemoryFileSystem fileSystem;
String tempPath;
@@ -258,12 +234,12 @@ class _BaseTestNative extends _BaseTest {
setUp() {
tempPath = pathos.join(io.Directory.systemTemp.path, 'test_file_system');
- fileSystem = new MemoryFileSystem(pathos.toUri(io.Directory.current.path));
+ fileSystem = new MemoryFileSystem(
+ pathos.context, pathos.toUri(io.Directory.current.path));
}
}
class _BaseTestPosix extends _BaseTest {
- final pathos.Context context = pathos.posix;
MemoryFileSystem fileSystem;
String tempPath;
@@ -272,12 +248,11 @@ class _BaseTestPosix extends _BaseTest {
void setUp() {
tempPath = '/test_file_system';
- fileSystem = new MemoryFileSystem(Uri.parse('file:///cwd'));
+ fileSystem = new MemoryFileSystem(pathos.posix, Uri.parse('file:///cwd'));
}
}
class _BaseTestWindows extends _BaseTest {
- final pathos.Context context = pathos.windows;
MemoryFileSystem fileSystem;
String tempPath;
@@ -286,6 +261,7 @@ class _BaseTestWindows extends _BaseTest {
void setUp() {
tempPath = r'c:\test_file_system';
- fileSystem = new MemoryFileSystem(Uri.parse('file:///c:/cwd'));
+ fileSystem =
+ new MemoryFileSystem(pathos.windows, Uri.parse('file:///c:/cwd'));
}
}
« no previous file with comments | « pkg/front_end/test/dependency_grapher_test.dart ('k') | pkg/front_end/test/physical_file_system_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698