| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import "dart:async"; | 5 import "dart:async"; |
| 6 import "dart:io"; | 6 import "dart:io"; |
| 7 | 7 |
| 8 import "package:async_helper/async_helper.dart"; | 8 import "package:async_helper/async_helper.dart"; |
| 9 import "package:expect/expect.dart"; | 9 import "package:expect/expect.dart"; |
| 10 import "package:path/path.dart"; | 10 import "package:path/path.dart"; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 }, onError: (e) { | 132 }, onError: (e) { |
| 133 dir.deleteSync(recursive: true); | 133 dir.deleteSync(recursive: true); |
| 134 throw e; | 134 throw e; |
| 135 }); | 135 }); |
| 136 | 136 |
| 137 file.deleteSync(); | 137 file.deleteSync(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 | 140 |
| 141 void testWatchDeleteDir() { | 141 void testWatchDeleteDir() { |
| 142 // Windows keeps the directory handle open, even though it's deleted. It'll |
| 143 // be flushed completely, once the watcher is closed as well. |
| 144 if (Platform.isWindows) return; |
| 142 var dir = Directory.systemTemp.createTempSync('dart_file_system_watcher'); | 145 var dir = Directory.systemTemp.createTempSync('dart_file_system_watcher'); |
| 143 var watcher = dir.watch(events: 0); | 146 var watcher = dir.watch(events: 0); |
| 144 | 147 |
| 145 asyncStart(); | 148 asyncStart(); |
| 146 var sub; | 149 var sub; |
| 147 sub = watcher.listen((event) { | 150 sub = watcher.listen((event) { |
| 148 if (event is FileSystemDeleteEvent) { | 151 if (event is FileSystemDeleteEvent) { |
| 149 Expect.isTrue(event.path == dir.path); | 152 Expect.isTrue(event.path == dir.path); |
| 150 } | 153 } |
| 151 }, onDone: () { | 154 }, onDone: () { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 testWatchCreateDir(); | 306 testWatchCreateDir(); |
| 304 testWatchModifyFile(); | 307 testWatchModifyFile(); |
| 305 testWatchMoveFile(); | 308 testWatchMoveFile(); |
| 306 testWatchDeleteFile(); | 309 testWatchDeleteFile(); |
| 307 testWatchDeleteDir(); | 310 testWatchDeleteDir(); |
| 308 testWatchOnlyModifyFile(); | 311 testWatchOnlyModifyFile(); |
| 309 testMultipleEvents(); | 312 testMultipleEvents(); |
| 310 testWatchNonRecursive(); | 313 testWatchNonRecursive(); |
| 311 testWatchNonExisting(); | 314 testWatchNonExisting(); |
| 312 } | 315 } |
| OLD | NEW |