| 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.services.completion.toplevel; | 5 library test.services.completion.toplevel; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
| 8 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; | 8 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; |
| 9 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; | 9 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; |
| 10 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 10 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 203 |
| 204 /** | 204 /** |
| 205 * Ensure that completions in one context don't appear in another | 205 * Ensure that completions in one context don't appear in another |
| 206 */ | 206 */ |
| 207 test_multiple_contexts() { | 207 test_multiple_contexts() { |
| 208 | 208 |
| 209 // Create a 2nd context with source | 209 // Create a 2nd context with source |
| 210 var context2 = AnalysisEngine.instance.createAnalysisContext(); | 210 var context2 = AnalysisEngine.instance.createAnalysisContext(); |
| 211 context2.sourceFactory = | 211 context2.sourceFactory = |
| 212 new SourceFactory([AbstractContextTest.SDK_RESOLVER, resourceResolver]); | 212 new SourceFactory([AbstractContextTest.SDK_RESOLVER, resourceResolver]); |
| 213 { | |
| 214 AnalysisOptionsImpl options = | |
| 215 new AnalysisOptionsImpl.con1(context2.analysisOptions); | |
| 216 options.enableAsync = true; | |
| 217 options.enableEnum = true; | |
| 218 context2.analysisOptions = options; | |
| 219 } | |
| 220 String content2 = 'class ClassFromAnotherContext { }'; | 213 String content2 = 'class ClassFromAnotherContext { }'; |
| 221 Source source2 = | 214 Source source2 = |
| 222 provider.newFile('/context2/foo.dart', content2).createSource(); | 215 provider.newFile('/context2/foo.dart', content2).createSource(); |
| 223 ChangeSet changeSet = new ChangeSet(); | 216 ChangeSet changeSet = new ChangeSet(); |
| 224 changeSet.addedSource(source2); | 217 changeSet.addedSource(source2); |
| 225 context2.applyChanges(changeSet); | 218 context2.applyChanges(changeSet); |
| 226 context2.setContents(source2, content2); | 219 context2.setContents(source2, content2); |
| 227 | 220 |
| 228 // Resolve the source in the 2nd context and update the index | 221 // Resolve the source in the 2nd context and update the index |
| 229 var result = context2.performAnalysisTask(); | 222 var result = context2.performAnalysisTask(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 257 |
| 265 @override | 258 @override |
| 266 test_partFile_TypeName2() { | 259 test_partFile_TypeName2() { |
| 267 return super.test_partFile_TypeName2().then((_) { | 260 return super.test_partFile_TypeName2().then((_) { |
| 268 expect( | 261 expect( |
| 269 request.cache.importKey, | 262 request.cache.importKey, |
| 270 'library libA;import "/testB.dart";part "/testA.dart";'); | 263 'library libA;import "/testB.dart";part "/testA.dart";'); |
| 271 }); | 264 }); |
| 272 } | 265 } |
| 273 } | 266 } |
| OLD | NEW |