| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
| 8 import 'mock_compiler.dart'; | 8 import 'mock_compiler.dart'; |
| 9 import '../../../sdk/lib/_internal/compiler/compiler.dart'; | 9 import '../../../sdk/lib/_internal/compiler/compiler.dart'; |
| 10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' as l
eg; | 10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' as l
eg; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 factory LinkedHashMap._literal(elements) => null; | 37 factory LinkedHashMap._literal(elements) => null; |
| 38 } | 38 } |
| 39 class Math { | 39 class Math { |
| 40 static double parseDouble(String s) => 1.0; | 40 static double parseDouble(String s) => 1.0; |
| 41 } | 41 } |
| 42 print(x) {} | 42 print(x) {} |
| 43 identical(a, b) => true; | 43 identical(a, b) => true; |
| 44 const proxy = 0; | 44 const proxy = 0; |
| 45 '''; | 45 '''; |
| 46 | 46 |
| 47 const corePatch = r''' |
| 48 import 'dart:_js_helper'; |
| 49 import 'dart:_interceptors'; |
| 50 import 'dart:_isolate_helper'; |
| 51 import 'dart:_foreign_helper'; |
| 52 '''; |
| 53 |
| 47 const ioLib = r''' | 54 const ioLib = r''' |
| 48 library io; | 55 library io; |
| 49 class Platform { | 56 class Platform { |
| 50 static int operatingSystem; | 57 static int operatingSystem; |
| 51 } | 58 } |
| 52 '''; | 59 '''; |
| 53 | 60 |
| 54 const htmlLib = r''' | 61 const htmlLib = r''' |
| 55 library html; | 62 library html; |
| 56 Window __window; | 63 Window __window; |
| 57 Window get window => __window; | 64 Window get window => __window; |
| 58 abstract class Window { | 65 abstract class Window { |
| 59 Navigator get navigator; | 66 Navigator get navigator; |
| 60 } | 67 } |
| 61 abstract class Navigator { | 68 abstract class Navigator { |
| 62 String get userAgent; | 69 String get userAgent; |
| 63 } | 70 } |
| 64 '''; | 71 '''; |
| 65 | 72 |
| 66 const helperLib = r''' | 73 const helperLib = r''' |
| 67 library js_helper; | 74 library js_helper; |
| 68 class JSInvocationMirror {} | 75 class JSInvocationMirror {} |
| 69 assertHelper(a) {} | 76 assertHelper(a) {} |
| 77 class Closure {} |
| 78 class BoundClosure {} |
| 70 '''; | 79 '''; |
| 71 | 80 |
| 72 const foreignLib = r''' | 81 const foreignLib = r''' |
| 73 var JS; | 82 var JS; |
| 74 '''; | 83 '''; |
| 75 | 84 |
| 76 const isolateHelperLib = r''' | 85 const isolateHelperLib = r''' |
| 77 class _WorkerStub { | 86 class _WorkerStub { |
| 78 } | 87 } |
| 79 '''; | 88 '''; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 100 final scriptUri = fileUri('script.dart'); | 109 final scriptUri = fileUri('script.dart'); |
| 101 final libUri = fileUri('mylib.dart'); | 110 final libUri = fileUri('mylib.dart'); |
| 102 | 111 |
| 103 provider(uri) { | 112 provider(uri) { |
| 104 if (uri == scriptUri) return new Future.value(srcMain); | 113 if (uri == scriptUri) return new Future.value(srcMain); |
| 105 if (uri.toString() == libUri.toString()) { | 114 if (uri.toString() == libUri.toString()) { |
| 106 return new Future.value(srcLibrary); | 115 return new Future.value(srcLibrary); |
| 107 } | 116 } |
| 108 if (uri.path.endsWith('/core.dart')) { | 117 if (uri.path.endsWith('/core.dart')) { |
| 109 return new Future.value(coreLib); | 118 return new Future.value(coreLib); |
| 110 } else if (uri.path.endsWith('/io.dart')) { | 119 } else if (uri.path.endsWith('/core_patch.dart')) { |
| 120 return new Future.value(corePatch); |
| 121 } else if (uri.path.endsWith('/io.dart')) { |
| 111 return new Future.value(ioLib); | 122 return new Future.value(ioLib); |
| 112 } else if (uri.path.endsWith('/js_helper.dart')) { | 123 } else if (uri.path.endsWith('/js_helper.dart')) { |
| 113 return new Future.value(helperLib); | 124 return new Future.value(helperLib); |
| 114 } else if (uri.path.endsWith('/html_dart2js.dart')) { | 125 } else if (uri.path.endsWith('/html_dart2js.dart')) { |
| 115 // TODO(smok): The file should change to html_dartium at some point. | 126 // TODO(smok): The file should change to html_dartium at some point. |
| 116 return new Future.value(htmlLib); | 127 return new Future.value(htmlLib); |
| 117 } else if (uri.path.endsWith('/foreign_helper.dart')) { | 128 } else if (uri.path.endsWith('/foreign_helper.dart')) { |
| 118 return new Future.value(foreignLib); | 129 return new Future.value(foreignLib); |
| 119 } else if (uri.path.endsWith('/isolate_helper.dart')) { | 130 } else if (uri.path.endsWith('/isolate_helper.dart')) { |
| 120 return new Future.value(isolateHelperLib); | 131 return new Future.value(isolateHelperLib); |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 testStaticAccessIoLib(); | 750 testStaticAccessIoLib(); |
| 740 testLocalFunctionPlaceholder(); | 751 testLocalFunctionPlaceholder(); |
| 741 testMinification(); | 752 testMinification(); |
| 742 testClosureLocalsMinified(); | 753 testClosureLocalsMinified(); |
| 743 testParametersMinified(); | 754 testParametersMinified(); |
| 744 testDeclarationTypePlaceholders(); | 755 testDeclarationTypePlaceholders(); |
| 745 testPlatformLibraryMemberNamesAreFixed(); | 756 testPlatformLibraryMemberNamesAreFixed(); |
| 746 testConflictsWithCoreLib(); | 757 testConflictsWithCoreLib(); |
| 747 testUnresolvedNamedConstructor(); | 758 testUnresolvedNamedConstructor(); |
| 748 } | 759 } |
| OLD | NEW |