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

Side by Side Diff: pkg/watcher/test/no_subscription/shared.dart

Issue 812253002: Delete a bunch of packages that are now on GitHub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Un-delete http Created 6 years 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/test/no_subscription/polling_test.dart ('k') | pkg/watcher/test/path_set_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) 2012, 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 'dart:async';
6
7 import 'package:scheduled_test/scheduled_test.dart';
8 import 'package:watcher/watcher.dart';
9
10 import '../utils.dart';
11
12 void sharedTests() {
13 test('does not notify for changes when there are no subscribers', () {
14 // Note that this test doesn't rely as heavily on the test functions in
15 // utils.dart because it needs to be very explicit about when the event
16 // stream is and is not subscribed.
17 var watcher = createWatcher();
18
19 // Subscribe to the events.
20 var completer = new Completer();
21 var subscription = watcher.events.listen(wrapAsync((event) {
22 expect(event, isWatchEvent(ChangeType.ADD, "file.txt"));
23 completer.complete();
24 }));
25
26 writeFile("file.txt");
27
28 // Then wait until we get an event for it.
29 schedule(() => completer.future);
30
31 // Unsubscribe.
32 schedule(() {
33 subscription.cancel();
34 });
35
36 // Now write a file while we aren't listening.
37 writeFile("unwatched.txt");
38
39 // Then start listening again.
40 schedule(() {
41 completer = new Completer();
42 subscription = watcher.events.listen(wrapAsync((event) {
43 // We should get an event for the third file, not the one added while
44 // we weren't subscribed.
45 expect(event, isWatchEvent(ChangeType.ADD, "added.txt"));
46 completer.complete();
47 }));
48
49 // Wait until the watcher is ready to dispatch events again.
50 return watcher.ready;
51 });
52
53 // And add a third file.
54 writeFile("added.txt");
55
56 // Wait until we get an event for the third file.
57 schedule(() => completer.future);
58
59 schedule(() {
60 subscription.cancel();
61 });
62 });
63 }
OLDNEW
« no previous file with comments | « pkg/watcher/test/no_subscription/polling_test.dart ('k') | pkg/watcher/test/path_set_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698