OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_ARC_TEST_FAKE_FILE_SYSTEM_INSTANCE_H_ | 5 #ifndef COMPONENTS_ARC_TEST_FAKE_FILE_SYSTEM_INSTANCE_H_ |
6 #define COMPONENTS_ARC_TEST_FAKE_FILE_SYSTEM_INSTANCE_H_ | 6 #define COMPONENTS_ARC_TEST_FAKE_FILE_SYSTEM_INSTANCE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <utility> | 13 #include <utility> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/files/scoped_temp_dir.h" | 16 #include "base/files/scoped_temp_dir.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/threading/thread_checker.h" | 18 #include "base/threading/thread_checker.h" |
19 #include "components/arc/common/file_system.mojom.h" | 19 #include "components/arc/common/file_system.mojom.h" |
| 20 #include "storage/browser/fileapi/watcher_manager.h" |
20 | 21 |
21 namespace arc { | 22 namespace arc { |
22 | 23 |
23 // Fake implementation to operate on documents in memory. | 24 // Fake implementation to operate on documents in memory. |
24 // | 25 // |
25 // ArcFileSystemOperationRunner provides two types of methods: content URL | 26 // ArcFileSystemOperationRunner provides two types of methods: content URL |
26 // based and documents provider based. According to backend type, you need | 27 // based and documents provider based. According to backend type, you need |
27 // to setup the fake with different functions. | 28 // to setup the fake with different functions. |
28 // | 29 // |
29 // Content URL based functions are: | 30 // Content URL based functions are: |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 109 |
109 // Adds a file accessible by content URL based methods. | 110 // Adds a file accessible by content URL based methods. |
110 void AddFile(const File& file); | 111 void AddFile(const File& file); |
111 | 112 |
112 // Adds a document accessible by document provider based methods. | 113 // Adds a document accessible by document provider based methods. |
113 void AddDocument(const Document& document); | 114 void AddDocument(const Document& document); |
114 | 115 |
115 // Triggers watchers installed to a document. | 116 // Triggers watchers installed to a document. |
116 void TriggerWatchers(const std::string& authority, | 117 void TriggerWatchers(const std::string& authority, |
117 const std::string& document_id, | 118 const std::string& document_id, |
118 mojom::ChangeType type); | 119 storage::WatcherManager::ChangeType type); |
119 | 120 |
120 // mojom::FileSystemInstance: | 121 // mojom::FileSystemInstance: |
121 void AddWatcher(const std::string& authority, | 122 void AddWatcher(const std::string& authority, |
122 const std::string& document_id, | 123 const std::string& document_id, |
123 const AddWatcherCallback& callback) override; | 124 const AddWatcherCallback& callback) override; |
124 void GetChildDocuments(const std::string& authority, | 125 void GetChildDocuments(const std::string& authority, |
125 const std::string& document_id, | 126 const std::string& document_id, |
126 const GetChildDocumentsCallback& callback) override; | 127 const GetChildDocumentsCallback& callback) override; |
127 void GetDocument(const std::string& authority, | 128 void GetDocument(const std::string& authority, |
128 const std::string& document_id, | 129 const std::string& document_id, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 std::map<int64_t, DocumentKey> watcher_to_document_; | 164 std::map<int64_t, DocumentKey> watcher_to_document_; |
164 | 165 |
165 int64_t next_watcher_id_ = 1; | 166 int64_t next_watcher_id_ = 1; |
166 | 167 |
167 DISALLOW_COPY_AND_ASSIGN(FakeFileSystemInstance); | 168 DISALLOW_COPY_AND_ASSIGN(FakeFileSystemInstance); |
168 }; | 169 }; |
169 | 170 |
170 } // namespace arc | 171 } // namespace arc |
171 | 172 |
172 #endif // COMPONENTS_ARC_TEST_FAKE_FILE_SYSTEM_INSTANCE_H_ | 173 #endif // COMPONENTS_ARC_TEST_FAKE_FILE_SYSTEM_INSTANCE_H_ |
OLD | NEW |