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

Side by Side Diff: pkg/analysis_server/test/context_manager_test.dart

Issue 2323173002: Remove several references to JavaFile (Closed)
Patch Set: Created 4 years, 3 months 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) 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.context.directory.manager; 5 library test.context.directory.manager;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:io' as io;
8 9
9 import 'package:analysis_server/src/context_manager.dart'; 10 import 'package:analysis_server/src/context_manager.dart';
10 import 'package:analyzer/file_system/file_system.dart'; 11 import 'package:analyzer/file_system/file_system.dart';
11 import 'package:analyzer/file_system/memory_file_system.dart'; 12 import 'package:analyzer/file_system/memory_file_system.dart';
12 import 'package:analyzer/instrumentation/instrumentation.dart'; 13 import 'package:analyzer/instrumentation/instrumentation.dart';
13 import 'package:analyzer/source/error_processor.dart'; 14 import 'package:analyzer/source/error_processor.dart';
14 import 'package:analyzer/src/context/builder.dart'; 15 import 'package:analyzer/src/context/builder.dart';
15 import 'package:analyzer/src/dart/sdk/sdk.dart'; 16 import 'package:analyzer/src/dart/sdk/sdk.dart';
16 import 'package:analyzer/src/generated/engine.dart'; 17 import 'package:analyzer/src/generated/engine.dart';
17 import 'package:analyzer/src/generated/error.dart'; 18 import 'package:analyzer/src/generated/error.dart';
18 import 'package:analyzer/src/generated/java_io.dart';
19 import 'package:analyzer/src/generated/sdk.dart'; 19 import 'package:analyzer/src/generated/sdk.dart';
20 import 'package:analyzer/src/generated/source.dart'; 20 import 'package:analyzer/src/generated/source.dart';
21 import 'package:analyzer/src/generated/source_io.dart'; 21 import 'package:analyzer/src/generated/source_io.dart';
22 import 'package:analyzer/src/services/lint.dart'; 22 import 'package:analyzer/src/services/lint.dart';
23 import 'package:analyzer/src/util/glob.dart'; 23 import 'package:analyzer/src/util/glob.dart';
24 import 'package:linter/src/plugin/linter_plugin.dart'; 24 import 'package:linter/src/plugin/linter_plugin.dart';
25 import 'package:linter/src/rules/avoid_as.dart'; 25 import 'package:linter/src/rules/avoid_as.dart';
26 import 'package:path/path.dart'; 26 import 'package:path/path.dart';
27 import 'package:plugin/manager.dart'; 27 import 'package:plugin/manager.dart';
28 import 'package:plugin/plugin.dart'; 28 import 'package:plugin/plugin.dart';
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 147 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
148 await pumpEventQueue(); 148 await pumpEventQueue();
149 // Confirm that one context was created. 149 // Confirm that one context was created.
150 var contexts = 150 var contexts =
151 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath)); 151 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
152 expect(contexts, isNotNull); 152 expect(contexts, isNotNull);
153 expect(contexts.length, equals(1)); 153 expect(contexts.length, equals(1));
154 var context = contexts[0]; 154 var context = contexts[0];
155 var source = context.sourceFactory.forUri('dart:foobar'); 155 var source = context.sourceFactory.forUri('dart:foobar');
156 expect(source, isNotNull); 156 expect(source, isNotNull);
157 expect(source.fullName, 157 expect(
158 '/my/proj/sdk_ext/entry.dart'.replaceAll('/', JavaFile.separator)); 158 source.fullName,
159 '/my/proj/sdk_ext/entry.dart'
160 .replaceAll('/', io.Platform.pathSeparator));
159 // We can't find dart:core because we didn't list it in our 161 // We can't find dart:core because we didn't list it in our
160 // embedded_libs map. 162 // embedded_libs map.
161 expect(context.sourceFactory.forUri('dart:core'), isNull); 163 expect(context.sourceFactory.forUri('dart:core'), isNull);
162 // We can find dart:typed_data because we listed it in our 164 // We can find dart:typed_data because we listed it in our
163 // embedded_libs map. 165 // embedded_libs map.
164 expect(context.sourceFactory.forUri('dart:typed_data'), isNotNull); 166 expect(context.sourceFactory.forUri('dart:typed_data'), isNotNull);
165 } 167 }
166 168
167 test_ignoreFilesInPackagesFolder() { 169 test_ignoreFilesInPackagesFolder() {
168 // create a context with a pubspec.yaml file 170 // create a context with a pubspec.yaml file
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1764 1766
1765 List<Glob> get analysisFilesGlobs { 1767 List<Glob> get analysisFilesGlobs {
1766 List<String> patterns = <String>[ 1768 List<String> patterns = <String>[
1767 '**/*.${AnalysisEngine.SUFFIX_DART}', 1769 '**/*.${AnalysisEngine.SUFFIX_DART}',
1768 '**/*.${AnalysisEngine.SUFFIX_HTML}', 1770 '**/*.${AnalysisEngine.SUFFIX_HTML}',
1769 '**/*.${AnalysisEngine.SUFFIX_HTM}', 1771 '**/*.${AnalysisEngine.SUFFIX_HTM}',
1770 '**/${AnalysisEngine.ANALYSIS_OPTIONS_FILE}', 1772 '**/${AnalysisEngine.ANALYSIS_OPTIONS_FILE}',
1771 '**/${AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE}' 1773 '**/${AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE}'
1772 ]; 1774 ];
1773 return patterns 1775 return patterns
1774 .map((pattern) => new Glob(JavaFile.pathContext.separator, pattern)) 1776 .map((pattern) => new Glob(posix.separator, pattern))
1775 .toList(); 1777 .toList();
1776 } 1778 }
1777 1779
1778 List<ErrorProcessor> get errorProcessors => callbacks.currentContext 1780 List<ErrorProcessor> get errorProcessors => callbacks.currentContext
1779 .getConfigurationData(CONFIGURED_ERROR_PROCESSORS); 1781 .getConfigurationData(CONFIGURED_ERROR_PROCESSORS);
1780 1782
1781 List<Linter> get lints => getLints(callbacks.currentContext); 1783 List<Linter> get lints => getLints(callbacks.currentContext);
1782 1784
1783 AnalysisOptions get options => callbacks.currentContext.analysisOptions; 1785 AnalysisOptions get options => callbacks.currentContext.analysisOptions;
1784 1786
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 lintNames, 2188 lintNames,
2187 unorderedEquals([ 2189 unorderedEquals([
2188 'avoid_as' /* embedder */, 2190 'avoid_as' /* embedder */,
2189 'always_specify_types' /* config*/, 2191 'always_specify_types' /* config*/,
2190 'camel_case_types' /* options */ 2192 'camel_case_types' /* options */
2191 ])); 2193 ]));
2192 2194
2193 // Sanity check embedder libs. 2195 // Sanity check embedder libs.
2194 var source = context.sourceFactory.forUri('dart:foobar'); 2196 var source = context.sourceFactory.forUri('dart:foobar');
2195 expect(source, isNotNull); 2197 expect(source, isNotNull);
2196 expect(source.fullName, 2198 expect(
2197 '/my/proj/sdk_ext/entry.dart'.replaceAll('/', JavaFile.separator)); 2199 source.fullName,
2200 '/my/proj/sdk_ext/entry.dart'
2201 .replaceAll('/', io.Platform.pathSeparator));
2198 } 2202 }
2199 2203
2200 test_embedder_options() async { 2204 test_embedder_options() async {
2201 // Create files. 2205 // Create files.
2202 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 2206 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
2203 String sdkExtPath = newFolder([projPath, 'sdk_ext']); 2207 String sdkExtPath = newFolder([projPath, 'sdk_ext']);
2204 newFile([projPath, 'test', 'test.dart']); 2208 newFile([projPath, 'test', 'test.dart']);
2205 newFile([sdkExtPath, 'entry.dart']); 2209 newFile([sdkExtPath, 'entry.dart']);
2206 // Setup _embedder.yaml. 2210 // Setup _embedder.yaml.
2207 newFile( 2211 newFile(
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2280 var lintNames = lints.map((lint) => lint.name); 2284 var lintNames = lints.map((lint) => lint.name);
2281 2285
2282 expect( 2286 expect(
2283 lintNames, 2287 lintNames,
2284 unorderedEquals( 2288 unorderedEquals(
2285 ['avoid_as' /* embedder */, 'camel_case_types' /* options */])); 2289 ['avoid_as' /* embedder */, 'camel_case_types' /* options */]));
2286 2290
2287 // Sanity check embedder libs. 2291 // Sanity check embedder libs.
2288 var source = context.sourceFactory.forUri('dart:foobar'); 2292 var source = context.sourceFactory.forUri('dart:foobar');
2289 expect(source, isNotNull); 2293 expect(source, isNotNull);
2290 expect(source.fullName, 2294 expect(
2291 '/my/proj/sdk_ext/entry.dart'.replaceAll('/', JavaFile.separator)); 2295 source.fullName,
2296 '/my/proj/sdk_ext/entry.dart'
2297 .replaceAll('/', io.Platform.pathSeparator));
2292 } 2298 }
2293 2299
2294 test_error_filter_analysis_option() async { 2300 test_error_filter_analysis_option() async {
2295 // Create files. 2301 // Create files.
2296 newFile( 2302 newFile(
2297 [projPath, optionsFileName], 2303 [projPath, optionsFileName],
2298 r''' 2304 r'''
2299 analyzer: 2305 analyzer:
2300 errors: 2306 errors:
2301 unused_local_variable: ignore 2307 unused_local_variable: ignore
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
2757 class TestUriResolver extends UriResolver { 2763 class TestUriResolver extends UriResolver {
2758 Map<Uri, Source> uriMap; 2764 Map<Uri, Source> uriMap;
2759 2765
2760 TestUriResolver(this.uriMap); 2766 TestUriResolver(this.uriMap);
2761 2767
2762 @override 2768 @override
2763 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 2769 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
2764 return uriMap[uri]; 2770 return uriMap[uri];
2765 } 2771 }
2766 } 2772 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_server/test/single_context_manager_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698