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

Side by Side Diff: tests/standalone/io/file_system_watcher_test.dart

Issue 23537021: Relax expectations for events on mac, and allow move events to not have a destination. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 var file = new File(dir.path + '/file'); 63 var file = new File(dir.path + '/file');
64 file.createSync(); 64 file.createSync();
65 65
66 var watcher = dir.watch(); 66 var watcher = dir.watch();
67 67
68 asyncStart(); 68 asyncStart();
69 var sub; 69 var sub;
70 sub = watcher.listen((event) { 70 sub = watcher.listen((event) {
71 if (event is FileSystemMoveEvent) { 71 if (event is FileSystemMoveEvent) {
72 Expect.isTrue(event.path.endsWith('file')); 72 Expect.isTrue(event.path.endsWith('file'));
73 Expect.isTrue(event.destination.endsWith('file2')); 73 if (event.destination != null) {
74 Expect.isTrue(event.destination.endsWith('file2'));
75 }
74 sub.cancel(); 76 sub.cancel();
75 asyncEnd(); 77 asyncEnd();
76 dir.deleteSync(recursive: true); 78 dir.deleteSync(recursive: true);
77 } 79 }
78 }, onError: (e) { 80 }, onError: (e) {
79 dir.deleteSync(recursive: true); 81 dir.deleteSync(recursive: true);
80 throw e; 82 throw e;
81 }); 83 });
82 84
83 runAsync(() => file.renameSync(dir.path + '/file2')); 85 runAsync(() => file.renameSync(dir.path + '/file2'));
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 newState = 3; 162 newState = 3;
161 break; 163 break;
162 164
163 case FileSystemEvent.DELETE: 165 case FileSystemEvent.DELETE:
164 newState = 4; 166 newState = 4;
165 sub.cancel(); 167 sub.cancel();
166 asyncEnd(); 168 asyncEnd();
167 dir.deleteSync(); 169 dir.deleteSync();
168 break; 170 break;
169 } 171 }
170 if (newState < state) throw "Bad state"; 172 if (!Platform.isMacOS) {
173 if (newState < state) throw "Bad state";
174 }
171 state = newState; 175 state = newState;
172 }); 176 });
173 177
174 runAsync(() { 178 runAsync(() {
175 file.createSync(); 179 file.createSync();
176 file.writeAsStringSync('a'); 180 file.writeAsStringSync('a');
177 file.renameSync(file2.path); 181 file.renameSync(file2.path);
178 file2.deleteSync(); 182 file2.deleteSync();
179 }); 183 });
180 } 184 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 void main() { 245 void main() {
242 if (!FileSystemEntity.isWatchSupported) return; 246 if (!FileSystemEntity.isWatchSupported) return;
243 testWatchCreateFile(); 247 testWatchCreateFile();
244 testWatchModifyFile(); 248 testWatchModifyFile();
245 testWatchMoveFile(); 249 testWatchMoveFile();
246 testWatchDeleteFile(); 250 testWatchDeleteFile();
247 testWatchOnlyModifyFile(); 251 testWatchOnlyModifyFile();
248 testMultipleEvents(); 252 testMultipleEvents();
249 testWatchNonRecursive(); 253 testWatchNonRecursive();
250 } 254 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698