#include "content/browser/file_system_access/file_system_access_watcher_manager.h"
#include <list>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/location.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
#include "base/test/gmock_expected_support.h"
#include "base/test/run_until.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "base/test/test_timeouts.h"
#include "build/buildflag.h"
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/browser/file_system_access/file_system_access_change_source.h"
#include "content/browser/file_system_access/file_system_access_manager_impl.h"
#include "content/browser/file_system_access/file_system_access_watch_scope.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_browser_context.h"
#include "content/public/test/test_web_contents_factory.h"
#include "content/test/test_web_contents.h"
#include "storage/browser/file_system/external_mount_points.h"
#include "storage/browser/file_system/file_system_context.h"
#include "storage/browser/file_system/file_system_url.h"
#include "storage/browser/quota/quota_manager_proxy.h"
#include "storage/browser/test/mock_quota_manager.h"
#include "storage/browser/test/mock_quota_manager_proxy.h"
#include "storage/browser/test/mock_special_storage_policy.h"
#include "storage/browser/test/quota_manager_proxy_sync.h"
#include "storage/browser/test/test_file_system_context.h"
#include "storage/common/file_system/file_system_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/file_system_access/file_system_access_directory_handle.mojom.h"
#include "third_party/blink/public/mojom/file_system_access/file_system_access_error.mojom-shared.h"
namespace content {
Change;
Observation;
ChangeInfo;
ChangeType;
FilePathType;
namespace {
constexpr char kTestMountPoint[] = …;
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_IOS)
void SpinEventLoopForABit() { … }
bool ReportsModifiedPathForLocalObservations() { … }
bool ReportsChangeInfoForLocalObservations() { … }
#endif
class ChangeAccumulator { … };
class FakeChangeSource : public FileSystemAccessChangeSource { … };
}
class FileSystemAccessWatcherManagerTest : public testing::Test { … };
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_IOS)
TEST_F(FileSystemAccessWatcherManagerTest, BasicRegistration) { … }
#endif
TEST_F(FileSystemAccessWatcherManagerTest, BasicRegistrationUnownedSource) { … }
TEST_F(FileSystemAccessWatcherManagerTest, UnownedSource) { … }
TEST_F(FileSystemAccessWatcherManagerTest, SourceFailsInitialization) { … }
TEST_F(FileSystemAccessWatcherManagerTest, IgnoreSwapFileChanges) { … }
TEST_F(FileSystemAccessWatcherManagerTest, RemoveObservation) { … }
TEST_F(FileSystemAccessWatcherManagerTest, ObserveBucketFS) { … }
TEST_F(FileSystemAccessWatcherManagerTest, UnsupportedScope) { … }
TEST_F(FileSystemAccessWatcherManagerTest, OverlappingSourceScopes) { … }
TEST_F(FileSystemAccessWatcherManagerTest,
OverlappingObservationScopesForBucketFileSystem) { … }
TEST_F(FileSystemAccessWatcherManagerTest,
OnlyReceiveChangesWhenSourceAndObservationUrlsMatchForLocalFileSystem) { … }
TEST_F(FileSystemAccessWatcherManagerTest, ErroredChange) { … }
TEST_F(FileSystemAccessWatcherManagerTest,
ErroredChangeOnBucketFileSystemWhenSourceHasLargerScopeThanObservation) { … }
TEST_F(FileSystemAccessWatcherManagerTest, ChangeAtRelativePath) { … }
TEST_F(FileSystemAccessWatcherManagerTest, ChangeType) { … }
TEST_F(FileSystemAccessWatcherManagerTest, WatchLocalDirectory) { … }
TEST_F(FileSystemAccessWatcherManagerTest,
DISABLED_WatchLocalDirectoryNonRecursivelyDoesNotSeeRecursiveChanges) { … }
TEST_F(FileSystemAccessWatcherManagerTest, WatchLocalDirectoryRecursively) { … }
TEST_F(FileSystemAccessWatcherManagerTest, WatchLocalFile) { … }
TEST_F(FileSystemAccessWatcherManagerTest,
WatchLocalFileWithMultipleObservations) { … }
TEST_F(FileSystemAccessWatcherManagerTest, OutOfScope) { … }
}