mirror of
https://github.com/google/cdc-file-transfer.git
synced 2026-09-13 01:10:44 +03:00
[common] Fix FileWatcherTest once and for all (#53)
But... ONCE AND FOR ALL! A recent change introduced WaitForWatching(), which was supposed to block until the file watcher is actively monitoring the directory. However this always returned immediately since the watcher is in kFailed state if the directory was deleted, which counts as watching (IsStarted returns true for both kWatching and kFailed states). This CL adds an IsWatching() helper function that returns true only for the kWatching state, which means that the directory is actively being watched.
This commit is contained in:
@@ -77,7 +77,12 @@ class FileWatcherWin {
|
||||
// Stops watching directory changes.
|
||||
absl::Status StopWatching() ABSL_LOCKS_EXCLUDED(modified_files_mutex_);
|
||||
|
||||
// Indicates whether a directory is currently watched.
|
||||
// Indicates whether StartWatching() was called, but StopWatching() was not
|
||||
// called yet.
|
||||
bool IsStarted() const;
|
||||
|
||||
// Indicates whether a directory is actively watched for changes. In contrast
|
||||
// to IsStarted(), returns false while the directory does not exist.
|
||||
bool IsWatching() const;
|
||||
|
||||
// Returns the watching status.
|
||||
|
||||
Reference in New Issue
Block a user