| 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 | 10 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 250 |
| 251 new Timer(const Duration(milliseconds: 300), () { | 251 new Timer(const Duration(milliseconds: 300), () { |
| 252 sub.cancel(); | 252 sub.cancel(); |
| 253 asyncEnd(); | 253 asyncEnd(); |
| 254 dir.deleteSync(recursive: true); | 254 dir.deleteSync(recursive: true); |
| 255 }); | 255 }); |
| 256 } | 256 } |
| 257 | 257 |
| 258 | 258 |
| 259 void testWatchNonExisting() { | 259 void testWatchNonExisting() { |
| 260 // MacOS allows listening on non-existing paths. |
| 261 if (Platform.isMacOS) return; |
| 260 asyncStart(); | 262 asyncStart(); |
| 261 new Directory('__some_none_existing_dir__').watch() | 263 new Directory('__some_none_existing_dir__').watch() |
| 262 .listen((_) { | 264 .listen((_) { |
| 263 Expect.fail('unexpected error'); | 265 Expect.fail('unexpected error'); |
| 264 }, onError: (e) { | 266 }, onError: (e) { |
| 265 asyncEnd(); | 267 asyncEnd(); |
| 266 Expect.isTrue(e is FileSystemException); | 268 Expect.isTrue(e is FileSystemException); |
| 267 }); | 269 }); |
| 268 } | 270 } |
| 269 | 271 |
| 270 | 272 |
| 271 void main() { | 273 void main() { |
| 272 if (!FileSystemEntity.isWatchSupported) return; | 274 if (!FileSystemEntity.isWatchSupported) return; |
| 273 testWatchCreateFile(); | 275 testWatchCreateFile(); |
| 274 testWatchModifyFile(); | 276 testWatchModifyFile(); |
| 275 testWatchMoveFile(); | 277 testWatchMoveFile(); |
| 276 testWatchDeleteFile(); | 278 testWatchDeleteFile(); |
| 277 testWatchDeleteDir(); | 279 testWatchDeleteDir(); |
| 278 testWatchOnlyModifyFile(); | 280 testWatchOnlyModifyFile(); |
| 279 testMultipleEvents(); | 281 testMultipleEvents(); |
| 280 testWatchNonRecursive(); | 282 testWatchNonRecursive(); |
| 281 testWatchNonExisting(); | 283 testWatchNonExisting(); |
| 282 } | 284 } |
| OLD | NEW |