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

Side by Side Diff: tests/compiler/dart2js/deferred_load_graph_segmentation2_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";
11 import 'memory_source_file_helper.dart'; 11 import 'memory_source_file_helper.dart';
12 import "dart:async"; 12 import "dart:async";
13 13
14 import 'package:compiler/implementation/dart2jslib.dart'
15 as dart2js;
16
17 class FakeOutputStream<T> extends EventSink<T> { 14 class FakeOutputStream<T> extends EventSink<T> {
18 void add(T event) {} 15 void add(T event) {}
19 void addError(T event, [StackTrace stackTrace]) {} 16 void addError(T event, [StackTrace stackTrace]) {}
20 void close() {} 17 void close() {}
21 } 18 }
22 19
23 void main() { 20 void main() {
24 Uri script = currentDirectory.resolveUri(Platform.script); 21 Uri script = currentDirectory.resolveUri(Platform.script);
25 Uri libraryRoot = script.resolve('../../../sdk/'); 22 Uri libraryRoot = script.resolve('../../../sdk/');
26 Uri packageRoot = script.resolve('./packages/'); 23 Uri packageRoot = script.resolve('./packages/');
(...skipping 26 matching lines...) Expand all
53 // Both lib1 and lib2 import lib3 directly and 50 // Both lib1 and lib2 import lib3 directly and
54 // both use lib3.foo3. Therefore a shared output unit for lib1 and lib2 should 51 // both use lib3.foo3. Therefore a shared output unit for lib1 and lib2 should
55 // be created. 52 // be created.
56 // 53 //
57 // lib1 and lib2 also import lib4 deferred, but lib1 uses lib4.bar1 and lib2 54 // lib1 and lib2 also import lib4 deferred, but lib1 uses lib4.bar1 and lib2
58 // uses lib4.bar2. So two output units should be created for lib4, one for each 55 // uses lib4.bar2. So two output units should be created for lib4, one for each
59 // import. 56 // import.
60 const Map MEMORY_SOURCE_FILES = const {"main.dart": """ 57 const Map MEMORY_SOURCE_FILES = const {"main.dart": """
61 import "dart:async"; 58 import "dart:async";
62 59
63 @def import 'lib.dart' as lib show f1; 60 import 'lib.dart' deferred as lib show f1;
64 import 'lib.dart' show f2; 61 import 'lib.dart' show f2;
65 62
66 const def = const DeferredLibrary("deferred");
67
68 void main() { 63 void main() {
69 print(f2()); 64 print(f2());
70 def.load().then((_) { 65 lib.loadLibrary().then((_) {
71 print(lib.f1()); 66 print(lib.f1());
72 }); 67 });
73 } 68 }
74 """, "lib.dart": """ 69 """, "lib.dart": """
75 int f1 () { 70 int f1 () {
76 return 1; 71 return 1;
77 } 72 }
78 73
79 int f2 () { 74 int f2 () {
80 return 2; 75 return 2;
81 } 76 }
82 """,}; 77 """,};
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698