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

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

Issue 429883002: Remove support for the DeferredLibrary annotation and remove tests of it (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Deprecated until sdk 1.8 remove cruft from unused DeferredLibrary Created 6 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 | 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Both lib1 and lib2 import lib3 directly and 114 // Both lib1 and lib2 import lib3 directly and
115 // both use lib3.foo3. Therefore a shared output unit for lib1 and lib2 should 115 // both use lib3.foo3. Therefore a shared output unit for lib1 and lib2 should
116 // be created. 116 // be created.
117 // 117 //
118 // lib1 and lib2 also import lib4 deferred, but lib1 uses lib4.bar1 and lib2 118 // lib1 and lib2 also import lib4 deferred, but lib1 uses lib4.bar1 and lib2
119 // uses lib4.bar2. So two output units should be created for lib4, one for each 119 // uses lib4.bar2. So two output units should be created for lib4, one for each
120 // import. 120 // import.
121 const Map MEMORY_SOURCE_FILES = const { 121 const Map MEMORY_SOURCE_FILES = const {
122 "main.dart":""" 122 "main.dart":"""
123 import "dart:async"; 123 import "dart:async";
124 @def_main_1 import 'lib1.dart' as l1; 124 import 'lib1.dart' deferred as lib1;
125 @def_main_2 import 'lib2.dart' as l2; 125 import 'lib2.dart' deferred as lib2;
126
127 const def_main_1 = const DeferredLibrary("lib1");
128 const def_main_2 = const DeferredLibrary("lib2");
129 126
130 void main() { 127 void main() {
131 def_main_1.load().then((_) { 128 lib1.loadLibrary().then((_) {
132 l1.foo1(); 129 lib1.foo1();
133 new l1.C(); 130 new lib1.C();
134 def_main_2.load().then((_) { 131 lib2.loadLibrary().then((_) {
135 l2.foo2(); 132 lib2.foo2();
136 }); 133 });
137 }); 134 });
138 } 135 }
139 """, 136 """,
140 "lib1.dart":""" 137 "lib1.dart":"""
141 library lib1; 138 library lib1;
142 import "dart:async"; 139 import "dart:async";
143 import "dart:html"; 140 import "dart:html";
144 141
145 import "lib3.dart" as l3; 142 import "lib3.dart" as l3;
146 @def_1_1 import "lib4.dart" as l4; 143 import "lib4.dart" deferred as lib4_1;
147
148 const def_1_1 = const DeferredLibrary("lib4_1");
149 144
150 class C {} 145 class C {}
151 146
152 foo1() { 147 foo1() {
153 new InputElement(); 148 new InputElement();
154 def_1_1.load().then((_) { 149 lib4_1.loadLibrary().then((_) {
155 l4.bar1(); 150 lib4_1.bar1();
156 }); 151 });
157 return () {return 1 + l3.foo3();} (); 152 return () {return 1 + l3.foo3();} ();
158 } 153 }
159 """, 154 """,
160 "lib2.dart":""" 155 "lib2.dart":"""
161 library lib2; 156 library lib2;
162 import "dart:async"; 157 import "dart:async";
163 import "lib3.dart" as l3; 158 import "lib3.dart" as l3;
164 @def_2_1 import "lib4.dart" as l4; 159 import "lib4.dart" deferred as lib4_2;
165
166 const def_2_1 = const DeferredLibrary("lib4_2");
167 160
168 foo2() { 161 foo2() {
169 def_2_1.load().then((_) { 162 lib4_2.loadLibrary().then((_) {
170 l4.bar2(); 163 lib4_2.bar2();
171 }); 164 });
172 return () {return 2+l3.foo3();} (); 165 return () {return 2+l3.foo3();} ();
173 } 166 }
174 """, 167 """,
175 "lib3.dart":""" 168 "lib3.dart":"""
176 library lib3; 169 library lib3;
177 170
178 foo3() { 171 foo3() {
179 return () {return 3;} (); 172 return () {return 3;} ();
180 } 173 }
181 """, 174 """,
182 "lib4.dart":""" 175 "lib4.dart":"""
183 library lib4; 176 library lib4;
184 177
185 bar1() { 178 bar1() {
186 return "hello"; 179 return "hello";
187 } 180 }
188 181
189 bar2() { 182 bar2() {
190 return 2; 183 return 2;
191 } 184 }
192 """, 185 """,
193 }; 186 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698