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

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

Issue 312743002: Use 'Directory.watch' on Windows in pkg/watcher, instead of pooling. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/pkg.status » ('j') | pkg/watcher/lib/src/directory_watcher.dart » ('J')
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 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
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 // On Windows, watching the filesystem is accomplished by polling once 35 return new Future.delayed(new Duration(milliseconds: 100), computation );
Søren Gjesse 2014/06/03 14:14:53 Long line.
Anders Johnsen 2014/06/04 08:46:46 Done.
36 // per second. So wait 2 seconds to give time for polling to reliably
37 // occur.
38 return new Future.delayed(new Duration(seconds: 2), computation);
39 } 36 }
40 37
41 watchingFolder(String path, test(List<WatchEvent> changesReceived)) { 38 watchingFolder(String path, test(List<WatchEvent> changesReceived)) {
42 // Delay before we start watching the folder. This is necessary 39 // Delay before we start watching the folder. This is necessary
43 // because on MacOS, file modifications that occur just before we star t 40 // because on MacOS, file modifications that occur just before we star t
44 // watching are sometimes misclassified as happening just after we 41 // watching are sometimes misclassified as happening just after we
45 // start watching. 42 // start watching.
46 return delayed(() { 43 return delayed(() {
47 Folder folder = PhysicalResourceProvider.INSTANCE.getResource(path); 44 Folder folder = PhysicalResourceProvider.INSTANCE.getResource(path);
48 var changesReceived = <WatchEvent>[]; 45 var changesReceived = <WatchEvent>[];
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 expect(children[1], _isFolder); 211 expect(children[1], _isFolder);
215 expect(children[2], _isFile); 212 expect(children[2], _isFile);
216 }); 213 });
217 }); 214 });
218 }); 215 });
219 } 216 }
220 217
221 var _isFile = new isInstanceOf<File>(); 218 var _isFile = new isInstanceOf<File>();
222 var _isFolder = new isInstanceOf<Folder>(); 219 var _isFolder = new isInstanceOf<Folder>();
223 var _isMemoryResourceException = new isInstanceOf<MemoryResourceException>(); 220 var _isMemoryResourceException = new isInstanceOf<MemoryResourceException>();
OLDNEW
« no previous file with comments | « no previous file | pkg/pkg.status » ('j') | pkg/watcher/lib/src/directory_watcher.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698