OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer.test.src.context.cache_test; | 5 library analyzer.test.src.context.cache_test; |
6 | 6 |
7 import 'package:analyzer/file_system/file_system.dart'; | 7 import 'package:analyzer/file_system/file_system.dart'; |
8 import 'package:analyzer/file_system/memory_file_system.dart'; | 8 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 9 import 'package:analyzer/file_system/physical_file_system.dart'; |
9 import 'package:analyzer/source/package_map_resolver.dart'; | 10 import 'package:analyzer/source/package_map_resolver.dart'; |
10 import 'package:analyzer/src/context/cache.dart'; | 11 import 'package:analyzer/src/context/cache.dart'; |
| 12 import 'package:analyzer/src/dart/sdk/sdk.dart'; |
11 import 'package:analyzer/src/generated/engine.dart'; | 13 import 'package:analyzer/src/generated/engine.dart'; |
12 import 'package:analyzer/src/generated/java_engine.dart'; | 14 import 'package:analyzer/src/generated/java_engine.dart'; |
13 import 'package:analyzer/src/generated/sdk_io.dart'; | |
14 import 'package:analyzer/src/generated/source.dart'; | 15 import 'package:analyzer/src/generated/source.dart'; |
15 import 'package:analyzer/src/generated/utilities_collection.dart'; | 16 import 'package:analyzer/src/generated/utilities_collection.dart'; |
16 import 'package:analyzer/src/task/model.dart'; | 17 import 'package:analyzer/src/task/model.dart'; |
17 import 'package:analyzer/task/model.dart'; | 18 import 'package:analyzer/task/model.dart'; |
18 import 'package:typed_mock/typed_mock.dart'; | 19 import 'package:typed_mock/typed_mock.dart'; |
19 import 'package:unittest/unittest.dart'; | 20 import 'package:unittest/unittest.dart'; |
20 | 21 |
21 import '../../generated/test_support.dart'; | 22 import '../../generated/test_support.dart'; |
22 import '../../reflective_tests.dart'; | 23 import '../../reflective_tests.dart'; |
23 import '../../utils.dart'; | 24 import '../../utils.dart'; |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 } | 1171 } |
1171 | 1172 |
1172 void test_contains_false() { | 1173 void test_contains_false() { |
1173 CachePartition partition = createPartition(); | 1174 CachePartition partition = createPartition(); |
1174 AnalysisTarget target = new TestSource(); | 1175 AnalysisTarget target = new TestSource(); |
1175 expect(partition.isResponsibleFor(target), isFalse); | 1176 expect(partition.isResponsibleFor(target), isFalse); |
1176 } | 1177 } |
1177 | 1178 |
1178 void test_contains_true() { | 1179 void test_contains_true() { |
1179 SdkCachePartition partition = new SdkCachePartition(null); | 1180 SdkCachePartition partition = new SdkCachePartition(null); |
1180 SourceFactory factory = new SourceFactory( | 1181 ResourceProvider resourceProvider = PhysicalResourceProvider.INSTANCE; |
1181 [new DartUriResolver(DirectoryBasedDartSdk.defaultSdk)]); | 1182 FolderBasedDartSdk sdk = new FolderBasedDartSdk(resourceProvider, |
| 1183 FolderBasedDartSdk.defaultSdkDirectory(resourceProvider)); |
| 1184 SourceFactory factory = new SourceFactory([new DartUriResolver(sdk)]); |
1182 AnalysisTarget target = factory.forUri("dart:core"); | 1185 AnalysisTarget target = factory.forUri("dart:core"); |
1183 expect(partition.isResponsibleFor(target), isTrue); | 1186 expect(partition.isResponsibleFor(target), isTrue); |
1184 } | 1187 } |
1185 } | 1188 } |
1186 | 1189 |
1187 @reflectiveTest | 1190 @reflectiveTest |
1188 class UniversalCachePartitionTest extends CachePartitionTest { | 1191 class UniversalCachePartitionTest extends CachePartitionTest { |
1189 CachePartition createPartition() { | 1192 CachePartition createPartition() { |
1190 return new UniversalCachePartition(null); | 1193 return new UniversalCachePartition(null); |
1191 } | 1194 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 } | 1262 } |
1260 } | 1263 } |
1261 | 1264 |
1262 class _TestAnalysisTarget implements AnalysisTarget { | 1265 class _TestAnalysisTarget implements AnalysisTarget { |
1263 @override | 1266 @override |
1264 Source get librarySource => null; | 1267 Source get librarySource => null; |
1265 | 1268 |
1266 @override | 1269 @override |
1267 Source get source => null; | 1270 Source get source => null; |
1268 } | 1271 } |
OLD | NEW |