| 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 library test.context.directory.manager; | 5 library test.context.directory.manager; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/context_manager.dart'; | 9 import 'package:analysis_server/src/context_manager.dart'; |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 void setUp() { | 136 void setUp() { |
| 137 processRequiredPlugins(); | 137 processRequiredPlugins(); |
| 138 resourceProvider = new MemoryResourceProvider(); | 138 resourceProvider = new MemoryResourceProvider(); |
| 139 packageMapProvider = new MockPackageMapProvider(); | 139 packageMapProvider = new MockPackageMapProvider(); |
| 140 manager = new ContextManagerImpl( | 140 manager = new ContextManagerImpl( |
| 141 resourceProvider, | 141 resourceProvider, |
| 142 providePackageResolver, | 142 providePackageResolver, |
| 143 provideEmbeddedUriResolver, | 143 provideEmbeddedUriResolver, |
| 144 packageMapProvider, | 144 packageMapProvider, |
| 145 InstrumentationService.NULL_SERVICE); | 145 InstrumentationService.NULL_SERVICE, |
| 146 new AnalysisOptionsImpl()); |
| 146 callbacks = new TestContextManagerCallbacks(resourceProvider); | 147 callbacks = new TestContextManagerCallbacks(resourceProvider); |
| 147 manager.callbacks = callbacks; | 148 manager.callbacks = callbacks; |
| 148 resourceProvider.newFolder(projPath); | 149 resourceProvider.newFolder(projPath); |
| 149 } | 150 } |
| 150 | 151 |
| 151 test_analysis_options_file_delete() async { | 152 test_analysis_options_file_delete() async { |
| 152 // Setup .analysis_options | 153 // Setup .analysis_options |
| 153 newFile( | 154 newFile( |
| 154 [projPath, AnalysisEngine.ANALYSIS_OPTIONS_FILE], | 155 [projPath, AnalysisEngine.ANALYSIS_OPTIONS_FILE], |
| 155 r''' | 156 r''' |
| (...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2356 final ResourceProvider resourceProvider; | 2357 final ResourceProvider resourceProvider; |
| 2357 | 2358 |
| 2358 TestContextManagerCallbacks(this.resourceProvider); | 2359 TestContextManagerCallbacks(this.resourceProvider); |
| 2359 | 2360 |
| 2360 /** | 2361 /** |
| 2361 * Iterable of the paths to contexts that currently exist. | 2362 * Iterable of the paths to contexts that currently exist. |
| 2362 */ | 2363 */ |
| 2363 Iterable<String> get currentContextPaths => currentContextTimestamps.keys; | 2364 Iterable<String> get currentContextPaths => currentContextTimestamps.keys; |
| 2364 | 2365 |
| 2365 @override | 2366 @override |
| 2366 AnalysisOptions get defaultAnalysisOptions => new AnalysisOptionsImpl(); | |
| 2367 | |
| 2368 @override | |
| 2369 AnalysisContext addContext( | 2367 AnalysisContext addContext( |
| 2370 Folder folder, AnalysisOptions options, FolderDisposition disposition) { | 2368 Folder folder, AnalysisOptions options, FolderDisposition disposition) { |
| 2371 String path = folder.path; | 2369 String path = folder.path; |
| 2372 expect(currentContextPaths, isNot(contains(path))); | 2370 expect(currentContextPaths, isNot(contains(path))); |
| 2373 currentContextTimestamps[path] = now; | 2371 currentContextTimestamps[path] = now; |
| 2374 currentContextFilePaths[path] = <String, int>{}; | 2372 currentContextFilePaths[path] = <String, int>{}; |
| 2375 currentContextSources[path] = new HashSet<Source>(); | 2373 currentContextSources[path] = new HashSet<Source>(); |
| 2376 currentContextDispositions[path] = disposition; | 2374 currentContextDispositions[path] = disposition; |
| 2377 currentContext = AnalysisEngine.instance.createAnalysisContext(); | 2375 currentContext = AnalysisEngine.instance.createAnalysisContext(); |
| 2378 _locateEmbedderYamls(currentContext, disposition); | 2376 _locateEmbedderYamls(currentContext, disposition); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2485 class TestUriResolver extends UriResolver { | 2483 class TestUriResolver extends UriResolver { |
| 2486 Map<Uri, Source> uriMap; | 2484 Map<Uri, Source> uriMap; |
| 2487 | 2485 |
| 2488 TestUriResolver(this.uriMap); | 2486 TestUriResolver(this.uriMap); |
| 2489 | 2487 |
| 2490 @override | 2488 @override |
| 2491 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 2489 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
| 2492 return uriMap[uri]; | 2490 return uriMap[uri]; |
| 2493 } | 2491 } |
| 2494 } | 2492 } |
| OLD | NEW |