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

Unified Diff: tests/compiler/dart2js/mirror_helper_rename_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
« no previous file with comments | « tests/compiler/dart2js/metadata_test.dart ('k') | tests/compiler/dart2js/mirror_helper_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/mirror_helper_rename_test.dart
diff --git a/tests/compiler/dart2js/mirror_helper_rename_test.dart b/tests/compiler/dart2js/mirror_helper_rename_test.dart
index 67f1a956312c237dcce2a5d66c041c9f079b3f4e..9b82355e9972dfeab80075e9dd90140af445897b 100644
--- a/tests/compiler/dart2js/mirror_helper_rename_test.dart
+++ b/tests/compiler/dart2js/mirror_helper_rename_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;
@@ -26,7 +28,7 @@ main() {
testWithoutMirrorHelperLibrary(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');
@@ -34,58 +36,59 @@ 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 testWithMirrorHelperLibrary({bool minify}) {
- Compiler compiler = runCompiler(useMirrorHelperLibrary: true, minify: minify);
-
- DartBackend backend = compiler.backend;
- MirrorRenamer mirrorRenamer = backend.mirrorRenamer;
- Map<Node, String> renames = backend.renames;
- Map<String, SourceString> symbols = mirrorRenamer.symbols;
-
- Expect.isFalse(null == backend.mirrorHelperLibrary);
- Expect.isFalse(null == backend.mirrorHelperGetNameFunction);
-
- for (Node n in renames.keys) {
- if (symbols.containsKey(renames[n])) {
- if(n.toString() == 'getName') {
- Expect.equals(
- const SourceString(MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION),
- symbols[renames[n]]);
- } else {
- Expect.equals(n.toString(), symbols[renames[n]].stringValue);
+ asyncTest(() => runCompiler(useMirrorHelperLibrary: true, minify: minify).
+ then((Compiler compiler) {
+ DartBackend backend = compiler.backend;
+ MirrorRenamer mirrorRenamer = backend.mirrorRenamer;
+ Map<Node, String> renames = backend.renames;
+ Map<String, SourceString> symbols = mirrorRenamer.symbols;
+
+ Expect.isFalse(null == backend.mirrorHelperLibrary);
+ Expect.isFalse(null == backend.mirrorHelperGetNameFunction);
+
+ for (Node n in renames.keys) {
+ if (symbols.containsKey(renames[n])) {
+ if(n.toString() == 'getName') {
+ Expect.equals(
+ const SourceString(MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION),
+ symbols[renames[n]]);
+ } else {
+ Expect.equals(n.toString(), symbols[renames[n]].stringValue);
+ }
}
}
- }
-
- String output = compiler.assembledCode;
- String getNameMatch = MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION;
- Iterable i = getNameMatch.allMatches(output);
+ String output = compiler.assembledCode;
+ String getNameMatch = MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION;
+ Iterable i = getNameMatch.allMatches(output);
- if (minify) {
- Expect.equals(0, i.length);
- } else {
- // Appears twice in code (defined & called).
- Expect.equals(2, i.length);
- }
+ if (minify) {
+ Expect.equals(0, i.length);
+ } else {
+ // Appears twice in code (defined & called).
+ Expect.equals(2, i.length);
+ }
- String mapMatch = 'const<String,SourceString>';
- i = mapMatch.allMatches(output);
- Expect.equals(1, i.length);
+ String mapMatch = 'const<String,SourceString>';
+ i = mapMatch.allMatches(output);
+ Expect.equals(1, i.length);
+ }));
}
void testWithoutMirrorHelperLibrary({bool minify}) {
- Compiler compiler =
- runCompiler(useMirrorHelperLibrary: false, minify: minify);
- DartBackend backend = compiler.backend;
-
- Expect.equals(null, backend.mirrorHelperLibrary);
- Expect.equals(null, backend.mirrorHelperGetNameFunction);
- Expect.equals(null, backend.mirrorRenamer);
+ asyncTest(() => runCompiler(useMirrorHelperLibrary: false, minify: minify).
+ then((Compiler compiler) {
+ DartBackend backend = compiler.backend;
+
+ Expect.equals(null, backend.mirrorHelperLibrary);
+ Expect.equals(null, backend.mirrorHelperGetNameFunction);
+ Expect.equals(null, backend.mirrorRenamer);
+ }));
}
const MEMORY_SOURCE_FILES = const <String, String> {
« no previous file with comments | « tests/compiler/dart2js/metadata_test.dart ('k') | tests/compiler/dart2js/mirror_helper_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698