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

Side by Side Diff: pkg/analyzer/test/resource_utils.dart

Issue 2132073003: Validate cache consistency asynchronously. Compute modification times of physical files in a separa… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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) 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 analyzer.test.resource_utils; 5 library analyzer.test.resource_utils;
6 6
7 import 'dart:async';
7 import 'dart:core' hide Resource; 8 import 'dart:core' hide Resource;
8 9
9 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
10 import 'package:analyzer/file_system/memory_file_system.dart'; 11 import 'package:analyzer/file_system/memory_file_system.dart';
12 import 'package:analyzer/src/generated/source.dart';
11 import 'package:analyzer/src/util/absolute_path.dart'; 13 import 'package:analyzer/src/util/absolute_path.dart';
12 import 'package:path/path.dart' as path; 14 import 'package:path/path.dart' as path;
13 import 'package:unittest/unittest.dart'; 15 import 'package:unittest/unittest.dart';
14 16
15 bool get isWindows => path.Style.platform == path.Style.windows; 17 bool get isWindows => path.Style.platform == path.Style.windows;
16 18
17 /** 19 /**
18 * Assert that the given path is posix and absolute. 20 * Assert that the given path is posix and absolute.
19 */ 21 */
20 void expectAbsolutePosixPath(String posixPath) { 22 void expectAbsolutePosixPath(String posixPath) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 @override 99 @override
98 path.Context get pathContext => _provider.pathContext; 100 path.Context get pathContext => _provider.pathContext;
99 101
100 @override 102 @override
101 File getFile(String path) => _provider.getFile(_assertPath(path)); 103 File getFile(String path) => _provider.getFile(_assertPath(path));
102 104
103 @override 105 @override
104 Folder getFolder(String path) => _provider.getFolder(_assertPath(path)); 106 Folder getFolder(String path) => _provider.getFolder(_assertPath(path));
105 107
106 @override 108 @override
109 Future<List<int>> getModificationTimes(List<Source> sources) async {
110 return sources.map((source) => 0).toList();
111 }
112
113 @override
107 Resource getResource(String path) => _provider.getResource(_assertPath(path)); 114 Resource getResource(String path) => _provider.getResource(_assertPath(path));
108 115
109 @override 116 @override
110 Folder getStateLocation(String pluginId) => 117 Folder getStateLocation(String pluginId) =>
111 _provider.getStateLocation(pluginId); 118 _provider.getStateLocation(pluginId);
112 119
113 /** 120 /**
114 * Assert that the given path is valid for the OS platform on which the 121 * Assert that the given path is valid for the OS platform on which the
115 * tests are running. 122 * tests are running.
116 */ 123 */
117 String _assertPath(String path) { 124 String _assertPath(String path) {
118 if (isWindows) { 125 if (isWindows) {
119 if (path.contains('/')) { 126 if (path.contains('/')) {
120 fail('Expected windows path, but found: $path'); 127 fail('Expected windows path, but found: $path');
121 } 128 }
122 } else { 129 } else {
123 if (path.contains('\\')) { 130 if (path.contains('\\')) {
124 fail('Expected posix path, but found: $path'); 131 fail('Expected posix path, but found: $path');
125 } 132 }
126 } 133 }
127 return path; 134 return path;
128 } 135 }
129 } 136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698