Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: pkg/analyzer/test/src/context/abstract_context.dart

Issue 1441013003: Issue 24812. Fix for detached CompilationUnitElement(s) after package version switch. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10 matching lines...) Expand all
21 21
22 class AbstractContextTest { 22 class AbstractContextTest {
23 MemoryResourceProvider resourceProvider = new MemoryResourceProvider(); 23 MemoryResourceProvider resourceProvider = new MemoryResourceProvider();
24 24
25 DartSdk sdk = new MockSdk(); 25 DartSdk sdk = new MockSdk();
26 SourceFactory sourceFactory; 26 SourceFactory sourceFactory;
27 AnalysisContextImpl context; 27 AnalysisContextImpl context;
28 AnalysisCache analysisCache; 28 AnalysisCache analysisCache;
29 AnalysisDriver analysisDriver; 29 AnalysisDriver analysisDriver;
30 30
31 UriResolver sdkResolver;
32 UriResolver resourceResolver;
33
31 AnalysisTask task; 34 AnalysisTask task;
32 Map<ResultDescriptor<dynamic>, dynamic> oldOutputs; 35 Map<ResultDescriptor<dynamic>, dynamic> oldOutputs;
33 Map<ResultDescriptor<dynamic>, dynamic> outputs; 36 Map<ResultDescriptor<dynamic>, dynamic> outputs;
34 37
35 Source addSource(String path, String contents) { 38 Source addSource(String path, String contents) {
36 Source source = newSource(path, contents); 39 Source source = newSource(path, contents);
37 ChangeSet changeSet = new ChangeSet(); 40 ChangeSet changeSet = new ChangeSet();
38 changeSet.addedSource(source); 41 changeSet.addedSource(source);
39 context.applyChanges(changeSet); 42 context.applyChanges(changeSet);
40 return source; 43 return source;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 List<Source> newSources(Map<String, String> sourceMap) { 103 List<Source> newSources(Map<String, String> sourceMap) {
101 List<Source> sources = <Source>[]; 104 List<Source> sources = <Source>[];
102 sourceMap.forEach((String path, String content) { 105 sourceMap.forEach((String path, String content) {
103 Source source = newSource(path, content); 106 Source source = newSource(path, content);
104 sources.add(source); 107 sources.add(source);
105 }); 108 });
106 return sources; 109 return sources;
107 } 110 }
108 111
109 void prepareAnalysisContext([AnalysisOptions options]) { 112 void prepareAnalysisContext([AnalysisOptions options]) {
110 sourceFactory = new SourceFactory(<UriResolver>[ 113 sdkResolver = new DartUriResolver(sdk);
111 new DartUriResolver(sdk), 114 resourceResolver = new ResourceUriResolver(resourceProvider);
112 new ResourceUriResolver(resourceProvider) 115 sourceFactory =
113 ]); 116 new SourceFactory(<UriResolver>[sdkResolver, resourceResolver]);
114 context = createAnalysisContext(); 117 context = createAnalysisContext();
115 if (options != null) { 118 if (options != null) {
116 context.analysisOptions = options; 119 context.analysisOptions = options;
117 } 120 }
118 context.sourceFactory = sourceFactory; 121 context.sourceFactory = sourceFactory;
119 analysisCache = context.analysisCache; 122 analysisCache = context.analysisCache;
120 analysisDriver = context.driver; 123 analysisDriver = context.driver;
121 } 124 }
122 125
123 void setUp() { 126 void setUp() {
124 prepareAnalysisContext(); 127 prepareAnalysisContext();
125 } 128 }
126 129
127 void tearDown() {} 130 void tearDown() {}
128 } 131 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/dart_work_manager.dart ('k') | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698