Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: tests/compiler/dart2js/deferred_custom_element_test.dart

Issue 3008793002: Use the entity model for dump_info. (Closed)
Patch Set: use codegen enqueuer Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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';
11 import 'package:expect/expect.dart'; 11 import 'package:expect/expect.dart';
12 import 'memory_compiler.dart'; 12 import 'memory_compiler.dart';
13 13
14 void main() { 14 void main() {
15 asyncTest(() async { 15 asyncTest(() async {
16 CompilationResult result = 16 CompilationResult result =
17 await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES); 17 await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
18 Compiler compiler = result.compiler; 18 Compiler compiler = result.compiler;
19 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; 19 var outputUnitForEntity = compiler.deferredLoadTask.outputUnitForEntity;
20 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit; 20 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit;
21 dynamic lib = 21 dynamic lib =
22 compiler.libraryLoader.lookupLibrary(Uri.parse("memory:lib.dart")); 22 compiler.libraryLoader.lookupLibrary(Uri.parse("memory:lib.dart"));
23 var customType = lib.find("CustomType"); 23 var customType = lib.find("CustomType");
24 var foo = lib.find("foo"); 24 var foo = lib.find("foo");
25 Expect.notEquals(mainOutputUnit, outputUnitForElement(foo)); 25 Expect.notEquals(mainOutputUnit, outputUnitForEntity(foo));
26 // Native elements are not deferred 26 // Native elements are not deferred
27 Expect.equals(mainOutputUnit, outputUnitForElement(customType)); 27 Expect.equals(mainOutputUnit, outputUnitForEntity(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 { 34 const Map MEMORY_SOURCE_FILES = const {
35 "main.dart": """ 35 "main.dart": """
36 import "lib.dart" deferred as a; 36 import "lib.dart" deferred as a;
37 import 'dart:html'; 37 import 'dart:html';
38 38
39 main() { 39 main() {
40 document.registerElement("foo-tag", a.a); 40 document.registerElement("foo-tag", a.a);
41 a.foo(); 41 a.foo();
42 } 42 }
43 """, 43 """,
44 "lib.dart": """ 44 "lib.dart": """
45 import 'dart:html'; 45 import 'dart:html';
46 var a = CustomType; 46 var a = CustomType;
47 47
48 class CustomType extends HtmlElement { 48 class CustomType extends HtmlElement {
49 factory CustomType() => null; 49 factory CustomType() => null;
50 CustomType.created() : super.created() ; 50 CustomType.created() : super.created() ;
51 } 51 }
52 52
53 foo() {} 53 foo() {}
54 """, 54 """,
55 }; 55 };
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/universe/use.dart ('k') | tests/compiler/dart2js/deferred_dont_inline_deferred_constants_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698