OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Check that relative URIs are resolved against the canonical name of a | 5 /// Check that relative URIs are resolved against the canonical name of a |
6 /// library. This only matters for dart:-libraries, so this test mocks up two | 6 /// library. This only matters for dart:-libraries, so this test mocks up two |
7 /// dart:-libraries. | 7 /// dart:-libraries. |
8 | 8 |
9 import "dart:io"; | 9 import "dart:io"; |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 documented: false, | 41 documented: false, |
42 platforms: DART2JS_PLATFORM); | 42 platforms: DART2JS_PLATFORM); |
43 | 43 |
44 const LibraryInfo mock2LibraryInfo = const LibraryInfo( | 44 const LibraryInfo mock2LibraryInfo = const LibraryInfo( |
45 "mock2.dart", | 45 "mock2.dart", |
46 categories: "Client,Embedded", | 46 categories: "Client,Embedded", |
47 documented: false, | 47 documented: false, |
48 platforms: DART2JS_PLATFORM); | 48 platforms: DART2JS_PLATFORM); |
49 | 49 |
50 | 50 |
51 class CustomCompiler extends Compiler { | 51 class CustomCompiler extends CompilerImpl { |
52 final Map<String, LibraryInfo> customLibraryInfo; | 52 final Map<String, LibraryInfo> customLibraryInfo; |
53 | 53 |
54 CustomCompiler( | 54 CustomCompiler( |
55 this.customLibraryInfo, | 55 this.customLibraryInfo, |
56 provider, | 56 provider, |
57 handler, | 57 handler, |
58 libraryRoot, | 58 libraryRoot, |
59 packageRoot, | 59 packageRoot, |
60 options, | 60 options, |
61 environment) | 61 environment) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 actualMessageCount++; | 104 actualMessageCount++; |
105 } else { | 105 } else { |
106 return handler(uri, begin, end, message, kind); | 106 return handler(uri, begin, end, message, kind); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 checkLibrary(LibraryElement library) { | 110 checkLibrary(LibraryElement library) { |
111 Expect.equals(1, actualMessageCount); | 111 Expect.equals(1, actualMessageCount); |
112 } | 112 } |
113 | 113 |
114 Compiler compiler = new CustomCompiler( | 114 CompilerImpl compiler = new CustomCompiler( |
115 {}, | 115 {}, |
116 new LegacyCompilerInput(wrappedProvider), | 116 new LegacyCompilerInput(wrappedProvider), |
117 new LegacyCompilerDiagnostics(wrappedHandler), | 117 new LegacyCompilerDiagnostics(wrappedHandler), |
118 sdkRoot, | 118 sdkRoot, |
119 packageRoot, | 119 packageRoot, |
120 [], | 120 [], |
121 {}); | 121 {}); |
122 | 122 |
123 asyncStart(); | 123 asyncStart(); |
124 compiler.libraryLoader.loadLibrary(Uri.parse("dart:m_o_c_k_1")) | 124 compiler.libraryLoader.loadLibrary(Uri.parse("dart:m_o_c_k_1")) |
125 .then(checkLibrary) | 125 .then(checkLibrary) |
126 .then(asyncSuccess); | 126 .then(asyncSuccess); |
127 } | 127 } |
128 | 128 |
129 const Map MEMORY_SOURCE_FILES = const { | 129 const Map MEMORY_SOURCE_FILES = const { |
130 "mock1.dart": "library mock1; import 'mock2.dart';", | 130 "mock1.dart": "library mock1; import 'mock2.dart';", |
131 "mock2.dart": "library mock2;", | 131 "mock2.dart": "library mock2;", |
132 }; | 132 }; |
OLD | NEW |