[vm] fix file_system_watcher_test.dart on Mac

Fix the failed bot

Change-Id: I8179e9bb03d2328a6c9385207ee594fda094a127
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112960
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
This commit is contained in:
Zichang Guo
2019-08-13 23:38:15 +00:00
committed by commit-bot@chromium.org
parent 7d18272498
commit 647f2ec309
@@ -336,11 +336,15 @@ testWatchConsistentModifiedFile() async {
// Delay some time to ensure that watcher is created when modification is running consistently.
await Future.delayed(Duration(milliseconds: 10));
var watcher = dir.watch();
var subscription;
// Wait for event and check the type
var event = await watcher.first;
Expect.isTrue(event is FileSystemModifyEvent);
Expect.isTrue(event.path.endsWith('file'));
subscription = watcher.listen((data) {
if (data is FileSystemModifyEvent) {
Expect.isTrue(data.path.endsWith('file'));
subscription.cancel();
}
});
// Create a file to signal modifier isolate to stop modification and clean up temp directory.
var file = new File(join(dir.path, 'EventReceived'));