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

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

Issue 2939063002: Strong mode cleaning of many dart2js tests. (Closed)
Patch Set: Use ClassElement. Created 3 years, 6 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 outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement;
20 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit; 20 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit;
21 var 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, 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.
(...skipping 14 matching lines...) Expand all
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

Powered by Google App Engine
This is Rietveld 408576698