| 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/cache.dart'; |
| 10 import 'package:analyzer/src/context/context.dart'; | 10 import 'package:analyzer/src/context/context.dart'; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 List<Source> newSources(Map<String, String> sourceMap) { | 92 List<Source> newSources(Map<String, String> sourceMap) { |
| 93 List<Source> sources = <Source>[]; | 93 List<Source> sources = <Source>[]; |
| 94 sourceMap.forEach((String path, String content) { | 94 sourceMap.forEach((String path, String content) { |
| 95 Source source = newSource(path, content); | 95 Source source = newSource(path, content); |
| 96 sources.add(source); | 96 sources.add(source); |
| 97 }); | 97 }); |
| 98 return sources; | 98 return sources; |
| 99 } | 99 } |
| 100 | 100 |
| 101 void setUp() { | 101 void prepareAnalysisContext([AnalysisOptions options]) { |
| 102 // prepare AnalysisContext | |
| 103 sourceFactory = new SourceFactory(<UriResolver>[ | 102 sourceFactory = new SourceFactory(<UriResolver>[ |
| 104 new DartUriResolver(sdk), | 103 new DartUriResolver(sdk), |
| 105 new ResourceUriResolver(resourceProvider) | 104 new ResourceUriResolver(resourceProvider) |
| 106 ]); | 105 ]); |
| 107 context = createAnalysisContext(); | 106 context = createAnalysisContext(); |
| 107 if (options != null) { |
| 108 context.analysisOptions = options; |
| 109 } |
| 108 context.sourceFactory = sourceFactory; | 110 context.sourceFactory = sourceFactory; |
| 109 analysisCache = context.analysisCache; | 111 analysisCache = context.analysisCache; |
| 110 analysisDriver = context.driver; | 112 analysisDriver = context.driver; |
| 111 } | 113 } |
| 112 | 114 |
| 115 void setUp() { |
| 116 prepareAnalysisContext(); |
| 117 } |
| 118 |
| 113 void tearDown() {} | 119 void tearDown() {} |
| 114 } | 120 } |
| OLD | NEW |