| OLD | NEW |
| 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:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
| 10 import 'package:compiler/src/compiler.dart'; | 10 import 'package:compiler/src/compiler.dart'; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 var foo = lib.find("foo"); | 24 var foo = lib.find("foo"); |
| 25 Expect.notEquals(mainOutputUnit, outputUnitForElement(foo)); | 25 Expect.notEquals(mainOutputUnit, outputUnitForElement(foo)); |
| 26 // Native elements are not deferred | 26 // Native elements are not deferred |
| 27 Expect.equals(mainOutputUnit, outputUnitForElement(customType)); | 27 Expect.equals(mainOutputUnit, outputUnitForElement(customType)); |
| 28 }); | 28 }); |
| 29 } | 29 } |
| 30 | 30 |
| 31 // The main library imports a file defining a custom element. | 31 // The main library imports a file defining a custom element. |
| 32 // Registering this class implicitly causes the constructors to be | 32 // Registering this class implicitly causes the constructors to be |
| 33 // live. Check that this is handled. | 33 // live. Check that this is handled. |
| 34 const Map MEMORY_SOURCE_FILES = const {"main.dart": """ | 34 const Map MEMORY_SOURCE_FILES = const { |
| 35 "main.dart": """ |
| 35 import "lib.dart" deferred as a; | 36 import "lib.dart" deferred as a; |
| 36 import 'dart:html'; | 37 import 'dart:html'; |
| 37 | 38 |
| 38 main() { | 39 main() { |
| 39 document.registerElement("foo-tag", a.a); | 40 document.registerElement("foo-tag", a.a); |
| 40 a.foo(); | 41 a.foo(); |
| 41 } | 42 } |
| 42 """, "lib.dart": """ | 43 """, |
| 44 "lib.dart": """ |
| 43 import 'dart:html'; | 45 import 'dart:html'; |
| 44 var a = CustomType; | 46 var a = CustomType; |
| 45 | 47 |
| 46 class CustomType extends HtmlElement { | 48 class CustomType extends HtmlElement { |
| 47 factory CustomType() => null; | 49 factory CustomType() => null; |
| 48 CustomType.created() : super.created() ; | 50 CustomType.created() : super.created() ; |
| 49 } | 51 } |
| 50 | 52 |
| 51 foo() {} | 53 foo() {} |
| 52 """,}; | 54 """, |
| 55 }; |
| OLD | NEW |