OLD | NEW |
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.physical.resource.provider; | 5 library test.physical.resource.provider; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
9 | 9 |
10 import 'package:analysis_server/src/resource.dart'; | 10 import 'package:analysis_server/src/resource.dart'; |
(...skipping 14 matching lines...) Expand all Loading... |
25 tempPath = tempDirectory.absolute.path; | 25 tempPath = tempDirectory.absolute.path; |
26 }); | 26 }); |
27 | 27 |
28 tearDown(() { | 28 tearDown(() { |
29 tempDirectory.deleteSync(recursive: true); | 29 tempDirectory.deleteSync(recursive: true); |
30 }); | 30 }); |
31 | 31 |
32 group('Watch', () { | 32 group('Watch', () { |
33 | 33 |
34 Future delayed(computation()) { | 34 Future delayed(computation()) { |
| 35 // Give the tests 1 second to detect the changes. While it may only |
| 36 // take up to a few hundred ms, a whole second gives a good margin |
| 37 // for when running tests. |
35 return new Future.delayed( | 38 return new Future.delayed( |
36 new Duration(seconds: 1), computation); | 39 new Duration(seconds: 1), computation); |
37 } | 40 } |
38 | 41 |
39 watchingFolder(String path, test(List<WatchEvent> changesReceived)) { | 42 watchingFolder(String path, test(List<WatchEvent> changesReceived)) { |
40 // Delay before we start watching the folder. This is necessary | 43 // Delay before we start watching the folder. This is necessary |
41 // because on MacOS, file modifications that occur just before we | 44 // because on MacOS, file modifications that occur just before we |
42 // start watching are sometimes misclassified as happening just after | 45 // start watching are sometimes misclassified as happening just after |
43 // we start watching. | 46 // we start watching. |
44 return delayed(() { | 47 return delayed(() { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 expect(children[1], _isFolder); | 216 expect(children[1], _isFolder); |
214 expect(children[2], _isFile); | 217 expect(children[2], _isFile); |
215 }); | 218 }); |
216 }); | 219 }); |
217 }); | 220 }); |
218 } | 221 } |
219 | 222 |
220 var _isFile = new isInstanceOf<File>(); | 223 var _isFile = new isInstanceOf<File>(); |
221 var _isFolder = new isInstanceOf<Folder>(); | 224 var _isFolder = new isInstanceOf<Folder>(); |
222 var _isMemoryResourceException = new isInstanceOf<MemoryResourceException>(); | 225 var _isMemoryResourceException = new isInstanceOf<MemoryResourceException>(); |
OLD | NEW |