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

Unified Diff: packages/analyzer/test/src/task/test_support.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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 | « packages/analyzer/test/src/task/test_all.dart ('k') | packages/analyzer/test/src/test_all.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/analyzer/test/src/task/test_support.dart
diff --git a/packages/analyzer/test/src/task/test_support.dart b/packages/analyzer/test/src/task/test_support.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e68952b9e13fb6520b45cbd765ffd23847a4ea33
--- /dev/null
+++ b/packages/analyzer/test/src/task/test_support.dart
@@ -0,0 +1,63 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library test.src.task.test_support;
+
+import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask;
+import 'package:analyzer/src/generated/java_engine.dart';
+import 'package:analyzer/task/model.dart';
+
+/**
+ * A configurable analysis task that can be used by tests.
+ */
+class TestAnalysisTask extends AnalysisTask {
+ /**
+ * The descriptor describing this task.
+ */
+ TaskDescriptor descriptor;
+
+ /**
+ * The exception that is to be "thrown" by this task.
+ */
+ CaughtException exception;
+
+ /**
+ * The results whose values are to be provided as outputs from this task.
+ */
+ List<ResultDescriptor> results;
+
+ /**
+ * The next value that is to be used for a result.
+ */
+ int value;
+
+ @override
+ final bool handlesDependencyCycles;
+
+ TestAnalysisTask(AnalysisContext context, AnalysisTarget target,
+ {this.descriptor,
+ this.exception,
+ this.handlesDependencyCycles: false,
+ this.results,
+ this.value: 1})
+ : super(context, target);
+
+ @override
+ String get description => 'Test task';
+
+ @override
+ internalPerform() {
+ if (exception != null) {
+ caughtException = exception;
+ } else if (results != null) {
+ for (ResultDescriptor result in results) {
+ outputs[result] = value++;
+ }
+ } else if (descriptor != null) {
+ for (ResultDescriptor result in descriptor.results) {
+ outputs[result] = value++;
+ }
+ }
+ }
+}
« no previous file with comments | « packages/analyzer/test/src/task/test_all.dart ('k') | packages/analyzer/test/src/test_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698