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

Unified Diff: pkg/watcher/test/utils.dart

Issue 134963007: Fix a flaky test and work around issue 16003 in pkg/watcher. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: pkg/watcher/test/utils.dart
diff --git a/pkg/watcher/test/utils.dart b/pkg/watcher/test/utils.dart
index f7e35f18af7da0d1e074112180e876b5c28e7a52..885018bd1db3809c2d9b508df63fa9a9080bf934 100644
--- a/pkg/watcher/test/utils.dart
+++ b/pkg/watcher/test/utils.dart
@@ -116,7 +116,7 @@ ScheduledStream<WatchEvent> _watcherEvents;
void startWatcher({String dir}) {
var testCase = currentTestCase.description;
if (MacOSDirectoryWatcher.logDebugInfo) {
- print("starting watcher for $testCase");
+ print("starting watcher for $testCase (${new DateTime.now()})");
}
// We want to wait until we're ready *after* we subscribe to the watcher's
@@ -129,7 +129,7 @@ void startWatcher({String dir}) {
_watcherEvents = new ScheduledStream(futureStream(schedule(() {
currentSchedule.onComplete.schedule(() {
if (MacOSDirectoryWatcher.logDebugInfo) {
- print("stopping watcher for $testCase");
+ print("stopping watcher for $testCase (${new DateTime.now()})");
}
_watcher = null;
@@ -298,6 +298,9 @@ void writeFile(String path, {String contents, bool updateModified}) {
dir.createSync(recursive: true);
}
+ if (MacOSDirectoryWatcher.logDebugInfo) {
+ print("[test] writing file $path");
+ }
new File(fullPath).writeAsStringSync(contents);
// Manually update the mock modification time for the file.
@@ -314,6 +317,9 @@ void writeFile(String path, {String contents, bool updateModified}) {
/// Schedules deleting a file in the sandbox at [path].
void deleteFile(String path) {
schedule(() {
+ if (MacOSDirectoryWatcher.logDebugInfo) {
+ print("[test] deleting file $path");
+ }
new File(p.join(_sandboxDir, path)).deleteSync();
}, "delete file $path");
}
@@ -323,6 +329,10 @@ void deleteFile(String path) {
/// If [contents] is omitted, creates an empty file.
void renameFile(String from, String to) {
schedule(() {
+ if (MacOSDirectoryWatcher.logDebugInfo) {
+ print("[test] renaming file $from to $to");
+ }
+
new File(p.join(_sandboxDir, from)).renameSync(p.join(_sandboxDir, to));
// Make sure we always use the same separator on Windows.
@@ -337,6 +347,9 @@ void renameFile(String from, String to) {
/// Schedules creating a directory in the sandbox at [path].
void createDir(String path) {
schedule(() {
+ if (MacOSDirectoryWatcher.logDebugInfo) {
+ print("[test] creating directory $path");
+ }
new Directory(p.join(_sandboxDir, path)).createSync();
}, "create directory $path");
}
@@ -344,6 +357,9 @@ void createDir(String path) {
/// Schedules renaming a directory in the sandbox from [from] to [to].
void renameDir(String from, String to) {
schedule(() {
+ if (MacOSDirectoryWatcher.logDebugInfo) {
+ print("[test] renaming directory $from to $to");
+ }
new Directory(p.join(_sandboxDir, from))
.renameSync(p.join(_sandboxDir, to));
}, "rename directory $from to $to");
@@ -352,6 +368,9 @@ void renameDir(String from, String to) {
/// Schedules deleting a directory in the sandbox at [path].
void deleteDir(String path) {
schedule(() {
+ if (MacOSDirectoryWatcher.logDebugInfo) {
+ print("[test] deleting directory $path");
+ }
new Directory(p.join(_sandboxDir, path)).deleteSync(recursive: true);
}, "delete directory $path");
}

Powered by Google App Engine
This is Rietveld 408576698