Chromium Code Reviews| 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 |
| 11 | 11 |
| 12 void testWatchCreateFile() { | 12 void testWatchCreateFile() { |
| 13 var dir = Directory.systemTemp.createTempSync('dart_file_system_watcher'); | 13 var dir = Directory.systemTemp.createTempSync('dart_file_system_watcher'); |
| 14 var file = new File(dir.path + '/file'); | 14 var file = new File(dir.path + '/file'); |
| 15 | 15 |
| 16 var watcher = dir.watch(); | 16 var watcher = dir.watch(); |
| 17 | 17 |
| 18 asyncStart(); | 18 asyncStart(); |
| 19 var sub; | 19 var sub; |
| 20 sub = watcher.listen((event) { | 20 sub = watcher.listen((event) { |
| 21 if (event is FileSystemCreateEvent && | 21 if (event is FileSystemCreateEvent && |
| 22 event.path.endsWith('file')) { | 22 event.path.endsWith('file')) { |
| 23 Expect.isFalse(event.isDir); | |
|
Bill Hesse
2013/10/28 16:30:13
Will there be a test where isDir is true? There s
Anders Johnsen
2013/10/28 16:43:14
Done.
| |
| 23 asyncEnd(); | 24 asyncEnd(); |
| 24 sub.cancel(); | 25 sub.cancel(); |
| 25 dir.deleteSync(recursive: true); | 26 dir.deleteSync(recursive: true); |
| 26 } | 27 } |
| 27 }, onError: (e) { | 28 }, onError: (e) { |
| 28 dir.deleteSync(recursive: true); | 29 dir.deleteSync(recursive: true); |
| 29 throw e; | 30 throw e; |
| 30 }); | 31 }); |
| 31 | 32 |
| 32 file.createSync(); | 33 file.createSync(); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 testWatchCreateFile(); | 274 testWatchCreateFile(); |
| 274 testWatchModifyFile(); | 275 testWatchModifyFile(); |
| 275 testWatchMoveFile(); | 276 testWatchMoveFile(); |
| 276 testWatchDeleteFile(); | 277 testWatchDeleteFile(); |
| 277 testWatchDeleteDir(); | 278 testWatchDeleteDir(); |
| 278 testWatchOnlyModifyFile(); | 279 testWatchOnlyModifyFile(); |
| 279 testMultipleEvents(); | 280 testMultipleEvents(); |
| 280 testWatchNonRecursive(); | 281 testWatchNonRecursive(); |
| 281 testWatchNonExisting(); | 282 testWatchNonExisting(); |
| 282 } | 283 } |
| OLD | NEW |