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

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

Issue 1179753002: Add AnalysisDriver.onResultComputed(). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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/lib/src/task/driver.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/driver_test.dart
diff --git a/pkg/analyzer/test/src/task/driver_test.dart b/pkg/analyzer/test/src/task/driver_test.dart
index cfbbe81abbd75a5ed72a7fc6d27d86a6dba4a05c..1053691c9f37f75a491bb6e819846df26fd2e326 100644
--- a/pkg/analyzer/test/src/task/driver_test.dart
+++ b/pkg/analyzer/test/src/task/driver_test.dart
@@ -28,8 +28,8 @@ main() {
groupSep = ' | ';
runReflectiveTests(AnalysisDriverTest);
runReflectiveTests(CycleAwareDependencyWalkerTest);
- runReflectiveTests(WorkOrderTest);
runReflectiveTests(WorkItemTest);
+ runReflectiveTests(WorkOrderTest);
}
class AbstractDriverTest {
@@ -332,6 +332,28 @@ class AnalysisDriverTest extends AbstractDriverTest {
expect(analysisDriver.performAnalysisTask(), false);
}
+ test_performAnalysisTask_onResultComputed() {
+ AnalysisTarget target = new TestSource();
+ ResultDescriptor result = new ResultDescriptor('result', null);
+ TestAnalysisTask task;
+ TaskDescriptor descriptor = new TaskDescriptor(
+ 'task', (context, target) => task, (target) => {}, [result]);
+ task = new TestAnalysisTask(context, target,
+ descriptor: descriptor, value: 42);
+ WorkItem item = new WorkItem(context, target, descriptor, null);
+
+ bool streamNotified = false;
+ analysisDriver.onResultComputed(result).listen((event) {
+ streamNotified = true;
+ expect(event.context, same(context));
+ expect(event.target, same(target));
+ expect(event.descriptor, same(result));
+ expect(event.value, 42);
+ });
+ analysisDriver.performWorkItem(item);
+ expect(streamNotified, isTrue);
+ }
+
test_performWorkItem_exceptionInTask() {
AnalysisTarget target = new TestSource();
ResultDescriptor result = new ResultDescriptor('result', null);
« no previous file with comments | « pkg/analyzer/lib/src/task/driver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698