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

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

Issue 23258002: Load builtin helper libraries on demand. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments. Created 7 years, 4 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/library_load_test.dart
diff --git a/tests/compiler/dart2js/library_load_test.dart b/tests/compiler/dart2js/library_load_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..36c9adf2c05db49280442f4fbd67783daea59d06
--- /dev/null
+++ b/tests/compiler/dart2js/library_load_test.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2013, 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.
+
+import "package:expect/expect.dart";
+import 'mock_compiler.dart';
+
+class ScanMockCompiler extends MockCompiler {
+ ScanMockCompiler() {
+ isolateHelperLibrary = null;
+ foreignLibrary = null;
+ }
+
+ LibraryElement scanBuiltinLibrary(String filename) {
+ return createLibrary(filename, "main(){}");
+ }
+}
+
+void main() {
+ Compiler compiler = new ScanMockCompiler();
+ Expect.equals(null, compiler.isolateHelperLibrary);
+ Expect.equals(null, compiler.foreignLibrary);
+ compiler.onLibraryLoaded(mockLibrary(compiler, "mock"),
+ new Uri(scheme: 'dart', path: '_isolate_helper'));
+ Expect.isTrue(compiler.isolateHelperLibrary != null);
+ compiler.onLibraryLoaded(mockLibrary(compiler, "mock"),
+ new Uri(scheme: 'dart', path: '_foreign_helper'));
+ Expect.isTrue(compiler.isolateHelperLibrary != null);
+ Expect.equals(new Uri(scheme: 'dart', path: '_isolate_helper'),
+ compiler.isolateHelperLibrary.canonicalUri);
+ Expect.isTrue(compiler.foreignLibrary != null);
+ Expect.equals(new Uri(scheme: 'dart', path: '_foreign_helper'),
+ compiler.foreignLibrary.canonicalUri);
+}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/native_handler.dart ('k') | tests/compiler/dart2js/memory_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698