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

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

Issue 3008793002: Use the entity model for dump_info. (Closed)
Patch Set: use codegen enqueuer Created 3 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 unified diff | Download patch
« no previous file with comments | « tests/compiler/dart2js/deferred_mirrors_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:async_helper/async_helper.dart'; 9 import 'package:async_helper/async_helper.dart';
10 import 'package:compiler/src/compiler.dart'; 10 import 'package:compiler/src/compiler.dart';
11 import 'package:expect/expect.dart'; 11 import 'package:expect/expect.dart';
12 import 'memory_compiler.dart'; 12 import 'memory_compiler.dart';
13 13
14 void main() { 14 void main() {
15 deferredTest1(); 15 deferredTest1();
16 deferredTest2(); 16 deferredTest2();
17 } 17 }
18 18
19 void deferredTest1() { 19 void deferredTest1() {
20 asyncTest(() async { 20 asyncTest(() async {
21 CompilationResult result = await runCompiler(memorySourceFiles: TEST1); 21 CompilationResult result = await runCompiler(memorySourceFiles: TEST1);
22 Compiler compiler = result.compiler; 22 Compiler compiler = result.compiler;
23 23
24 lookupLibrary(name) { 24 lookupLibrary(name) {
25 return compiler.libraryLoader.lookupLibrary(Uri.parse(name)); 25 return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
26 } 26 }
27 27
28 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; 28 var outputUnitForEntity = compiler.deferredLoadTask.outputUnitForEntity;
29 29
30 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit; 30 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit;
31 dynamic lib1 = lookupLibrary("memory:lib1.dart"); 31 dynamic lib1 = lookupLibrary("memory:lib1.dart");
32 dynamic lib2 = lookupLibrary("memory:lib2.dart"); 32 dynamic lib2 = lookupLibrary("memory:lib2.dart");
33 lib1.find("foo1"); 33 lib1.find("foo1");
34 var foo2 = lib2.find("foo2"); 34 var foo2 = lib2.find("foo2");
35 35
36 Expect.notEquals(mainOutputUnit, outputUnitForElement(foo2)); 36 Expect.notEquals(mainOutputUnit, outputUnitForEntity(foo2));
37 }); 37 });
38 } 38 }
39 39
40 void deferredTest2() { 40 void deferredTest2() {
41 asyncTest(() async { 41 asyncTest(() async {
42 CompilationResult result = await runCompiler(memorySourceFiles: TEST2); 42 CompilationResult result = await runCompiler(memorySourceFiles: TEST2);
43 Compiler compiler = result.compiler; 43 Compiler compiler = result.compiler;
44 44
45 lookupLibrary(name) { 45 lookupLibrary(name) {
46 return compiler.libraryLoader.lookupLibrary(Uri.parse(name)); 46 return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
47 } 47 }
48 48
49 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; 49 var outputUnitForEntity = compiler.deferredLoadTask.outputUnitForEntity;
50 50
51 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit; 51 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit;
52 dynamic shared = lookupLibrary("memory:shared.dart"); 52 dynamic shared = lookupLibrary("memory:shared.dart");
53 var a = shared.find("A"); 53 var a = shared.find("A");
54 54
55 Expect.equals(mainOutputUnit, outputUnitForElement(a)); 55 Expect.equals(mainOutputUnit, outputUnitForEntity(a));
56 }); 56 });
57 } 57 }
58 58
59 // lib1 imports lib2 deferred. But mainlib never uses DeferredLibrary. 59 // lib1 imports lib2 deferred. But mainlib never uses DeferredLibrary.
60 // Test that this case works. 60 // Test that this case works.
61 const Map TEST1 = const { 61 const Map TEST1 = const {
62 "main.dart": """ 62 "main.dart": """
63 library mainlib; 63 library mainlib;
64 64
65 import 'lib1.dart' as lib1; 65 import 'lib1.dart' as lib1;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 import 'shared.dart'; 106 import 'shared.dart';
107 107
108 toto() { print(new A()); } 108 toto() { print(new A()); }
109 """, 109 """,
110 "shared.dart": """ 110 "shared.dart": """
111 class A {} 111 class A {}
112 class B extends A {} 112 class B extends A {}
113 foo(B b) => null; 113 foo(B b) => null;
114 """, 114 """,
115 }; 115 };
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/deferred_mirrors_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698