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

Unified Diff: pkg/analyzer/test/src/task/dart_work_manager_test.dart

Issue 1138853003: Create ChangeNotice(s) and set parsed/resolved units. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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/analyzer/test/generated/engine_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/dart_work_manager_test.dart
diff --git a/pkg/analyzer/test/src/task/dart_work_manager_test.dart b/pkg/analyzer/test/src/task/dart_work_manager_test.dart
index ad3d3379684c9d6f9b905762af0cfd6e309365f3..f04711f609bbaa317a631fe96fa7758f261d38fb 100644
--- a/pkg/analyzer/test/src/task/dart_work_manager_test.dart
+++ b/pkg/analyzer/test/src/task/dart_work_manager_test.dart
@@ -5,10 +5,12 @@
library test.src.task.dart_work_manager_test;
import 'package:analyzer/src/context/cache.dart';
+import 'package:analyzer/src/generated/ast.dart';
import 'package:analyzer/src/generated/engine.dart'
- show CacheState, InternalAnalysisContext;
+ show CacheState, ChangeNoticeImpl, InternalAnalysisContext;
import 'package:analyzer/src/generated/java_engine.dart' show CaughtException;
import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/generated/testing/ast_factory.dart';
import 'package:analyzer/src/task/dart.dart';
import 'package:analyzer/src/task/dart_work_manager.dart';
import 'package:analyzer/src/task/driver.dart';
@@ -281,20 +283,6 @@ class DartWorkManagerTest {
expect(manager.getNextResultPriority(), WorkOrderPriority.NONE);
}
- void test_resultsComputed_isLibrary() {
- manager.unknownSourceQueue.addAll([source1, source2, source3]);
- manager.resultsComputed(source2, {SOURCE_KIND: SourceKind.LIBRARY});
- expect_librarySourceQueue([source2]);
- expect_unknownSourceQueue([source1, source3]);
- }
-
- void test_resultsComputed_isPart() {
- manager.unknownSourceQueue.addAll([source1, source2, source3]);
- manager.resultsComputed(source2, {SOURCE_KIND: SourceKind.PART});
- expect_librarySourceQueue([]);
- expect_unknownSourceQueue([source1, source3]);
- }
-
void test_resultsComputed_noSourceKind() {
manager.unknownSourceQueue.addAll([source1, source2]);
manager.resultsComputed(source1, {});
@@ -308,6 +296,35 @@ class DartWorkManagerTest {
expect_librarySourceQueue([]);
expect_unknownSourceQueue([source1, source2]);
}
+
+ void test_resultsComputed_parsedUnit() {
+ CompilationUnit unit = AstFactory.compilationUnit();
+ manager.resultsComputed(source1, {PARSED_UNIT: unit});
+ expect(context.getNotice(source1).parsedDartUnit, unit);
+ expect(context.getNotice(source1).resolvedDartUnit, isNull);
+ }
+
+ void test_resultsComputed_resolvedUnit() {
+ CompilationUnit unit = AstFactory.compilationUnit();
+ manager.resultsComputed(
+ new LibrarySpecificUnit(source1, source2), {RESOLVED_UNIT: unit});
+ expect(context.getNotice(source2).parsedDartUnit, isNull);
+ expect(context.getNotice(source2).resolvedDartUnit, unit);
+ }
+
+ void test_resultsComputed_sourceKind_isLibrary() {
+ manager.unknownSourceQueue.addAll([source1, source2, source3]);
+ manager.resultsComputed(source2, {SOURCE_KIND: SourceKind.LIBRARY});
+ expect_librarySourceQueue([source2]);
+ expect_unknownSourceQueue([source1, source3]);
+ }
+
+ void test_resultsComputed_sourceKind_isPart() {
+ manager.unknownSourceQueue.addAll([source1, source2, source3]);
+ manager.resultsComputed(source2, {SOURCE_KIND: SourceKind.PART});
+ expect_librarySourceQueue([]);
+ expect_unknownSourceQueue([source1, source3]);
+ }
}
class _InternalAnalysisContextMock extends TypedMock
@@ -315,6 +332,8 @@ class _InternalAnalysisContextMock extends TypedMock
@override
AnalysisCache analysisCache;
+ Map<Source, ChangeNoticeImpl> _pendingNotices = <Source, ChangeNoticeImpl>{};
+
_InternalAnalysisContextMock() {
analysisCache = new AnalysisCache([new UniversalCachePartition(this)]);
}
@@ -329,5 +348,11 @@ class _InternalAnalysisContextMock extends TypedMock
return entry;
}
+ @override
+ ChangeNoticeImpl getNotice(Source source) {
+ return _pendingNotices.putIfAbsent(
+ source, () => new ChangeNoticeImpl(source));
+ }
+
noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}
« no previous file with comments | « pkg/analyzer/test/generated/engine_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698