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

Unified Diff: components/arc/test/fake_file_system_instance.h

Issue 2709613006: mediaview: Implement FakeFileSystemInstance. (Closed)
Patch Set: Addressed hidehiko's comments. Created 3 years, 10 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
« no previous file with comments | « no previous file | components/arc/test/fake_file_system_instance.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/test/fake_file_system_instance.h
diff --git a/components/arc/test/fake_file_system_instance.h b/components/arc/test/fake_file_system_instance.h
index 5fa4ac8032ed192352d3d252f12a5f30b2a78855..a019368f3aec65185263d009ff78033efa5bc2e3 100644
--- a/components/arc/test/fake_file_system_instance.h
+++ b/components/arc/test/fake_file_system_instance.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <map>
+#include <set>
#include <string>
#include <utility>
#include <vector>
@@ -102,12 +103,20 @@ class FakeFileSystemInstance : public mojom::FileSystemInstance {
FakeFileSystemInstance();
~FakeFileSystemInstance() override;
+ // Returns true if Init() has been called.
+ bool InitCalled();
+
// Adds a file accessible by content URL based methods.
void AddFile(const File& file);
// Adds a document accessible by document provider based methods.
void AddDocument(const Document& document);
+ // Triggers watchers installed to a document.
+ void TriggerWatchers(const std::string& authority,
+ const std::string& document_id,
+ mojom::ChangeType type);
+
// mojom::FileSystemInstance:
void AddWatcher(const std::string& authority,
const std::string& document_id,
@@ -136,6 +145,8 @@ class FakeFileSystemInstance : public mojom::FileSystemInstance {
base::ScopedTempDir temp_dir_;
+ mojom::FileSystemHostPtr host_;
+
// Mapping from a content URL to a file.
std::map<std::string, File> files_;
@@ -145,6 +156,14 @@ class FakeFileSystemInstance : public mojom::FileSystemInstance {
// Mapping from a document key to its child documents.
std::map<DocumentKey, std::vector<DocumentKey>> child_documents_;
+ // Mapping from a document key to its watchers.
+ std::map<DocumentKey, std::set<int64_t>> document_to_watchers_;
+
+ // Mapping from a watcher ID to a document key.
+ std::map<int64_t, DocumentKey> watcher_to_document_;
+
+ int64_t next_watcher_id_ = 1;
+
DISALLOW_COPY_AND_ASSIGN(FakeFileSystemInstance);
};
« no previous file with comments | « no previous file | components/arc/test/fake_file_system_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698