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

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

Issue 356573002: Revert "Move Compiler.libraries to LibraryLoder." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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
43 var main = compiler.mainApp.find(dart2js.Compiler.MAIN); 39 var main = compiler.mainApp.find(dart2js.Compiler.MAIN);
44 Expect.isNotNull(main, "Could not find 'main'"); 40 Expect.isNotNull(main, "Could not find 'main'");
45 compiler.deferredLoadTask.onResolutionComplete(main); 41 compiler.deferredLoadTask.onResolutionComplete(main);
46 42
47 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; 43 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement;
48 44
49 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit; 45 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit;
50 var backend = compiler.backend; 46 var backend = compiler.backend;
51 var classes = backend.emitter.neededClasses; 47 var classes = backend.emitter.neededClasses;
52 var inputElement = classes.where((e) => e.name == 'InputElement').single; 48 var inputElement = classes.where((e) => e.name == 'InputElement').single;
53 var lib1 = lookupLibrary("memory:lib1.dart"); 49 var lib1 = compiler.libraries["memory:lib1.dart"];
54 var foo1 = lib1.find("foo1"); 50 var foo1 = lib1.find("foo1");
55 var lib2 = lookupLibrary("memory:lib2.dart"); 51 var lib2 = compiler.libraries["memory:lib2.dart"];
56 var foo2 = lib2.find("foo2"); 52 var foo2 = lib2.find("foo2");
57 var lib3 = lookupLibrary("memory:lib3.dart"); 53 var lib3 = compiler.libraries["memory:lib3.dart"];
58 var foo3 = lib3.find("foo3"); 54 var foo3 = lib3.find("foo3");
59 var lib4 = lookupLibrary("memory:lib4.dart"); 55 var lib4 = compiler.libraries["memory:lib4.dart"];
60 var bar1 = lib4.find("bar1"); 56 var bar1 = lib4.find("bar1");
61 var bar2 = lib4.find("bar2"); 57 var bar2 = lib4.find("bar2");
62 var outputClassLists = backend.emitter.outputClassLists; 58 var outputClassLists = backend.emitter.outputClassLists;
63 59
64 Expect.equals(mainOutputUnit, outputUnitForElement(main)); 60 Expect.equals(mainOutputUnit, outputUnitForElement(main));
65 Expect.notEquals(mainOutputUnit, outputUnitForElement(foo1)); 61 Expect.notEquals(mainOutputUnit, outputUnitForElement(foo1));
66 Expect.notEquals(outputUnitForElement(foo1), outputUnitForElement(foo3)); 62 Expect.notEquals(outputUnitForElement(foo1), outputUnitForElement(foo3));
67 Expect.notEquals(outputUnitForElement(foo2), outputUnitForElement(foo3)); 63 Expect.notEquals(outputUnitForElement(foo2), outputUnitForElement(foo3));
68 Expect.notEquals(outputUnitForElement(foo1), outputUnitForElement(foo2)); 64 Expect.notEquals(outputUnitForElement(foo1), outputUnitForElement(foo2));
69 Expect.notEquals(outputUnitForElement(bar1), outputUnitForElement(bar2)); 65 Expect.notEquals(outputUnitForElement(bar1), outputUnitForElement(bar2));
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 178
183 bar1() { 179 bar1() {
184 return "hello"; 180 return "hello";
185 } 181 }
186 182
187 bar2() { 183 bar2() {
188 return 2; 184 return 2;
189 } 185 }
190 """, 186 """,
191 }; 187 };
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/deferred_load_graph_segmentation2_test.dart ('k') | tests/compiler/dart2js/deferred_mirrors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698