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

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

Issue 46843003: Wrap Directory.watch on linux 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/watcher.dart ('k') | pkg/watcher/test/directory_watcher/polling_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:scheduled_test/scheduled_test.dart';
6 import 'package:watcher/src/directory_watcher/linux.dart';
7 import 'package:watcher/watcher.dart';
8
9 import 'shared.dart';
10 import '../utils.dart';
11
12 main() {
13 initConfig();
14
15 watcherFactory = (dir) => new LinuxDirectoryWatcher(dir);
16
17 setUp(() {
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
26 sharedTests();
27
28 test('DirectoryWatcher creates a LinuxDirectoryWatcher on Linux', () {
29 expect(new DirectoryWatcher('.'),
30 new isInstanceOf<LinuxDirectoryWatcher>());
31 });
32
33 test('notifies even if the file contents are unchanged', () {
34 writeFile("a.txt", contents: "same");
35 writeFile("b.txt", contents: "before");
36 startWatcher();
37 writeFile("a.txt", contents: "same");
38 writeFile("b.txt", contents: "after");
39 expectModifyEvent("a.txt");
40 expectModifyEvent("b.txt");
41 });
42
43 test('emits events for many nested files moved out then immediately back in',
44 () {
45 withPermutations((i, j, k) =>
46 writeFile("dir/sub/sub-$i/sub-$j/file-$k.txt"));
47 startWatcher(dir: "dir");
48
49 renameDir("dir/sub", "sub");
50 renameDir("sub", "dir/sub");
51
52 inAnyOrder(() {
53 withPermutations((i, j, k) =>
54 expectRemoveEvent("dir/sub/sub-$i/sub-$j/file-$k.txt"));
55 });
56
57 inAnyOrder(() {
58 withPermutations((i, j, k) =>
59 expectAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt"));
60 });
61 });
62 }
OLDNEW
« no previous file with comments | « pkg/watcher/lib/watcher.dart ('k') | pkg/watcher/test/directory_watcher/polling_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698