| Index: tests/compiler/dart2js/deferred_custom_element_test.dart
|
| diff --git a/tests/compiler/dart2js/deferred_load_graph_segmentation2_test.dart b/tests/compiler/dart2js/deferred_custom_element_test.dart
|
| similarity index 64%
|
| copy from tests/compiler/dart2js/deferred_load_graph_segmentation2_test.dart
|
| copy to tests/compiler/dart2js/deferred_custom_element_test.dart
|
| index 6a4b4805ed266be0c505345317d5173deea57b83..9cbf87fa14dab133841797795608978055f7ef14 100644
|
| --- a/tests/compiler/dart2js/deferred_load_graph_segmentation2_test.dart
|
| +++ b/tests/compiler/dart2js/deferred_custom_element_test.dart
|
| @@ -11,9 +11,6 @@ import "package:async_helper/async_helper.dart";
|
| import 'memory_source_file_helper.dart';
|
| import "dart:async";
|
|
|
| -import 'package:compiler/implementation/dart2jslib.dart'
|
| - as dart2js;
|
| -
|
| class FakeOutputStream<T> extends EventSink<T> {
|
| void add(T event) {}
|
| void addError(T event, [StackTrace stackTrace]) {}
|
| @@ -40,43 +37,33 @@ void main() {
|
| var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit;
|
| var lib =
|
| compiler.libraryLoader.lookupLibrary(Uri.parse("memory:lib.dart"));
|
| - var f1 = lib.find("f1");
|
| - var f2 = lib.find("f2");
|
| - Expect.notEquals(mainOutputUnit, outputUnitForElement(f1));
|
| - Expect.equals(mainOutputUnit, outputUnitForElement(f2));
|
| + var customType = lib.find("CustomType");
|
| + var foo = lib.find("foo");
|
| + Expect.notEquals(mainOutputUnit, outputUnitForElement(foo));
|
| + // Native elements are not deferred
|
| + Expect.equals(mainOutputUnit, outputUnitForElement(customType));
|
| }));
|
| }
|
|
|
| -// The main library imports lib1 and lib2 deferred and use lib1.foo1 and
|
| -// lib2.foo2. This should trigger seperate outputunits for main, lib1 and lib2.
|
| -//
|
| -// Both lib1 and lib2 import lib3 directly and
|
| -// both use lib3.foo3. Therefore a shared output unit for lib1 and lib2 should
|
| -// be created.
|
| -//
|
| -// lib1 and lib2 also import lib4 deferred, but lib1 uses lib4.bar1 and lib2
|
| -// uses lib4.bar2. So two output units should be created for lib4, one for each
|
| -// import.
|
| +// The main library imports a file defining a custom element.
|
| +// Registering this class implicitly causes the constructors to be
|
| +// live. Check that this is handled.
|
| const Map MEMORY_SOURCE_FILES = const {"main.dart": """
|
| -import "dart:async";
|
| -
|
| -@def import 'lib.dart' as lib show f1;
|
| -import 'lib.dart' show f2;
|
| -
|
| -const def = const DeferredLibrary("deferred");
|
| +import "lib.dart" deferred as a;
|
| +import 'dart:html';
|
|
|
| -void main() {
|
| - print(f2());
|
| - def.load().then((_) {
|
| - print(lib.f1());
|
| - });
|
| +main() {
|
| + document.registerElement("foo-tag", a.a);
|
| + a.foo();
|
| }
|
| """, "lib.dart": """
|
| -int f1 () {
|
| - return 1;
|
| -}
|
| +import 'dart:html';
|
| +var a = CustomType;
|
|
|
| -int f2 () {
|
| - return 2;
|
| +class CustomType extends HtmlElement {
|
| + factory CustomType() => null;
|
| + CustomType.created() : super.created() ;
|
| }
|
| +
|
| +foo() {}
|
| """,};
|
|
|