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

Side by Side Diff: pkg/analysis_server/test/context_manager_test.dart

Issue 2286923002: Convert analysis server over to use ContextBuilder (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: address comment, fix bugs, clean-up Created 4 years, 3 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) 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 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after
1813 ExtensionManager manager = new ExtensionManager(); 1813 ExtensionManager manager = new ExtensionManager();
1814 manager.processPlugins(plugins); 1814 manager.processPlugins(plugins);
1815 } 1815 }
1816 1816
1817 UriResolver providePackageResolver(Folder folder) => packageResolver; 1817 UriResolver providePackageResolver(Folder folder) => packageResolver;
1818 1818
1819 void setUp() { 1819 void setUp() {
1820 processRequiredPlugins(); 1820 processRequiredPlugins();
1821 resourceProvider = new MemoryResourceProvider(); 1821 resourceProvider = new MemoryResourceProvider();
1822 packageMapProvider = new MockPackageMapProvider(); 1822 packageMapProvider = new MockPackageMapProvider();
1823 DartSdkManager sdkManager = 1823 DartSdk sdk = new MockSdk(resourceProvider: resourceProvider);
1824 new DartSdkManager('', false, (_) => new MockSdk()); 1824 DartSdkManager sdkManager = new DartSdkManager('/', false, (_) => sdk);
1825 manager = new ContextManagerImpl( 1825 manager = new ContextManagerImpl(
1826 resourceProvider, 1826 resourceProvider,
1827 sdkManager, 1827 sdkManager,
1828 providePackageResolver, 1828 providePackageResolver,
1829 packageMapProvider, 1829 packageMapProvider,
1830 analysisFilesGlobs, 1830 analysisFilesGlobs,
1831 InstrumentationService.NULL_SERVICE, 1831 InstrumentationService.NULL_SERVICE,
1832 new AnalysisOptionsImpl()); 1832 new AnalysisOptionsImpl());
1833 callbacks = new TestContextManagerCallbacks(resourceProvider); 1833 callbacks = new TestContextManagerCallbacks(resourceProvider);
1834 manager.callbacks = callbacks; 1834 manager.callbacks = callbacks;
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
2698 void assertContextPaths(List<String> expected) { 2698 void assertContextPaths(List<String> expected) {
2699 expect(currentContextPaths, unorderedEquals(expected)); 2699 expect(currentContextPaths, unorderedEquals(expected));
2700 } 2700 }
2701 2701
2702 @override 2702 @override
2703 void computingPackageMap(bool computing) { 2703 void computingPackageMap(bool computing) {
2704 // Do nothing. 2704 // Do nothing.
2705 } 2705 }
2706 2706
2707 @override 2707 @override
2708 ContextBuilder createContextBuilder(Folder folder, AnalysisOptions options) {
2709 DartSdkManager sdkManager = new DartSdkManager('/', false, null);
2710 ContextBuilder builder =
2711 new ContextBuilder(resourceProvider, sdkManager, new ContentCache());
2712 builder.defaultOptions = options;
2713 return builder;
2714 }
2715
2716 @override
2708 void moveContext(Folder from, Folder to) { 2717 void moveContext(Folder from, Folder to) {
2709 String path = from.path; 2718 String path = from.path;
2710 String path2 = to.path; 2719 String path2 = to.path;
2711 expect(currentContextFilePaths, contains(path)); 2720 expect(currentContextFilePaths, contains(path));
2712 expect(currentContextTimestamps, contains(path)); 2721 expect(currentContextTimestamps, contains(path));
2713 expect(currentContextSources, contains(path)); 2722 expect(currentContextSources, contains(path));
2714 expect(currentContextFilePaths, isNot(contains(path2))); 2723 expect(currentContextFilePaths, isNot(contains(path2)));
2715 expect(currentContextTimestamps, isNot(contains(path2))); 2724 expect(currentContextTimestamps, isNot(contains(path2)));
2716 expect(currentContextSources, isNot(contains(path2))); 2725 expect(currentContextSources, isNot(contains(path2)));
2717 currentContextFilePaths[path2] = currentContextFilePaths.remove(path); 2726 currentContextFilePaths[path2] = currentContextFilePaths.remove(path);
(...skipping 30 matching lines...) Expand all
2748 class TestUriResolver extends UriResolver { 2757 class TestUriResolver extends UriResolver {
2749 Map<Uri, Source> uriMap; 2758 Map<Uri, Source> uriMap;
2750 2759
2751 TestUriResolver(this.uriMap); 2760 TestUriResolver(this.uriMap);
2752 2761
2753 @override 2762 @override
2754 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 2763 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
2755 return uriMap[uri]; 2764 return uriMap[uri];
2756 } 2765 }
2757 } 2766 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/completion_test.dart ('k') | pkg/analysis_server/test/domain_analysis_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698