OLD | NEW |
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 import 'lib1.dart' as lib1; | 61 import 'lib1.dart' as lib1; |
62 | 62 |
63 void main() { | 63 void main() { |
64 lib1.foo1(); | 64 lib1.foo1(); |
65 } | 65 } |
66 """, | 66 """, |
67 "lib1.dart":""" | 67 "lib1.dart":""" |
68 library lib1; | 68 library lib1; |
69 | 69 |
70 import 'dart:async'; | 70 import 'dart:async'; |
71 @def import 'lib2.dart'; | 71 @def import 'lib2.dart' as lib2; |
72 | 72 |
73 const def = const DeferredLibrary('lib2'); | 73 const def = const DeferredLibrary('lib2'); |
74 | 74 |
75 void foo1() { | 75 void foo1() { |
76 def.load().then((_) => foo2()); | 76 def.load().then((_) => lib2.foo2()); |
77 } | 77 } |
78 """, | 78 """, |
79 "lib2.dart":""" | 79 "lib2.dart":""" |
80 library lib2; | 80 library lib2; |
81 | 81 |
82 void foo2() {} | 82 void foo2() {} |
83 """, | 83 """, |
84 }; | 84 }; |
OLD | NEW |