| 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 "base/bind.h" |
| 8 #include "base/location.h" |
| 9 #include "base/optional.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" |
| 11 #include "mojo/public/cpp/system/handle.h" |
| 12 |
| 7 namespace arc { | 13 namespace arc { |
| 8 | 14 |
| 9 FakeFileSystemInstance::FakeFileSystemInstance() = default; | 15 FakeFileSystemInstance::FakeFileSystemInstance() = default; |
| 10 | 16 |
| 11 FakeFileSystemInstance::~FakeFileSystemInstance() = default; | 17 FakeFileSystemInstance::~FakeFileSystemInstance() = default; |
| 12 | 18 |
| 13 void FakeFileSystemInstance::GetChildDocuments( | 19 void FakeFileSystemInstance::GetChildDocuments( |
| 14 const std::string& authority, | 20 const std::string& authority, |
| 15 const std::string& document_id, | 21 const std::string& document_id, |
| 16 const GetChildDocumentsCallback& callback) {} | 22 const GetChildDocumentsCallback& callback) { |
| 23 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 24 FROM_HERE, base::Bind(callback, base::nullopt)); |
| 25 } |
| 17 | 26 |
| 18 void FakeFileSystemInstance::GetDocument(const std::string& authority, | 27 void FakeFileSystemInstance::GetDocument(const std::string& authority, |
| 19 const std::string& document_id, | 28 const std::string& document_id, |
| 20 const GetDocumentCallback& callback) {} | 29 const GetDocumentCallback& callback) { |
| 30 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 31 FROM_HERE, base::Bind(callback, base::Passed(mojom::DocumentPtr()))); |
| 32 } |
| 21 | 33 |
| 22 void FakeFileSystemInstance::GetFileSize(const std::string& url, | 34 void FakeFileSystemInstance::GetFileSize(const std::string& url, |
| 23 const GetFileSizeCallback& callback) {} | 35 const GetFileSizeCallback& callback) { |
| 36 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 37 base::Bind(callback, -1)); |
| 38 } |
| 24 | 39 |
| 25 void FakeFileSystemInstance::OpenFileToRead( | 40 void FakeFileSystemInstance::OpenFileToRead( |
| 26 const std::string& url, | 41 const std::string& url, |
| 27 const OpenFileToReadCallback& callback) {} | 42 const OpenFileToReadCallback& callback) { |
| 43 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 44 FROM_HERE, base::Bind(callback, base::Passed(mojo::ScopedHandle()))); |
| 45 } |
| 28 | 46 |
| 29 void FakeFileSystemInstance::RequestMediaScan( | 47 void FakeFileSystemInstance::RequestMediaScan( |
| 30 const std::vector<std::string>& paths) {} | 48 const std::vector<std::string>& paths) { |
| 49 // Do nothing and pretend we scaned them. |
| 50 } |
| 31 | 51 |
| 32 } // namespace arc | 52 } // namespace arc |
| OLD | NEW |