| 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/cache.dart'; |
| 9 import 'package:analyzer/src/context/context.dart'; | 10 import 'package:analyzer/src/context/context.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart'; | 11 import 'package:analyzer/src/generated/element.dart'; |
| 11 import 'package:analyzer/src/generated/engine.dart' | 12 import 'package:analyzer/src/generated/engine.dart' |
| 12 hide AnalysisContextImpl, AnalysisTask; | 13 hide AnalysisCache, AnalysisContextImpl, AnalysisTask; |
| 13 import 'package:analyzer/src/generated/sdk.dart'; | 14 import 'package:analyzer/src/generated/sdk.dart'; |
| 14 import 'package:analyzer/src/generated/source.dart'; | 15 import 'package:analyzer/src/generated/source.dart'; |
| 15 import 'package:analyzer/src/task/driver.dart'; | 16 import 'package:analyzer/src/task/driver.dart'; |
| 16 import 'package:unittest/unittest.dart'; | 17 import 'package:unittest/unittest.dart'; |
| 17 | 18 |
| 18 import 'mock_sdk.dart'; | 19 import 'mock_sdk.dart'; |
| 19 | 20 |
| 20 class AbstractContextTest { | 21 class AbstractContextTest { |
| 21 MemoryResourceProvider resourceProvider = new MemoryResourceProvider(); | 22 MemoryResourceProvider resourceProvider = new MemoryResourceProvider(); |
| 22 | 23 |
| 23 DartSdk sdk = new MockSdk(); | 24 DartSdk sdk = new MockSdk(); |
| 24 SourceFactory sourceFactory; | 25 SourceFactory sourceFactory; |
| 25 AnalysisContextImpl context; | 26 AnalysisContextImpl context; |
| 27 AnalysisCache analysisCache; |
| 26 AnalysisDriver analysisDriver; | 28 AnalysisDriver analysisDriver; |
| 27 | 29 |
| 28 Source addSource(String path, String contents) { | 30 Source addSource(String path, String contents) { |
| 29 Source source = newSource(path, contents); | 31 Source source = newSource(path, contents); |
| 30 ChangeSet changeSet = new ChangeSet(); | 32 ChangeSet changeSet = new ChangeSet(); |
| 31 changeSet.addedSource(source); | 33 changeSet.addedSource(source); |
| 32 context.applyChanges(changeSet); | 34 context.applyChanges(changeSet); |
| 33 return source; | 35 return source; |
| 34 } | 36 } |
| 35 | 37 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 83 } |
| 82 | 84 |
| 83 void setUp() { | 85 void setUp() { |
| 84 // prepare AnalysisContext | 86 // prepare AnalysisContext |
| 85 sourceFactory = new SourceFactory(<UriResolver>[ | 87 sourceFactory = new SourceFactory(<UriResolver>[ |
| 86 new DartUriResolver(sdk), | 88 new DartUriResolver(sdk), |
| 87 new ResourceUriResolver(resourceProvider) | 89 new ResourceUriResolver(resourceProvider) |
| 88 ]); | 90 ]); |
| 89 context = createAnalysisContext(); | 91 context = createAnalysisContext(); |
| 90 context.sourceFactory = sourceFactory; | 92 context.sourceFactory = sourceFactory; |
| 93 analysisCache = context.analysisCache; |
| 91 analysisDriver = context.driver; | 94 analysisDriver = context.driver; |
| 92 } | 95 } |
| 93 | 96 |
| 94 void tearDown() {} | 97 void tearDown() {} |
| 95 } | 98 } |
| OLD | NEW |