| 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 #include "components/arc/test/fake_file_system_instance.h" | 5 #include "components/arc/test/fake_file_system_instance.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <unistd.h> | 8 #include <unistd.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 DCHECK_EQ(0u, documents_.count(key)); | 108 DCHECK_EQ(0u, documents_.count(key)); |
| 109 documents_.insert(std::make_pair(key, document)); | 109 documents_.insert(std::make_pair(key, document)); |
| 110 child_documents_[key]; // Allocate a vector. | 110 child_documents_[key]; // Allocate a vector. |
| 111 if (!document.parent_document_id.empty()) { | 111 if (!document.parent_document_id.empty()) { |
| 112 DocumentKey parent_key(document.authority, document.parent_document_id); | 112 DocumentKey parent_key(document.authority, document.parent_document_id); |
| 113 DCHECK_EQ(1u, documents_.count(parent_key)); | 113 DCHECK_EQ(1u, documents_.count(parent_key)); |
| 114 child_documents_[parent_key].push_back(key); | 114 child_documents_[parent_key].push_back(key); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 void FakeFileSystemInstance::AddWatcher(const std::string& authority, |
| 119 const std::string& document_id, |
| 120 const AddWatcherCallback& callback) { |
| 121 DCHECK(thread_checker_.CalledOnValidThread()); |
| 122 NOTIMPLEMENTED(); |
| 123 } |
| 124 |
| 118 void FakeFileSystemInstance::GetFileSize(const std::string& url, | 125 void FakeFileSystemInstance::GetFileSize(const std::string& url, |
| 119 const GetFileSizeCallback& callback) { | 126 const GetFileSizeCallback& callback) { |
| 120 DCHECK(thread_checker_.CalledOnValidThread()); | 127 DCHECK(thread_checker_.CalledOnValidThread()); |
| 121 auto iter = files_.find(url); | 128 auto iter = files_.find(url); |
| 122 if (iter == files_.end()) { | 129 if (iter == files_.end()) { |
| 123 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 130 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 124 base::Bind(callback, -1)); | 131 base::Bind(callback, -1)); |
| 125 return; | 132 return; |
| 126 } | 133 } |
| 127 const File& file = iter->second; | 134 const File& file = iter->second; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 auto doc_iter = documents_.find(child_key); | 194 auto doc_iter = documents_.find(child_key); |
| 188 DCHECK(doc_iter != documents_.end()); | 195 DCHECK(doc_iter != documents_.end()); |
| 189 children.emplace_back(MakeDocument(doc_iter->second)); | 196 children.emplace_back(MakeDocument(doc_iter->second)); |
| 190 } | 197 } |
| 191 base::ThreadTaskRunnerHandle::Get()->PostTask( | 198 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 192 FROM_HERE, | 199 FROM_HERE, |
| 193 base::Bind(callback, | 200 base::Bind(callback, |
| 194 base::Passed(base::make_optional(std::move(children))))); | 201 base::Passed(base::make_optional(std::move(children))))); |
| 195 } | 202 } |
| 196 | 203 |
| 204 void FakeFileSystemInstance::Init(mojom::FileSystemHostPtr host) { |
| 205 DCHECK(thread_checker_.CalledOnValidThread()); |
| 206 NOTIMPLEMENTED(); |
| 207 } |
| 208 |
| 209 void FakeFileSystemInstance::RemoveWatcher( |
| 210 int64_t watcher_id, |
| 211 const RemoveWatcherCallback& callback) { |
| 212 DCHECK(thread_checker_.CalledOnValidThread()); |
| 213 NOTIMPLEMENTED(); |
| 214 } |
| 215 |
| 197 void FakeFileSystemInstance::RequestMediaScan( | 216 void FakeFileSystemInstance::RequestMediaScan( |
| 198 const std::vector<std::string>& paths) { | 217 const std::vector<std::string>& paths) { |
| 199 DCHECK(thread_checker_.CalledOnValidThread()); | 218 DCHECK(thread_checker_.CalledOnValidThread()); |
| 200 // Do nothing and pretend we scaned them. | 219 // Do nothing and pretend we scaned them. |
| 201 } | 220 } |
| 202 | 221 |
| 203 } // namespace arc | 222 } // namespace arc |
| OLD | NEW |