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

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

Issue 1920993002: Support for replacing of the context folder. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 8
9 import 'package:analysis_server/src/context_manager.dart'; 9 import 'package:analysis_server/src/context_manager.dart';
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 2355 matching lines...) Expand 10 before | Expand all | Expand 10 after
2366 * explicitly analyzed in those contexts. 2366 * explicitly analyzed in those contexts.
2367 */ 2367 */
2368 final Map<String, Set<Source>> currentContextSources = 2368 final Map<String, Set<Source>> currentContextSources =
2369 <String, Set<Source>>{}; 2369 <String, Set<Source>>{};
2370 2370
2371 /** 2371 /**
2372 * Resource provider used for this test. 2372 * Resource provider used for this test.
2373 */ 2373 */
2374 final ResourceProvider resourceProvider; 2374 final ResourceProvider resourceProvider;
2375 2375
2376 /**
2377 * The list of `flushedFiles` in the last [removeContext] invocation.
2378 */
2379 List<String> lastFlushedFiles;
2380
2376 TestContextManagerCallbacks(this.resourceProvider); 2381 TestContextManagerCallbacks(this.resourceProvider);
2377 2382
2378 /** 2383 /**
2379 * Iterable of the paths to contexts that currently exist. 2384 * Iterable of the paths to contexts that currently exist.
2380 */ 2385 */
2381 Iterable<String> get currentContextPaths => currentContextTimestamps.keys; 2386 Iterable<String> get currentContextPaths => currentContextTimestamps.keys;
2382 2387
2383 @override 2388 @override
2384 AnalysisContext addContext( 2389 AnalysisContext addContext(
2385 Folder folder, AnalysisOptions options, FolderDisposition disposition) { 2390 Folder folder, AnalysisOptions options, FolderDisposition disposition) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2441 void assertContextPaths(List<String> expected) { 2446 void assertContextPaths(List<String> expected) {
2442 expect(currentContextPaths, unorderedEquals(expected)); 2447 expect(currentContextPaths, unorderedEquals(expected));
2443 } 2448 }
2444 2449
2445 @override 2450 @override
2446 void computingPackageMap(bool computing) { 2451 void computingPackageMap(bool computing) {
2447 // Do nothing. 2452 // Do nothing.
2448 } 2453 }
2449 2454
2450 @override 2455 @override
2456 void moveContext(Folder from, Folder to) {
2457 String path = from.path;
2458 String path2 = to.path;
2459 expect(currentContextFilePaths, contains(path));
2460 expect(currentContextTimestamps, contains(path));
2461 expect(currentContextSources, contains(path));
2462 expect(currentContextFilePaths, isNot(contains(path2)));
2463 expect(currentContextTimestamps, isNot(contains(path2)));
2464 expect(currentContextSources, isNot(contains(path2)));
2465 currentContextFilePaths[path2] = currentContextFilePaths.remove(path);
2466 currentContextTimestamps[path2] = currentContextTimestamps.remove(path);
2467 currentContextSources[path2] = currentContextSources.remove(path);
2468 }
2469
2470 @override
2451 void removeContext(Folder folder, List<String> flushedFiles) { 2471 void removeContext(Folder folder, List<String> flushedFiles) {
2452 String path = folder.path; 2472 String path = folder.path;
2453 expect(currentContextPaths, contains(path)); 2473 expect(currentContextPaths, contains(path));
2454 currentContextTimestamps.remove(path); 2474 currentContextTimestamps.remove(path);
2455 currentContextFilePaths.remove(path); 2475 currentContextFilePaths.remove(path);
2456 currentContextSources.remove(path); 2476 currentContextSources.remove(path);
2477 lastFlushedFiles = flushedFiles;
2457 } 2478 }
2458 2479
2459 @override 2480 @override
2460 void updateContextPackageUriResolver(AnalysisContext context) { 2481 void updateContextPackageUriResolver(AnalysisContext context) {
2461 // Nothing to do. 2482 // Nothing to do.
2462 } 2483 }
2463 2484
2464 /// If [disposition] has a package map, attempt to locate `_embedder.yaml` 2485 /// If [disposition] has a package map, attempt to locate `_embedder.yaml`
2465 /// files. 2486 /// files.
2466 void _locateEmbedderYamls( 2487 void _locateEmbedderYamls(
(...skipping 21 matching lines...) Expand all
2488 class TestUriResolver extends UriResolver { 2509 class TestUriResolver extends UriResolver {
2489 Map<Uri, Source> uriMap; 2510 Map<Uri, Source> uriMap;
2490 2511
2491 TestUriResolver(this.uriMap); 2512 TestUriResolver(this.uriMap);
2492 2513
2493 @override 2514 @override
2494 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 2515 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
2495 return uriMap[uri]; 2516 return uriMap[uri];
2496 } 2517 }
2497 } 2518 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/single_context_manager.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