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

Unified Diff: tests/compiler/dart2js/mock_compiler.dart

Issue 326913002: Make dart2js unittests async. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 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 | « tests/compiler/dart2js/mirror_system_helper.dart ('k') | tests/compiler/dart2js/null_type_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/mock_compiler.dart
diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart
index af82c4aebc8974072e6e1c1275bf372758b0b79d..ffa014fa32108c9bb773f60af16ebf4f286ca560 100644
--- a/tests/compiler/dart2js/mock_compiler.dart
+++ b/tests/compiler/dart2js/mock_compiler.dart
@@ -263,24 +263,25 @@ class MockCompiler extends Compiler {
final Map<String, SourceFile> sourceFiles;
Node parsedTree;
- MockCompiler({String coreSource: DEFAULT_CORELIB,
- String helperSource: DEFAULT_HELPERLIB,
- String interceptorsSource: DEFAULT_INTERCEPTORSLIB,
- String isolateHelperSource: DEFAULT_ISOLATE_HELPERLIB,
- bool enableTypeAssertions: false,
- bool enableMinification: false,
- bool enableConcreteTypeInference: false,
- int maxConcreteTypeSize: 5,
- bool disableTypeInference: false,
- bool analyzeAll: false,
- bool analyzeOnly: false,
- bool emitJavaScript: true,
- bool preserveComments: false,
- // Our unit tests check code generation output that is
- // affected by inlining support.
- bool disableInlining: true,
- int this.expectedWarnings,
- int this.expectedErrors})
+ MockCompiler.internal(
+ {String coreSource: DEFAULT_CORELIB,
+ String helperSource: DEFAULT_HELPERLIB,
+ String interceptorsSource: DEFAULT_INTERCEPTORSLIB,
+ String isolateHelperSource: DEFAULT_ISOLATE_HELPERLIB,
+ bool enableTypeAssertions: false,
+ bool enableMinification: false,
+ bool enableConcreteTypeInference: false,
+ int maxConcreteTypeSize: 5,
+ bool disableTypeInference: false,
+ bool analyzeAll: false,
+ bool analyzeOnly: false,
+ bool emitJavaScript: true,
+ bool preserveComments: false,
+ // Our unit tests check code generation output that is
+ // affected by inlining support.
+ bool disableInlining: true,
+ int this.expectedWarnings,
+ int this.expectedErrors})
: sourceFiles = new Map<String, SourceFile>(),
super(enableTypeAssertions: enableTypeAssertions,
enableMinification: enableMinification,
@@ -325,6 +326,12 @@ class MockCompiler extends Compiler {
deferredLoadTask = new MockDeferredLoadTask(this);
}
+ /// Initialize the mock compiler with an empty main library.
+ Future init() {
+ // Stub for initialization.
+ return new Future.value();
+ }
+
Future runCompiler(Uri uri) {
return super.runCompiler(uri).then((result) {
if (expectedErrors != null &&
@@ -474,6 +481,12 @@ class MockCompiler extends Compiler {
? element
: new ErroneousElementX(null, null, name, container);
}
+
+ /// Create a new [MockCompiler] and apply it asynchronously to [f].
+ static Future create(f(MockCompiler compiler)) {
+ MockCompiler compiler = new MockCompiler.internal();
+ return compiler.init().then((_) => f(compiler));
+ }
}
/// A function the checks [message]. If the check fails or if [message] is
« no previous file with comments | « tests/compiler/dart2js/mirror_system_helper.dart ('k') | tests/compiler/dart2js/null_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698