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

Unified Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 2132073003: Validate cache consistency asynchronously. Compute modification times of physical files in a separa… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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
Index: pkg/analyzer/test/src/context/context_test.dart
diff --git a/pkg/analyzer/test/src/context/context_test.dart b/pkg/analyzer/test/src/context/context_test.dart
index 2ec73ef24439d17e96e4cf5c4821faafd4476335..2816308a63d87008fc6ae6b20856536cf6da4b2e 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -401,7 +401,6 @@ main() {
expect(context.getResolvedCompilationUnit2(source, source), unit);
// remove overlay
context.setContents(source, null);
- context.validateCacheConsistency();
_analyzeAll_assertFinished();
expect(context.getResolvedCompilationUnit2(source, source), unit);
}
@@ -434,6 +433,51 @@ import 'libB.dart';''';
});
}
+ void test_cacheConsistencyValidator_computed() {
+ CacheConsistencyValidator validator = context.cacheConsistencyValidator;
+ // Add sources.
+ MemoryResourceProvider resourceProvider = new MemoryResourceProvider();
+ String path1 = '/test1.dart';
+ String path2 = '/test2.dart';
+ Source source1 = resourceProvider.newFile(path1, '// 1-1').createSource();
+ Source source2 = resourceProvider.newFile(path2, '// 2-1').createSource();
+ context.applyChanges(
+ new ChangeSet()..addedSource(source1)..addedSource(source2));
+ // Same modification times.
+ expect(
+ validator.sourceModificationTimesComputed([source1, source2],
+ [source1.modificationStamp, source2.modificationStamp]),
+ isFalse);
+ // Different modification times.
+ expect(
+ validator.sourceModificationTimesComputed([source1, source2],
+ [source1.modificationStamp + 1, source2.modificationStamp]),
+ isTrue);
+ }
+
+ void test_cacheConsistencyValidator_getSources() {
+ CacheConsistencyValidator validator = context.cacheConsistencyValidator;
+ // Add sources.
+ MemoryResourceProvider resourceProvider = new MemoryResourceProvider();
+ String path1 = '/test1.dart';
+ String path2 = '/test2.dart';
+ Source source1 = resourceProvider.newFile(path1, '// 1-1').createSource();
+ Source source2 = resourceProvider.newFile(path2, '// 2-1').createSource();
+ context.applyChanges(
+ new ChangeSet()..addedSource(source1)..addedSource(source2));
+ // No overlays.
+ expect(validator.getSourcesToComputeModificationTimes(),
+ unorderedEquals([source1, source2]));
+ // Add an overlay.
+ context.setContents(source1, '// 1-2');
+ expect(validator.getSourcesToComputeModificationTimes(),
+ unorderedEquals([source2]));
+ // Remove an overlay.
+ context.setContents(source1, null);
+ expect(validator.getSourcesToComputeModificationTimes(),
+ unorderedEquals([source1, source2]));
+ }
+
void test_computeDocumentationComment_class_block() {
String comment = "/** Comment */";
Source source = addSource(

Powered by Google App Engine
This is Rietveld 408576698