| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 asyncStart(); | 94 asyncStart(); |
| 95 var sub; | 95 var sub; |
| 96 sub = watcher.listen((event) { | 96 sub = watcher.listen((event) { |
| 97 if (event is FileSystemDeleteEvent) { | 97 if (event is FileSystemDeleteEvent) { |
| 98 Expect.isTrue(event.path.endsWith('file')); | 98 Expect.isTrue(event.path.endsWith('file')); |
| 99 sub.cancel(); | 99 sub.cancel(); |
| 100 asyncEnd(); | 100 asyncEnd(); |
| 101 dir.deleteSync(recursive: true); | 101 dir.deleteSync(recursive: true); |
| 102 } | 102 } |
| 103 }, onDone: () { | |
| 104 Expect.isTrue(gotEvent); | |
| 105 }, onError: (e) { | 103 }, onError: (e) { |
| 106 dir.deleteSync(recursive: true); | 104 dir.deleteSync(recursive: true); |
| 107 throw e; | 105 throw e; |
| 108 }); | 106 }); |
| 109 | 107 |
| 110 file.deleteSync(); | 108 file.deleteSync(); |
| 111 } | 109 } |
| 112 | 110 |
| 113 | 111 |
| 114 void testWatchOnlyModifyFile() { | 112 void testWatchOnlyModifyFile() { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 239 |
| 242 void main() { | 240 void main() { |
| 243 testWatchCreateFile(); | 241 testWatchCreateFile(); |
| 244 testWatchModifyFile(); | 242 testWatchModifyFile(); |
| 245 testWatchMoveFile(); | 243 testWatchMoveFile(); |
| 246 testWatchDeleteFile(); | 244 testWatchDeleteFile(); |
| 247 testWatchOnlyModifyFile(); | 245 testWatchOnlyModifyFile(); |
| 248 testMultipleEvents(); | 246 testMultipleEvents(); |
| 249 testWatchNonRecursive(); | 247 testWatchNonRecursive(); |
| 250 } | 248 } |
| OLD | NEW |