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

Side by Side Diff: pkg/watcher/test/utils.dart

Issue 18877005: Split up tests and add some heartbeats to try to make them not timeout. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix cut/paste error. Created 7 years, 5 months 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/ready_test.dart ('k') | 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) 2012, the Dart project authors. Please see the AUTHORS file 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 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 library watcher.test.utils; 5 library watcher.test.utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 mockGetModificationTime(null); 70 mockGetModificationTime(null);
71 }, "delete sandbox"); 71 }, "delete sandbox");
72 } 72 }
73 73
74 /// Creates a new [DirectoryWatcher] that watches a temporary directory. 74 /// Creates a new [DirectoryWatcher] that watches a temporary directory.
75 /// 75 ///
76 /// Normally, this will pause the schedule until the watcher is done scanning 76 /// Normally, this will pause the schedule until the watcher is done scanning
77 /// and is polling for changes. If you pass `false` for [waitForReady], it will 77 /// and is polling for changes. If you pass `false` for [waitForReady], it will
78 /// not schedule this delay. 78 /// not schedule this delay.
79 DirectoryWatcher createWatcher({bool waitForReady}) { 79 DirectoryWatcher createWatcher({bool waitForReady}) {
80 _watcher = new DirectoryWatcher(_sandboxDir); 80 // Use a short delay to make the tests run quickly.
81 _watcher = new DirectoryWatcher(_sandboxDir,
82 pollingDelay: new Duration(milliseconds: 100));
nweiz 2013/07/12 22:37:17 This could probably be 0s or something vanishingly
81 83
82 // Wait until the scan is finished so that we don't miss changes to files 84 // Wait until the scan is finished so that we don't miss changes to files
83 // that could occur before the scan completes. 85 // that could occur before the scan completes.
84 if (waitForReady != false) { 86 if (waitForReady != false) {
85 schedule(() => _watcher.ready); 87 schedule(() => _watcher.ready);
86 } 88 }
87 89
88 currentSchedule.onComplete.schedule(() { 90 currentSchedule.onComplete.schedule(() {
89 _nextEvent = 0; 91 _nextEvent = 0;
90 _watcher = null; 92 _watcher = null;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 179
178 _ChangeMatcher(this.type, this.path); 180 _ChangeMatcher(this.type, this.path);
179 181
180 Description describe(Description description) { 182 Description describe(Description description) {
181 description.add("$type $path"); 183 description.add("$type $path");
182 } 184 }
183 185
184 bool matches(item, Map matchState) => 186 bool matches(item, Map matchState) =>
185 item is WatchEvent && item.type == type && item.path == path; 187 item is WatchEvent && item.type == type && item.path == path;
186 } 188 }
OLDNEW
« no previous file with comments | « pkg/watcher/test/ready_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698