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

Side by Side Diff: pkg/watcher/test/utils.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: Fixes 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 watcher.test.utils; 5 library watcher.test.utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // Make sure we got a path in the sandbox. 64 // Make sure we got a path in the sandbox.
65 assert(p.isRelative(path) && !path.startsWith("..")); 65 assert(p.isRelative(path) && !path.startsWith(".."));
66 66
67 var mtime = _mockFileModificationTimes[path]; 67 var mtime = _mockFileModificationTimes[path];
68 return new DateTime.fromMillisecondsSinceEpoch(mtime == null ? 0 : mtime); 68 return new DateTime.fromMillisecondsSinceEpoch(mtime == null ? 0 : mtime);
69 }); 69 });
70 70
71 // Delete the sandbox when done. 71 // Delete the sandbox when done.
72 currentSchedule.onComplete.schedule(() { 72 currentSchedule.onComplete.schedule(() {
73 if (_sandboxDir != null) { 73 if (_sandboxDir != null) {
74 // TODO(rnystrom): Issue 19155. The watcher should already be closed when
75 // we clean up the sandbox.
76 if (_watcherEvents != null) {
77 _watcherEvents.close();
78 }
74 new Directory(_sandboxDir).deleteSync(recursive: true); 79 new Directory(_sandboxDir).deleteSync(recursive: true);
75 _sandboxDir = null; 80 _sandboxDir = null;
76 } 81 }
77 82
78 _mockFileModificationTimes = null; 83 _mockFileModificationTimes = null;
79 mockGetModificationTime(null); 84 mockGetModificationTime(null);
80 }, "delete sandbox"); 85 }, "delete sandbox");
81 } 86 }
82 87
83 /// Creates a new [DirectoryWatcher] that watches a temporary directory. 88 /// Creates a new [DirectoryWatcher] that watches a temporary directory.
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 var results = new Set(); 390 var results = new Set();
386 for (var i = 0; i < limit; i++) { 391 for (var i = 0; i < limit; i++) {
387 for (var j = 0; j < limit; j++) { 392 for (var j = 0; j < limit; j++) {
388 for (var k = 0; k < limit; k++) { 393 for (var k = 0; k < limit; k++) {
389 results.add(callback(i, j, k)); 394 results.add(callback(i, j, k));
390 } 395 }
391 } 396 }
392 } 397 }
393 return results; 398 return results;
394 } 399 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698