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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // Just check that the compile runs. | 48 // Just check that the compile runs. |
49 // This is a regression test. | 49 // This is a regression test. |
50 Expect.isTrue(true); | 50 Expect.isTrue(true); |
51 }); | 51 }); |
52 runTest('memory:main3.dart', (compiler) { | 52 runTest('memory:main3.dart', (compiler) { |
53 var main = compiler.mainApp.find(dart2js.Compiler.MAIN); | 53 var main = compiler.mainApp.find(dart2js.Compiler.MAIN); |
54 Expect.isNotNull(main, "Could not find 'main'"); | 54 Expect.isNotNull(main, "Could not find 'main'"); |
55 compiler.deferredLoadTask.onResolutionComplete(main); | 55 compiler.deferredLoadTask.onResolutionComplete(main); |
56 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; | 56 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; |
57 | 57 |
| 58 Expect.isFalse(compiler.backend.hasInsufficientMirrorsUsed); |
58 var mainLib = lookupLibrary(compiler, "memory:main3.dart"); | 59 var mainLib = lookupLibrary(compiler, "memory:main3.dart"); |
59 var lib3 = lookupLibrary(compiler, "memory:lib3.dart"); | 60 var lib3 = lookupLibrary(compiler, "memory:lib3.dart"); |
60 var C = mainLib.find("C"); | 61 var C = mainLib.find("C"); |
61 var foo = lib3.find("foo"); | 62 var foo = lib3.find("foo"); |
62 | 63 |
63 Expect.notEquals(outputUnitForElement(main), outputUnitForElement(foo)); | 64 Expect.notEquals(outputUnitForElement(main), outputUnitForElement(foo)); |
64 Expect.equals(outputUnitForElement(main), outputUnitForElement(C)); | 65 Expect.equals(outputUnitForElement(main), outputUnitForElement(C)); |
65 }); | 66 }); |
66 runTest('memory:main4.dart', (compiler) { | 67 runTest('memory:main4.dart', (compiler) { |
67 var main = compiler.mainApp.find(dart2js.Compiler.MAIN); | 68 var main = compiler.mainApp.find(dart2js.Compiler.MAIN); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 library lib5; | 190 library lib5; |
190 | 191 |
191 foo() {} | 192 foo() {} |
192 """, | 193 """, |
193 "lib6.dart": """ | 194 "lib6.dart": """ |
194 library lib6; | 195 library lib6; |
195 | 196 |
196 foo() {} | 197 foo() {} |
197 """, | 198 """, |
198 }; | 199 }; |
OLD | NEW |