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

Side by Side Diff: pkg/watcher/test/directory_watcher/mac_os_test.dart

Issue 58903015: Fix the Mac OS directory watcher tests on the bots. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 'package:scheduled_test/scheduled_test.dart'; 5 import 'package:scheduled_test/scheduled_test.dart';
6 import 'package:watcher/src/directory_watcher/mac_os.dart'; 6 import 'package:watcher/src/directory_watcher/mac_os.dart';
7 import 'package:watcher/watcher.dart'; 7 import 'package:watcher/watcher.dart';
8 8
9 import 'shared.dart'; 9 import 'shared.dart';
10 import '../utils.dart'; 10 import '../utils.dart';
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 writeFile("a.txt", contents: "same"); 43 writeFile("a.txt", contents: "same");
44 writeFile("b.txt", contents: "after"); 44 writeFile("b.txt", contents: "after");
45 expectModifyEvent("a.txt"); 45 expectModifyEvent("a.txt");
46 expectModifyEvent("b.txt"); 46 expectModifyEvent("b.txt");
47 }); 47 });
48 48
49 test('emits events for many nested files moved out then immediately back in', 49 test('emits events for many nested files moved out then immediately back in',
50 () { 50 () {
51 withPermutations((i, j, k) => 51 withPermutations((i, j, k) =>
52 writeFile("dir/sub/sub-$i/sub-$j/file-$k.txt")); 52 writeFile("dir/sub/sub-$i/sub-$j/file-$k.txt"));
53
54 // We sleep here because a narrow edge case caused by two interacting bugs
55 // can produce events that aren't expected if we start the watcher too
56 // soon after creating the files above. Here's what happens:
57 //
58 // * We create "dir/sub" and its contents above.
59 //
60 // * We initialize the watcher watching "dir".
61 //
62 // * Due to issue 14373, the watcher can receive native events describing
63 // the creation of "dir/sub" and its contents despite the fact that they
64 // occurred before the watcher was started.
65 //
66 // * Usually the above events will occur while the watcher is doing its
67 // initial scan of "dir/sub" and be ignored, but occasionally they will
68 // occur afterwards.
69 //
70 // * When processing the bogus CREATE events, the watcher has to assume that
71 // they could mean something other than CREATE (issue 14793). Thus it
72 // assumes that the files or directories in question could have changed
73 // and emits CHANGE events or additional REMOVE/CREATE pairs for them.
74 schedule(() => new Future.delayed(new Duration(seconds: 2)));
75
53 startWatcher(dir: "dir"); 76 startWatcher(dir: "dir");
54 77
55 renameDir("dir/sub", "sub"); 78 renameDir("dir/sub", "sub");
56 renameDir("sub", "dir/sub"); 79 renameDir("sub", "dir/sub");
57 80
58 inAnyOrder(() { 81 inAnyOrder(() {
59 withPermutations((i, j, k) => 82 withPermutations((i, j, k) =>
60 expectRemoveEvent("dir/sub/sub-$i/sub-$j/file-$k.txt")); 83 expectRemoveEvent("dir/sub/sub-$i/sub-$j/file-$k.txt"));
61 }); 84 });
62 85
63 inAnyOrder(() { 86 inAnyOrder(() {
64 withPermutations((i, j, k) => 87 withPermutations((i, j, k) =>
65 expectAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt")); 88 expectAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt"));
66 }); 89 });
67 }); 90 });
68 } 91 }
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