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

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

Issue 1136543006: Prioritize scheduling analysis for priority sources. (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/src/context/context_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 ecbcaa9bbdaae9722c5f997c218c839fe4571f16..ad3d3379684c9d6f9b905762af0cfd6e309365f3 100644
--- a/pkg/analyzer/test/src/task/dart_work_manager_test.dart
+++ b/pkg/analyzer/test/src/task/dart_work_manager_test.dart
@@ -123,6 +123,44 @@ class DartWorkManagerTest {
expect_librarySourceQueue([source1, source3]);
}
+ void test_applyPriorityTargets_library() {
+ entry1.setValue(SOURCE_KIND, SourceKind.LIBRARY, []);
+ entry2.setValue(SOURCE_KIND, SourceKind.LIBRARY, []);
+ entry3.setValue(SOURCE_KIND, SourceKind.LIBRARY, []);
+ manager.priorityResultQueue
+ .add(new TargetedResult(source1, LIBRARY_ERRORS_READY));
+ manager.priorityResultQueue
+ .add(new TargetedResult(source2, LIBRARY_ERRORS_READY));
+ // -source1 +source3
+ manager.applyPriorityTargets([source2, source3]);
+ expect(manager.priorityResultQueue, unorderedEquals([
+ new TargetedResult(source2, LIBRARY_ERRORS_READY),
+ new TargetedResult(source3, LIBRARY_ERRORS_READY)
+ ]));
+ // get next request
+ TargetedResult request = manager.getNextResult();
+ expect(request.target, source2);
+ expect(request.result, LIBRARY_ERRORS_READY);
+ }
+
+ void test_applyPriorityTargets_part() {
+ entry1.setValue(SOURCE_KIND, SourceKind.PART, []);
+ entry2.setValue(SOURCE_KIND, SourceKind.LIBRARY, []);
+ entry3.setValue(SOURCE_KIND, SourceKind.LIBRARY, []);
+ // +source2 +source3
+ when(context.getLibrariesContaining(source1))
+ .thenReturn([source2, source3]);
+ manager.applyPriorityTargets([source1]);
+ expect(manager.priorityResultQueue, unorderedEquals([
+ new TargetedResult(source2, LIBRARY_ERRORS_READY),
+ new TargetedResult(source3, LIBRARY_ERRORS_READY)
+ ]));
+ // get next request
+ TargetedResult request = manager.getNextResult();
+ expect(request.target, source2);
+ expect(request.result, LIBRARY_ERRORS_READY);
+ }
+
void test_getNextResult_hasLibraries_firstIsError() {
entry1.setErrorState(caughtException, [LIBRARY_ERRORS_READY]);
manager.librarySourceQueue.addAll([source1, source2]);
@@ -153,11 +191,6 @@ class DartWorkManagerTest {
expect_librarySourceQueue([source2]);
}
- void test_getNextResult_nothingToDo() {
- TargetedResult request = manager.getNextResult();
- expect(request, isNull);
- }
-
void test_getNextResult_hasPriority_firstIsError() {
manager.addPriorityResult(source1, SOURCE_KIND);
manager.addPriorityResult(source2, SOURCE_KIND);
@@ -224,6 +257,11 @@ class DartWorkManagerTest {
expect_unknownSourceQueue([source2]);
}
+ void test_getNextResult_nothingToDo() {
+ TargetedResult request = manager.getNextResult();
+ expect(request, isNull);
+ }
+
void test_getNextResultPriority_hasLibrary() {
manager.librarySourceQueue.addAll([source1]);
expect(manager.getNextResultPriority(), WorkOrderPriority.NORMAL);
« no previous file with comments | « pkg/analyzer/test/src/context/context_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698