Index: pkg/front_end/test/src/incremental/file_state_test.dart |
diff --git a/pkg/front_end/test/src/incremental/file_state_test.dart b/pkg/front_end/test/src/incremental/file_state_test.dart |
index 2a4b6546954d61702341ef497598a502364650ba..d4216889f9f78d1421e0b1053175f6e076040135 100644 |
--- a/pkg/front_end/test/src/incremental/file_state_test.dart |
+++ b/pkg/front_end/test/src/incremental/file_state_test.dart |
@@ -25,13 +25,17 @@ class FileSystemStateTest { |
FileSystemState fsState; |
Uri _coreUri; |
+ List<Uri> _newFileUris = <Uri>[]; |
void setUp() { |
Map<String, Uri> dartLibraries = createSdkFiles(fileSystem); |
uriTranslator.dartLibraries.addAll(dartLibraries); |
_coreUri = Uri.parse('dart:core'); |
expect(_coreUri, isNotNull); |
- fsState = new FileSystemState(fileSystem, uriTranslator, <int>[]); |
+ fsState = new FileSystemState(fileSystem, uriTranslator, <int>[], (uri) { |
+ _newFileUris.add(uri); |
+ return new Future.value(); |
+ }); |
} |
test_apiSignature() async { |
@@ -232,6 +236,36 @@ export "c.dart" show A, B, C, D hide C show A, D; |
} |
} |
+ test_newFileListener() async { |
+ var a = writeFile('/a.dart', ''); |
+ var b = writeFile('/b.dart', ''); |
+ var c = writeFile( |
+ '/c.dart', |
+ r''' |
+import 'a.dart'; |
+'''); |
+ |
+ FileState cFile = await fsState.getFile(c); |
+ |
+ // c.dart uses c.dart and a.dart, but not b.dart yet. |
+ expect(_newFileUris, contains(c)); |
+ expect(_newFileUris, contains(a)); |
+ expect(_newFileUris, isNot(contains(b))); |
+ _newFileUris.clear(); |
+ |
+ // Update c.dart to use b.dart too. |
+ writeFile( |
+ '/c.dart', |
+ r''' |
+import 'a.dart'; |
+import 'b.dart'; |
+'''); |
+ await cFile.refresh(); |
+ |
+ // b.dart is the only new file. |
+ expect(_newFileUris, [b]); |
+ } |
+ |
test_topologicalOrder_cycleBeforeTarget() async { |
var aUri = _writeFileDirectives('/a.dart'); |
var bUri = _writeFileDirectives('/b.dart', imports: ['c.dart']); |