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

Unified Diff: tests/standalone/io/file_system_watcher_test.dart

Issue 48613002: Add 'isDir' to FileSystemEvent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review fixes. Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« runtime/bin/file_patch.dart ('K') | « sdk/lib/io/file_system_entity.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/file_system_watcher_test.dart
diff --git a/tests/standalone/io/file_system_watcher_test.dart b/tests/standalone/io/file_system_watcher_test.dart
index 94108dccd129d843aecb7bcbdd3a5e057b649c47..bf116c7b97693afe1b9a2372efac59c152721b89 100644
--- a/tests/standalone/io/file_system_watcher_test.dart
+++ b/tests/standalone/io/file_system_watcher_test.dart
@@ -20,6 +20,7 @@ void testWatchCreateFile() {
sub = watcher.listen((event) {
if (event is FileSystemCreateEvent &&
event.path.endsWith('file')) {
+ Expect.isFalse(event.isDirectory);
asyncEnd();
sub.cancel();
dir.deleteSync(recursive: true);
@@ -33,6 +34,31 @@ void testWatchCreateFile() {
}
+void testWatchCreateDir() {
+ var dir = Directory.systemTemp.createTempSync('dart_file_system_watcher');
+ var dir2 = new Directory(dir.path + '/dir');
Bill Hesse 2013/10/28 17:05:33 I really think we should always use join(dir.path,
Anders Johnsen 2013/10/28 17:14:41 Done.
+
+ var watcher = dir.watch();
+
+ asyncStart();
+ var sub;
+ sub = watcher.listen((event) {
+ if (event is FileSystemCreateEvent &&
+ event.path.endsWith('dir')) {
+ Expect.isTrue(event.isDirectory);
+ asyncEnd();
+ sub.cancel();
+ dir.deleteSync(recursive: true);
+ }
+ }, onError: (e) {
+ dir.deleteSync(recursive: true);
+ throw e;
+ });
+
+ dir2.createSync();
Bill Hesse 2013/10/28 17:05:33 Why not just dir2.create?
Anders Johnsen 2013/10/28 17:14:41 It does not add anything either way for this tests
+}
+
+
void testWatchModifyFile() {
var dir = Directory.systemTemp.createTempSync('dart_file_system_watcher');
var file = new File(dir.path + '/file');
@@ -273,6 +299,7 @@ void testWatchNonExisting() {
void main() {
if (!FileSystemEntity.isWatchSupported) return;
testWatchCreateFile();
+ testWatchCreateDir();
testWatchModifyFile();
testWatchMoveFile();
testWatchDeleteFile();
« runtime/bin/file_patch.dart ('K') | « sdk/lib/io/file_system_entity.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698