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

Side by Side Diff: tests/compiler/dart2js/deferred_not_in_main_test.dart

Issue 330913004: Move Compiler.libraries to LibraryLoader. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix compiler_isolate.dart 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Test of the graph segmentation algorithm used by deferred loading 5 // Test of the graph segmentation algorithm used by deferred loading
6 // to determine which elements can be deferred and which libraries 6 // to determine which elements can be deferred and which libraries
7 // much be included in the initial download (loaded eagerly). 7 // much be included in the initial download (loaded eagerly).
8 8
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 import "package:async_helper/async_helper.dart"; 10 import "package:async_helper/async_helper.dart";
(...skipping 18 matching lines...) Expand all
29 var handler = new FormattingDiagnosticHandler(provider); 29 var handler = new FormattingDiagnosticHandler(provider);
30 30
31 Compiler compiler = new Compiler(provider.readStringFromUri, 31 Compiler compiler = new Compiler(provider.readStringFromUri,
32 (name, extension) => new FakeOutputStream(), 32 (name, extension) => new FakeOutputStream(),
33 handler.diagnosticHandler, 33 handler.diagnosticHandler,
34 libraryRoot, 34 libraryRoot,
35 packageRoot, 35 packageRoot,
36 [], 36 [],
37 {}); 37 {});
38 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { 38 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
39 lookupLibrary(name) {
40 return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
41 }
42
39 var main = compiler.mainApp.find(dart2js.Compiler.MAIN); 43 var main = compiler.mainApp.find(dart2js.Compiler.MAIN);
40 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; 44 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement;
41 45
42 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit; 46 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit;
43 var backend = compiler.backend; 47 var backend = compiler.backend;
44 var classes = backend.emitter.neededClasses; 48 var classes = backend.emitter.neededClasses;
45 var lib1 = compiler.libraries["memory:lib1.dart"]; 49 var lib1 = lookupLibrary("memory:lib1.dart");
46 var lib2 = compiler.libraries["memory:lib2.dart"]; 50 var lib2 = lookupLibrary("memory:lib2.dart");
47 var foo1 = lib1.find("foo1"); 51 var foo1 = lib1.find("foo1");
48 var foo2 = lib2.find("foo2"); 52 var foo2 = lib2.find("foo2");
49 53
50 var outputClassLists = backend.emitter.outputClassLists; 54 var outputClassLists = backend.emitter.outputClassLists;
51 55
52 Expect.notEquals(mainOutputUnit, outputUnitForElement(foo2)); 56 Expect.notEquals(mainOutputUnit, outputUnitForElement(foo2));
53 })); 57 }));
54 } 58 }
55 59
56 // lib1 imports lib2 deferred. But mainlib never uses DeferredLibrary. 60 // lib1 imports lib2 deferred. But mainlib never uses DeferredLibrary.
(...skipping 19 matching lines...) Expand all
76 void foo1() { 80 void foo1() {
77 def.load().then((_) => lib2.foo2()); 81 def.load().then((_) => lib2.foo2());
78 } 82 }
79 """, 83 """,
80 "lib2.dart":""" 84 "lib2.dart":"""
81 library lib2; 85 library lib2;
82 86
83 void foo2() {} 87 void foo2() {}
84 """, 88 """,
85 }; 89 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698