1 // Copyright 2014 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/storage_monitor/test_media_transfer_protocol_manager_chromeos.h"
11 #include "base/no_destructor.h"
12 #include "services/device/public/mojom/mtp_file_entry.mojom.h"
13 #include "services/device/public/mojom/mtp_storage_info.mojom.h"
15 namespace storage_monitor {
18 TestMediaTransferProtocolManagerChromeOS*
19 TestMediaTransferProtocolManagerChromeOS::GetFakeMtpManager() {
20 static base::NoDestructor<TestMediaTransferProtocolManagerChromeOS>
22 return fake_mtp_manager.get();
25 TestMediaTransferProtocolManagerChromeOS::
26 TestMediaTransferProtocolManagerChromeOS() {}
28 TestMediaTransferProtocolManagerChromeOS::
29 ~TestMediaTransferProtocolManagerChromeOS() {}
31 void TestMediaTransferProtocolManagerChromeOS::AddReceiver(
32 mojo::PendingReceiver<device::mojom::MtpManager> receiver) {
33 receivers_.Add(this, std::move(receiver));
36 void TestMediaTransferProtocolManagerChromeOS::EnumerateStoragesAndSetClient(
37 mojo::PendingAssociatedRemote<device::mojom::MtpManagerClient> client,
38 EnumerateStoragesAndSetClientCallback callback) {
39 std::move(callback).Run(std::vector<device::mojom::MtpStorageInfoPtr>());
42 void TestMediaTransferProtocolManagerChromeOS::GetStorageInfo(
43 const std::string& storage_name,
44 GetStorageInfoCallback callback) {
45 std::move(callback).Run(nullptr);
48 void TestMediaTransferProtocolManagerChromeOS::GetStorageInfoFromDevice(
49 const std::string& storage_name,
50 GetStorageInfoFromDeviceCallback callback) {
51 std::move(callback).Run(device::mojom::MtpStorageInfo::New(),
55 void TestMediaTransferProtocolManagerChromeOS::OpenStorage(
56 const std::string& storage_name,
57 const std::string& mode,
58 OpenStorageCallback callback) {
59 std::move(callback).Run("", true);
62 void TestMediaTransferProtocolManagerChromeOS::CloseStorage(
63 const std::string& storage_handle,
64 CloseStorageCallback callback) {
65 std::move(callback).Run(true);
68 void TestMediaTransferProtocolManagerChromeOS::CreateDirectory(
69 const std::string& storage_handle,
71 const std::string& directory_name,
72 CreateDirectoryCallback callback) {
73 std::move(callback).Run(true /* error */);
76 void TestMediaTransferProtocolManagerChromeOS::ReadDirectoryEntryIds(
77 const std::string& storage_handle,
79 ReadDirectoryEntryIdsCallback callback) {
80 std::move(callback).Run(std::vector<uint32_t>(), /*error=*/true);
83 void TestMediaTransferProtocolManagerChromeOS::ReadFileChunk(
84 const std::string& storage_handle,
88 ReadFileChunkCallback callback) {
89 std::move(callback).Run(std::string(), true);
92 void TestMediaTransferProtocolManagerChromeOS::GetFileInfo(
93 const std::string& storage_handle,
94 const std::vector<uint32_t>& file_ids,
95 GetFileInfoCallback callback) {
96 std::move(callback).Run(std::vector<device::mojom::MtpFileEntryPtr>(), true);
99 void TestMediaTransferProtocolManagerChromeOS::RenameObject(
100 const std::string& storage_handle,
102 const std::string& new_name,
103 RenameObjectCallback callback) {
104 std::move(callback).Run(true /* error */);
107 void TestMediaTransferProtocolManagerChromeOS::CopyFileFromLocal(
108 const std::string& storage_handle,
109 int64_t source_file_descriptor,
111 const std::string& file_name,
112 CopyFileFromLocalCallback callback) {
113 std::move(callback).Run(true /* error */);
116 void TestMediaTransferProtocolManagerChromeOS::DeleteObject(
117 const std::string& storage_handle,
119 DeleteObjectCallback callback) {
120 std::move(callback).Run(true /* error */);
123 } // namespace storage_monitor