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

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

Issue 66163002: Wrap Directory.watch on Mac OS for the watcher package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review 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 | « pkg/watcher/lib/src/utils.dart ('k') | pkg/watcher/test/directory_watcher/shared.dart » ('j') | 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/linux.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';
11 11
12 main() { 12 main() {
13 initConfig(); 13 initConfig();
14 14
15 watcherFactory = (dir) => new LinuxDirectoryWatcher(dir); 15 watcherFactory = (dir) => new MacOSDirectoryWatcher(dir);
16 16
17 setUp(() { 17 setUp(createSandbox);
18 // Increase the timeout because closing a [Directory.watch] stream blocks
19 // the main isolate for a very long time on Goobuntu, as of kernel
20 // 3.2.5-gg1336 (see issue 14606).
21 currentSchedule.timeout *= 3;
22
23 createSandbox();
24 });
25 18
26 sharedTests(); 19 sharedTests();
27 20
28 test('DirectoryWatcher creates a LinuxDirectoryWatcher on Linux', () { 21 test('DirectoryWatcher creates a MacOSDirectoryWatcher on Mac OS', () {
29 expect(new DirectoryWatcher('.'), 22 expect(new DirectoryWatcher('.'),
30 new isInstanceOf<LinuxDirectoryWatcher>()); 23 new isInstanceOf<MacOSDirectoryWatcher>());
24 });
25
26 test('does not notify about the watched directory being deleted and '
27 'recreated immediately before watching', () {
28 createDir("dir");
29 writeFile("dir/old.txt");
30 deleteDir("dir");
31 createDir("dir");
32
33 startWatcher(dir: "dir");
34 writeFile("dir/newer.txt");
35 expectAddEvent("dir/newer.txt");
31 }); 36 });
32 37
33 test('notifies even if the file contents are unchanged', () { 38 test('notifies even if the file contents are unchanged', () {
34 writeFile("a.txt", contents: "same"); 39 writeFile("a.txt", contents: "same");
35 writeFile("b.txt", contents: "before"); 40 writeFile("b.txt", contents: "before");
36 startWatcher(); 41 startWatcher();
37 writeFile("a.txt", contents: "same"); 42 writeFile("a.txt", contents: "same");
38 writeFile("b.txt", contents: "after"); 43 writeFile("b.txt", contents: "after");
39 expectModifyEvent("a.txt"); 44 expectModifyEvent("a.txt");
40 expectModifyEvent("b.txt"); 45 expectModifyEvent("b.txt");
(...skipping 12 matching lines...) Expand all
53 withPermutations((i, j, k) => 58 withPermutations((i, j, k) =>
54 expectRemoveEvent("dir/sub/sub-$i/sub-$j/file-$k.txt")); 59 expectRemoveEvent("dir/sub/sub-$i/sub-$j/file-$k.txt"));
55 }); 60 });
56 61
57 inAnyOrder(() { 62 inAnyOrder(() {
58 withPermutations((i, j, k) => 63 withPermutations((i, j, k) =>
59 expectAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt")); 64 expectAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt"));
60 }); 65 });
61 }); 66 });
62 } 67 }
OLDNEW
« no previous file with comments | « pkg/watcher/lib/src/utils.dart ('k') | pkg/watcher/test/directory_watcher/shared.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698