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'; |
11 import 'package:analyzer/file_system/memory_file_system.dart'; | 11 import 'package:analyzer/file_system/memory_file_system.dart'; |
12 import 'package:analyzer/instrumentation/instrumentation.dart'; | 12 import 'package:analyzer/instrumentation/instrumentation.dart'; |
13 import 'package:analyzer/src/generated/engine.dart'; | 13 import 'package:analyzer/src/generated/engine.dart'; |
14 import 'package:analyzer/src/generated/source.dart'; | 14 import 'package:analyzer/src/generated/source.dart'; |
15 import 'package:analyzer/src/generated/source_io.dart'; | 15 import 'package:analyzer/src/generated/source_io.dart'; |
16 import 'package:package_config/packages.dart'; | 16 import 'package:package_config/packages.dart'; |
17 import 'package:path/path.dart'; | 17 import 'package:path/path.dart'; |
| 18 import 'package:plugin/manager.dart'; |
18 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 19 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
19 import 'package:unittest/unittest.dart'; | 20 import 'package:unittest/unittest.dart'; |
20 | 21 |
21 import 'mocks.dart'; | 22 import 'mocks.dart'; |
22 import 'utils.dart'; | 23 import 'utils.dart'; |
23 | 24 |
24 main() { | 25 main() { |
25 initializeTestEnvironment(); | 26 initializeTestEnvironment(); |
26 defineReflectiveTests(AbstractContextManagerTest); | 27 defineReflectiveTests(AbstractContextManagerTest); |
27 } | 28 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 84 |
84 void setUp() { | 85 void setUp() { |
85 resourceProvider = new MemoryResourceProvider(); | 86 resourceProvider = new MemoryResourceProvider(); |
86 packageMapProvider = new MockPackageMapProvider(); | 87 packageMapProvider = new MockPackageMapProvider(); |
87 manager = new ContextManagerImpl(resourceProvider, providePackageResolver, | 88 manager = new ContextManagerImpl(resourceProvider, providePackageResolver, |
88 packageMapProvider, InstrumentationService.NULL_SERVICE); | 89 packageMapProvider, InstrumentationService.NULL_SERVICE); |
89 callbacks = new TestContextManagerCallbacks(resourceProvider); | 90 callbacks = new TestContextManagerCallbacks(resourceProvider); |
90 manager.callbacks = callbacks; | 91 manager.callbacks = callbacks; |
91 resourceProvider.newFolder(projPath); | 92 resourceProvider.newFolder(projPath); |
92 ContextManagerImpl.ENABLE_PACKAGESPEC_SUPPORT = true; | 93 ContextManagerImpl.ENABLE_PACKAGESPEC_SUPPORT = true; |
| 94 |
| 95 // Options processing is required in context creation. |
| 96 ExtensionManager em = new ExtensionManager(); |
| 97 em.processPlugins([AnalysisEngine.instance.optionsPlugin]); |
93 } | 98 } |
94 | 99 |
95 void tearDown() { | 100 void tearDown() { |
96 ContextManagerImpl.ENABLE_PACKAGESPEC_SUPPORT = false; | 101 ContextManagerImpl.ENABLE_PACKAGESPEC_SUPPORT = false; |
97 } | 102 } |
98 | 103 |
99 test_analysis_options_parse_failure() async { | 104 test_analysis_options_parse_failure() async { |
100 // Create files. | 105 // Create files. |
101 String libPath = newFolder([projPath, LIB_NAME]); | 106 String libPath = newFolder([projPath, LIB_NAME]); |
102 newFile([libPath, 'main.dart']); | 107 newFile([libPath, 'main.dart']); |
(...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1795 class TestUriResolver extends UriResolver { | 1800 class TestUriResolver extends UriResolver { |
1796 Map<Uri, Source> uriMap; | 1801 Map<Uri, Source> uriMap; |
1797 | 1802 |
1798 TestUriResolver(this.uriMap); | 1803 TestUriResolver(this.uriMap); |
1799 | 1804 |
1800 @override | 1805 @override |
1801 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 1806 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
1802 return uriMap[uri]; | 1807 return uriMap[uri]; |
1803 } | 1808 } |
1804 } | 1809 } |
OLD | NEW |