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

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

Issue 17759007: First pass at asynchronous input loading in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 7 years, 3 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
Index: tests/compiler/dart2js/mirror_helper_test.dart
diff --git a/tests/compiler/dart2js/mirror_helper_test.dart b/tests/compiler/dart2js/mirror_helper_test.dart
index ba3b9aff64c5471f08d522f1f92753110f9e5c70..b2f2b297df1a6c4df6208003d80b52d4e875454e 100644
--- a/tests/compiler/dart2js/mirror_helper_test.dart
+++ b/tests/compiler/dart2js/mirror_helper_test.dart
@@ -3,6 +3,8 @@
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
+import 'dart:async';
+import "package:async_helper/async_helper.dart";
import 'memory_compiler.dart' show compilerFor;
import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart' show
Compiler;
@@ -35,7 +37,7 @@ main() {
testWithoutMirrorRenaming(minify: false);
}
-Compiler runCompiler({useMirrorHelperLibrary: false, minify: false}) {
+Future<Compiler> runCompiler({useMirrorHelperLibrary: false, minify: false}) {
List<String> options = ['--output-type=dart'];
if (minify) {
options.add('--minify');
@@ -43,42 +45,45 @@ Compiler runCompiler({useMirrorHelperLibrary: false, minify: false}) {
Compiler compiler = compilerFor(MEMORY_SOURCE_FILES, options: options);
DartBackend backend = compiler.backend;
backend.useMirrorHelperLibrary = useMirrorHelperLibrary;
- compiler.runCompiler(Uri.parse('memory:main.dart'));
- return compiler;
+ return
+ compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) => compiler);
}
void testWithMirrorRenaming({bool minify}) {
- Compiler compiler = runCompiler(useMirrorHelperLibrary: true, minify: minify);
+ asyncTest(() => runCompiler(useMirrorHelperLibrary: true, minify: minify).
+ then((Compiler compiler) {
- DartBackend backend = compiler.backend;
- MirrorRenamer mirrorRenamer = backend.mirrorRenamer;
- Map<Node, String> renames = backend.renames;
- Map<LibraryElement, String> imports = backend.imports;
+ DartBackend backend = compiler.backend;
+ MirrorRenamer mirrorRenamer = backend.mirrorRenamer;
+ Map<Node, String> renames = backend.renames;
+ Map<LibraryElement, String> imports = backend.imports;
- Node getNameFunctionNode =
- backend.memberNodes.values.first.first.body.statements.nodes.head;
+ Node getNameFunctionNode =
+ backend.memberNodes.values.first.first.body.statements.nodes.head;
- Expect.equals(renames[mirrorRenamer.mirrorHelperGetNameFunctionNode.name],
- renames[getNameFunctionNode.expression.selector]);
- Expect.equals("",
- renames[getNameFunctionNode.expression.receiver]);
- Expect.equals(1, imports.keys.length);
+ Expect.equals(renames[mirrorRenamer.mirrorHelperGetNameFunctionNode.name],
+ renames[getNameFunctionNode.expression.selector]);
+ Expect.equals("",
+ renames[getNameFunctionNode.expression.receiver]);
+ Expect.equals(1, imports.keys.length);
+ }));
}
void testWithoutMirrorRenaming({bool minify}) {
- Compiler compiler =
- runCompiler(useMirrorHelperLibrary: false, minify: minify);
+ asyncTest(() => runCompiler(useMirrorHelperLibrary: false, minify: minify).
+ then((Compiler compiler) {
- DartBackend backend = compiler.backend;
- Map<Node, String> renames = backend.renames;
- Map<LibraryElement, String> imports = backend.imports;
+ DartBackend backend = compiler.backend;
+ Map<Node, String> renames = backend.renames;
+ Map<LibraryElement, String> imports = backend.imports;
- Node getNameFunctionNode =
- backend.memberNodes.values.first.first.body.statements.nodes.head;
+ Node getNameFunctionNode =
+ backend.memberNodes.values.first.first.body.statements.nodes.head;
- Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.selector));
- Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.receiver));
- Expect.equals(1, imports.keys.length);
+ Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.selector));
+ Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.receiver));
+ Expect.equals(1, imports.keys.length);
+ }));
}
const MEMORY_SOURCE_FILES = const <String, String> {

Powered by Google App Engine
This is Rietveld 408576698