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

Unified Diff: tests/compiler/dart2js/source_mapping_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/size_test.dart ('k') | tests/compiler/dart2js/static_closure_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/source_mapping_test.dart
diff --git a/tests/compiler/dart2js/source_mapping_test.dart b/tests/compiler/dart2js/source_mapping_test.dart
index e204f2b288fe93a39893792e75facdead0612c73..8d404f85d1338bbede6d83ee38add9fe292e9e30 100644
--- a/tests/compiler/dart2js/source_mapping_test.dart
+++ b/tests/compiler/dart2js/source_mapping_test.dart
@@ -2,19 +2,21 @@
// 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.
+import 'dart:async';
import "package:expect/expect.dart";
-
+import "package:async_helper/async_helper.dart";
import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart";
import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart';
import "mock_compiler.dart";
import 'parser_helper.dart';
-CodeBuffer compileAll(SourceFile sourceFile) {
+Future<CodeBuffer> compileAll(SourceFile sourceFile) {
MockCompiler compiler = new MockCompiler();
Uri uri = new Uri(path: sourceFile.filename);
compiler.sourceFiles[uri.toString()] = sourceFile;
- compiler.runCompiler(uri);
- return compiler.backend.emitter.mainBuffer;
+ return compiler.runCompiler(uri).then((_) {
+ return compiler.backend.emitter.mainBuffer;
+ });
}
void testSourceMapLocations(String codeWithMarkers) {
@@ -27,27 +29,27 @@ void testSourceMapLocations(String codeWithMarkers) {
String code = codeWithMarkers.replaceAll('@', '');
SourceFile sourceFile = new SourceFile('<test script>', code);
- CodeBuffer buffer = compileAll(sourceFile);
-
- Set<int> locations = new Set<int>();
- buffer.forEachSourceLocation((int offset, var sourcePosition) {
- if (sourcePosition != null && sourcePosition.sourceFile == sourceFile) {
- locations.add(sourcePosition.token.charOffset);
+ asyncTest(() => compileAll(sourceFile).then((CodeBuffer buffer) {
+ Set<int> locations = new Set<int>();
+ buffer.forEachSourceLocation((int offset, var sourcePosition) {
+ if (sourcePosition != null && sourcePosition.sourceFile == sourceFile) {
+ locations.add(sourcePosition.token.charOffset);
+ }
+ });
+
+ for (int i = 0; i < expectedLocations.length; ++i) {
+ int expectedLocation = expectedLocations[i];
+ if (!locations.contains(expectedLocation)) {
+ int originalLocation = expectedLocation + i;
+ SourceFile sourceFileWithMarkers = new SourceFile('<test script>',
+ codeWithMarkers);
+ String message = sourceFileWithMarkers.getLocationMessage(
+ 'Missing location', originalLocation, originalLocation + 1, true,
+ (s) => s);
+ Expect.fail(message);
+ }
}
- });
-
- for (int i = 0; i < expectedLocations.length; ++i) {
- int expectedLocation = expectedLocations[i];
- if (!locations.contains(expectedLocation)) {
- int originalLocation = expectedLocation + i;
- SourceFile sourceFileWithMarkers = new SourceFile('<test script>',
- codeWithMarkers);
- String message = sourceFileWithMarkers.getLocationMessage(
- 'Missing location', originalLocation, originalLocation + 1, true,
- (s) => s);
- Expect.fail(message);
- }
- }
+ }));
}
String FUNCTIONS_TEST = '''
« no previous file with comments | « tests/compiler/dart2js/size_test.dart ('k') | tests/compiler/dart2js/static_closure_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698