OLD | NEW |
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.source.caching_pub_package_map_provider; | 5 library test.source.caching_pub_package_map_provider; |
6 | 6 |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
9 import 'dart:io' as io; | 9 import 'dart:io' as io; |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 Folder newProj(Map result) { | 43 Folder newProj(Map result) { |
44 Map packages = result['packages']; | 44 Map packages = result['packages']; |
45 packages.forEach((String name, String path) { | 45 packages.forEach((String name, String path) { |
46 resProvider.newFolder(path); | 46 resProvider.newFolder(path); |
47 }); | 47 }); |
48 List<String> inputFiles = result['input_files']; | 48 List<String> inputFiles = result['input_files']; |
49 for (String path in inputFiles) { | 49 for (String path in inputFiles) { |
50 resProvider.newFile(path, ''); | 50 resProvider.newFile(path, ''); |
51 } | 51 } |
52 return resProvider.getResource(inputFiles[0]).parent; | 52 Folder projectFolder = resProvider.getResource(inputFiles[0]).parent; |
| 53 resProvider.newFile(projectFolder.path + '/pubspec.lock', ''); |
| 54 return projectFolder; |
53 } | 55 } |
54 | 56 |
55 int mockWriteFile(File cacheFile, String content) { | 57 int mockWriteFile(File cacheFile, String content) { |
56 if (writeFileException) { | 58 if (writeFileException) { |
57 throw 'simulated write failure: $cacheFile'; | 59 throw 'simulated write failure: $cacheFile'; |
58 } | 60 } |
59 if (!cacheFile.exists) { | 61 if (!cacheFile.exists) { |
60 resProvider.newFolder(cacheFile.parent.path); | 62 resProvider.newFolder(cacheFile.parent.path); |
61 resProvider.newFile(cacheFile.path, content); | 63 resProvider.newFile(cacheFile.path, content); |
62 } else { | 64 } else { |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 provider.newFolder(path); | 393 provider.newFolder(path); |
392 } | 394 } |
393 int fileCount = _filePaths.length; | 395 int fileCount = _filePaths.length; |
394 for (int fileIndex = 0; fileIndex < fileCount; ++fileIndex) { | 396 for (int fileIndex = 0; fileIndex < fileCount; ++fileIndex) { |
395 String path = _filePaths[fileIndex]; | 397 String path = _filePaths[fileIndex]; |
396 TimestampedData content = _fileContents[fileIndex]; | 398 TimestampedData content = _fileContents[fileIndex]; |
397 provider.newFile(path, content.data, content.modificationTime); | 399 provider.newFile(path, content.data, content.modificationTime); |
398 } | 400 } |
399 } | 401 } |
400 } | 402 } |
OLD | NEW |