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