| Index: content/public/test/test_file_system_backend.cc
|
| diff --git a/content/public/test/test_file_system_backend.cc b/content/public/test/test_file_system_backend.cc
|
| index 1b9e0a54ff6076ba5cc60e31af855ae084aa2229..3c34714e04a27f9a9d65074c3c3d8fc86905ccbd 100644
|
| --- a/content/public/test/test_file_system_backend.cc
|
| +++ b/content/public/test/test_file_system_backend.cc
|
| @@ -24,7 +24,6 @@
|
| #include "storage/browser/fileapi/native_file_util.h"
|
| #include "storage/browser/fileapi/quota/quota_reservation.h"
|
| #include "storage/browser/fileapi/sandbox_file_stream_writer.h"
|
| -#include "storage/browser/fileapi/watcher_manager.h"
|
| #include "storage/browser/quota/quota_manager.h"
|
| #include "storage/common/fileapi/file_system_util.h"
|
|
|
| @@ -56,101 +55,6 @@ class TestFileUtil : public storage::LocalFileUtil {
|
| base::FilePath base_path_;
|
| };
|
|
|
| -// Stub implementation of storage::WatcherManager. Emits a fake notification
|
| -// after a directory watcher is set successfully.
|
| -class TestWatcherManager : public storage::WatcherManager {
|
| - public:
|
| - TestWatcherManager() : weak_ptr_factory_(this) {}
|
| - ~TestWatcherManager() override {}
|
| -
|
| - // storage::WatcherManager overrides.
|
| - void AddObserver(Observer* observer) override {
|
| - observers_.AddObserver(observer);
|
| - }
|
| -
|
| - void RemoveObserver(Observer* observer) override {
|
| - observers_.RemoveObserver(observer);
|
| - }
|
| -
|
| - bool HasObserver(Observer* observer) const override {
|
| - return observers_.HasObserver(observer);
|
| - }
|
| -
|
| - void WatchDirectory(const storage::FileSystemURL& url,
|
| - bool recursive,
|
| - const StatusCallback& callback) override {
|
| - if (recursive) {
|
| - base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(callback, base::File::FILE_ERROR_INVALID_OPERATION));
|
| - return;
|
| - }
|
| -
|
| - const GURL gurl = url.ToGURL();
|
| - if (watched_urls_.find(gurl) != watched_urls_.end()) {
|
| - base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| - FROM_HERE, base::Bind(callback, base::File::FILE_ERROR_EXISTS));
|
| - return;
|
| - }
|
| -
|
| - watched_urls_.insert(gurl);
|
| - base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| - FROM_HERE, base::Bind(callback, base::File::FILE_OK));
|
| -
|
| - // Send a fake changed notification.
|
| - base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(&TestWatcherManager::SendFakeChangeNotification,
|
| - weak_ptr_factory_.GetWeakPtr(),
|
| - url));
|
| -
|
| - // Send a fake removed notification.
|
| - base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(&TestWatcherManager::SendFakeRemoveNotification,
|
| - weak_ptr_factory_.GetWeakPtr(),
|
| - url));
|
| - }
|
| -
|
| - void UnwatchEntry(const storage::FileSystemURL& url,
|
| - const StatusCallback& callback) override {
|
| - const GURL gurl = url.ToGURL();
|
| - if (watched_urls_.find(gurl) == watched_urls_.end()) {
|
| - base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| - FROM_HERE, base::Bind(callback, base::File::FILE_ERROR_NOT_FOUND));
|
| - return;
|
| - }
|
| -
|
| - watched_urls_.erase(gurl);
|
| - base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| - FROM_HERE, base::Bind(callback, base::File::FILE_OK));
|
| - }
|
| -
|
| - private:
|
| - // Sends a fake notification to each observer about a changed entry
|
| - // represented by |url|, as long as it is still being watched.
|
| - void SendFakeChangeNotification(const storage::FileSystemURL& url) {
|
| - if (watched_urls_.find(url.ToGURL()) == watched_urls_.end())
|
| - return;
|
| -
|
| - FOR_EACH_OBSERVER(Observer, observers_, OnEntryChanged(url));
|
| - }
|
| -
|
| - // Sends a fake notification to each observer about a removed entry
|
| - // represented by |url|, as long as it is still being watched.
|
| - void SendFakeRemoveNotification(const storage::FileSystemURL& url) {
|
| - if (watched_urls_.find(url.ToGURL()) == watched_urls_.end())
|
| - return;
|
| -
|
| - FOR_EACH_OBSERVER(Observer, observers_, OnEntryRemoved(url));
|
| - }
|
| -
|
| - ObserverList<Observer> observers_;
|
| - std::set<GURL> watched_urls_;
|
| -
|
| - base::WeakPtrFactory<TestWatcherManager> weak_ptr_factory_;
|
| -};
|
| -
|
| } // namespace
|
|
|
| // This only supports single origin.
|
| @@ -214,7 +118,6 @@ TestFileSystemBackend::TestFileSystemBackend(
|
| task_runner_(task_runner),
|
| file_util_(
|
| new storage::AsyncFileUtilAdapter(new TestFileUtil(base_path))),
|
| - watcher_manager_(new TestWatcherManager()),
|
| quota_util_(new QuotaUtil),
|
| require_copy_or_move_validator_(false) {
|
| update_observers_ =
|
| @@ -246,7 +149,7 @@ storage::AsyncFileUtil* TestFileSystemBackend::GetAsyncFileUtil(
|
|
|
| storage::WatcherManager* TestFileSystemBackend::GetWatcherManager(
|
| storage::FileSystemType type) {
|
| - return watcher_manager_.get();
|
| + return nullptr;
|
| }
|
|
|
| storage::CopyOrMoveFileValidatorFactory*
|
| @@ -260,7 +163,7 @@ TestFileSystemBackend::GetCopyOrMoveFileValidatorFactory(
|
| *error_code = base::File::FILE_ERROR_SECURITY;
|
| return copy_or_move_file_validator_factory_.get();
|
| }
|
| - return NULL;
|
| + return nullptr;
|
| }
|
|
|
| void TestFileSystemBackend::InitializeCopyOrMoveFileValidatorFactory(
|
| @@ -328,7 +231,7 @@ const storage::ChangeObserverList* TestFileSystemBackend::GetChangeObservers(
|
|
|
| const storage::AccessObserverList* TestFileSystemBackend::GetAccessObservers(
|
| storage::FileSystemType type) const {
|
| - return NULL;
|
| + return nullptr;
|
| }
|
|
|
| void TestFileSystemBackend::AddFileChangeObserver(
|
|
|