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

Side by Side Diff: pkg/analyzer/lib/file_system/memory_file_system.dart

Issue 2393663002: More fixes for testing under windows (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | pkg/analyzer/test/file_system/memory_file_system_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 analyzer.file_system.memory_file_system; 5 library analyzer.file_system.memory_file_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'dart:core'; 10 import 'dart:core';
(...skipping 18 matching lines...) Expand all
29 new HashMap<String, List<StreamController<WatchEvent>>>(); 29 new HashMap<String, List<StreamController<WatchEvent>>>();
30 int nextStamp = 0; 30 int nextStamp = 0;
31 31
32 final pathos.Context _pathContext; 32 final pathos.Context _pathContext;
33 33
34 @override 34 @override
35 final AbsolutePathContext absolutePathContext; 35 final AbsolutePathContext absolutePathContext;
36 36
37 MemoryResourceProvider( 37 MemoryResourceProvider(
38 {pathos.Context context, @deprecated bool isWindows: false}) 38 {pathos.Context context, @deprecated bool isWindows: false})
39 : _pathContext = context ?? pathos.context, 39 : _pathContext = (context ??= pathos.context),
40 absolutePathContext = new AbsolutePathContext( 40 absolutePathContext =
41 pathos.Style.platform == pathos.Style.windows); 41 new AbsolutePathContext(context.style == pathos.Style.windows);
42 42
43 @override 43 @override
44 pathos.Context get pathContext => _pathContext; 44 pathos.Context get pathContext => _pathContext;
45 45
46 /** 46 /**
47 * Convert the given posix [path] to conform to this provider's path context. 47 * Convert the given posix [path] to conform to this provider's path context.
48 * 48 *
49 * This is a utility method for testing; paths passed in to other methods in 49 * This is a utility method for testing; paths passed in to other methods in
50 * this class are never converted automatically. 50 * this class are never converted automatically.
51 */ 51 */
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 410
411 @override 411 @override
412 File renameSync(String newPath) { 412 File renameSync(String newPath) {
413 return _provider.renameFileSync(this, newPath); 413 return _provider.renameFileSync(this, newPath);
414 } 414 }
415 415
416 @override 416 @override
417 File resolveSymbolicLinksSync() => this; 417 File resolveSymbolicLinksSync() => this;
418 418
419 @override 419 @override
420 Uri toUri() =>
421 new Uri.file(path, windows: _provider.pathContext == pathos.windows);
422
423 @override
424 void writeAsBytesSync(List<int> bytes) { 420 void writeAsBytesSync(List<int> bytes) {
425 _provider._setFileContent(this, bytes); 421 _provider._setFileContent(this, bytes);
426 } 422 }
427 423
428 @override 424 @override
429 void writeAsStringSync(String content) { 425 void writeAsStringSync(String content) {
430 _provider._setFileContent(this, UTF8.encode(content)); 426 _provider._setFileContent(this, UTF8.encode(content));
431 } 427 }
432 } 428 }
433 429
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 @override 502 @override
507 bool isOrContains(String path) { 503 bool isOrContains(String path) {
508 if (path == this.path) { 504 if (path == this.path) {
509 return true; 505 return true;
510 } 506 }
511 return contains(path); 507 return contains(path);
512 } 508 }
513 509
514 @override 510 @override
515 Folder resolveSymbolicLinksSync() => this; 511 Folder resolveSymbolicLinksSync() => this;
516
517 @override
518 Uri toUri() =>
519 new Uri.directory(path, windows: _provider.pathContext == pathos.windows);
520 } 512 }
521 513
522 /** 514 /**
523 * An in-memory implementation of [Resource]. 515 * An in-memory implementation of [Resource].
524 */ 516 */
525 abstract class _MemoryResource implements Resource { 517 abstract class _MemoryResource implements Resource {
526 final MemoryResourceProvider _provider; 518 final MemoryResourceProvider _provider;
527 @override 519 @override
528 final String path; 520 final String path;
529 521
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 @override 555 @override
564 bool operator ==(other) { 556 bool operator ==(other) {
565 if (runtimeType != other.runtimeType) { 557 if (runtimeType != other.runtimeType) {
566 return false; 558 return false;
567 } 559 }
568 return path == other.path; 560 return path == other.path;
569 } 561 }
570 562
571 @override 563 @override
572 String toString() => path; 564 String toString() => path;
565
566 @override
567 Uri toUri() => _provider.pathContext.toUri(path);
573 } 568 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/file_system/memory_file_system_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698