| 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 test.src.task.abstract_context_test; | 5 library test.src.task.abstract_context_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/src/context/context.dart'; | 9 import 'package:analyzer/src/context/context.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
| 11 import 'package:analyzer/src/generated/engine.dart' | 11 import 'package:analyzer/src/generated/engine.dart' |
| 12 hide AnalysisContextImpl, AnalysisTask; | 12 hide AnalysisContextImpl, AnalysisTask; |
| 13 import 'package:analyzer/src/generated/sdk.dart'; | 13 import 'package:analyzer/src/generated/sdk.dart'; |
| 14 import 'package:analyzer/src/generated/source.dart'; | 14 import 'package:analyzer/src/generated/source.dart'; |
| 15 import 'package:analyzer/src/plugin/engine_plugin.dart'; | 15 import 'package:analyzer/src/plugin/engine_plugin.dart'; |
| 16 import 'package:analyzer/src/task/driver.dart'; | |
| 17 import 'package:analyzer/src/task/manager.dart'; | |
| 18 import 'package:plugin/manager.dart'; | 16 import 'package:plugin/manager.dart'; |
| 19 import 'package:unittest/unittest.dart'; | 17 import 'package:unittest/unittest.dart'; |
| 20 | 18 |
| 21 import 'mock_sdk.dart'; | 19 import 'mock_sdk.dart'; |
| 20 import 'package:analyzer/src/task/driver.dart'; |
| 22 | 21 |
| 23 class AbstractContextTest { | 22 class AbstractContextTest { |
| 24 MemoryResourceProvider resourceProvider = new MemoryResourceProvider(); | 23 MemoryResourceProvider resourceProvider = new MemoryResourceProvider(); |
| 25 | 24 |
| 26 ExtensionManager extensionManager = new ExtensionManager(); | 25 ExtensionManager extensionManager = new ExtensionManager(); |
| 27 | 26 |
| 28 DartSdk sdk = new MockSdk(); | 27 DartSdk sdk = new MockSdk(); |
| 29 SourceFactory sourceFactory; | 28 SourceFactory sourceFactory; |
| 30 AnalysisContextImpl context; | 29 AnalysisContextImpl context; |
| 31 | |
| 32 TaskManager taskManager = new TaskManager(); | |
| 33 AnalysisDriver analysisDriver; | 30 AnalysisDriver analysisDriver; |
| 34 | 31 |
| 35 Source addSource(String path, String contents) { | 32 Source addSource(String path, String contents) { |
| 36 Source source = newSource(path, contents); | 33 Source source = newSource(path, contents); |
| 37 ChangeSet changeSet = new ChangeSet(); | 34 ChangeSet changeSet = new ChangeSet(); |
| 38 changeSet.addedSource(source); | 35 changeSet.addedSource(source); |
| 39 context.applyChanges(changeSet); | 36 context.applyChanges(changeSet); |
| 40 context.setContents(source, contents); | 37 context.setContents(source, contents); |
| 41 return source; | 38 return source; |
| 42 } | 39 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 return sources; | 85 return sources; |
| 89 } | 86 } |
| 90 | 87 |
| 91 void setUp() { | 88 void setUp() { |
| 92 // configure TaskManager | 89 // configure TaskManager |
| 93 { | 90 { |
| 94 EnginePlugin plugin = AnalysisEngine.instance.enginePlugin; | 91 EnginePlugin plugin = AnalysisEngine.instance.enginePlugin; |
| 95 if (plugin.taskExtensionPoint == null) { | 92 if (plugin.taskExtensionPoint == null) { |
| 96 extensionManager.processPlugins([plugin]); | 93 extensionManager.processPlugins([plugin]); |
| 97 } | 94 } |
| 98 taskManager.addTaskDescriptors(plugin.taskDescriptors); | |
| 99 } | 95 } |
| 100 // prepare AnalysisContext | 96 // prepare AnalysisContext |
| 101 sourceFactory = new SourceFactory(<UriResolver>[ | 97 sourceFactory = new SourceFactory(<UriResolver>[ |
| 102 new DartUriResolver(sdk), | 98 new DartUriResolver(sdk), |
| 103 new ResourceUriResolver(resourceProvider) | 99 new ResourceUriResolver(resourceProvider) |
| 104 ]); | 100 ]); |
| 105 context = createAnalysisContext(); | 101 context = createAnalysisContext(); |
| 106 context.sourceFactory = sourceFactory; | 102 context.sourceFactory = sourceFactory; |
| 107 // prepare AnalysisDriver | 103 analysisDriver = context.driver; |
| 108 analysisDriver = new AnalysisDriver(taskManager, context); | |
| 109 } | 104 } |
| 110 | 105 |
| 111 void tearDown() {} | 106 void tearDown() {} |
| 112 } | 107 } |
| OLD | NEW |