• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef OHOS_DISTRIBUTED_FILE_DAEMON_MANAGER_MOCK_H
16 #define OHOS_DISTRIBUTED_FILE_DAEMON_MANAGER_MOCK_H
17 
18 #include <gmock/gmock.h>
19 
20 #include "distributed_file_daemon_manager.h"
21 namespace OHOS {
22 namespace Storage {
23 namespace DistributedFile {
24 class BDistributedFileDaemonManager {
25 public:
26     virtual int32_t RegisterAssetCallback(const sptr<IAssetRecvCallback> &recvCallback) = 0;
27     virtual int32_t UnRegisterAssetCallback(const sptr<IAssetRecvCallback> &recvCallback) = 0;
28     BDistributedFileDaemonManager() = default;
29     virtual ~BDistributedFileDaemonManager() = default;
30 
31 private:
32     static inline std::shared_ptr<BDistributedFileDaemonManager> fileDaemonManger_ = nullptr;
33 };
34 
35 class DistributedFileDaemonManagerMock : public BDistributedFileDaemonManager {
36 public:
37     MOCK_METHOD(int32_t, RegisterAssetCallback, (const sptr<IAssetRecvCallback> &recvCallback));
38     MOCK_METHOD(int32_t, UnRegisterAssetCallback, (const sptr<IAssetRecvCallback> &recvCallback));
39 };
40 
41 class DistributedFileDaemonManagerImpl : public DistributedFileDaemonManager {
42 public:
GetInstance()43     static DistributedFileDaemonManagerImpl &GetInstance()
44     {
45         static DistributedFileDaemonManagerImpl instance;
46         return instance;
47     }
48     int32_t RegisterAssetCallback(const sptr<IAssetRecvCallback> &recvCallback) override;
49     int32_t UnRegisterAssetCallback(const sptr<IAssetRecvCallback> &recvCallback) override;
50 
OpenP2PConnection(const DistributedHardware::DmDeviceInfo & deviceInfo)51     int32_t OpenP2PConnection(const DistributedHardware::DmDeviceInfo &deviceInfo) override
52     {
53         return 0;
54     }
CloseP2PConnection(const DistributedHardware::DmDeviceInfo & deviceInfo)55     int32_t CloseP2PConnection(const DistributedHardware::DmDeviceInfo &deviceInfo) override
56     {
57         return 0;
58     }
OpenP2PConnectionEx(const std::string & networkId,sptr<IFileDfsListener> remoteReverseObj)59     int32_t OpenP2PConnectionEx(const std::string &networkId, sptr<IFileDfsListener> remoteReverseObj) override
60     {
61         return 0;
62     }
CloseP2PConnectionEx(const std::string & networkId)63     int32_t CloseP2PConnectionEx(const std::string &networkId) override
64     {
65         return 0;
66     }
PrepareSession(const std::string & srcUri,const std::string & dstUri,const std::string & srcDeviceId,const sptr<IRemoteObject> & listener,HmdfsInfo & info)67     int32_t PrepareSession(const std::string &srcUri, const std::string &dstUri, const std::string &srcDeviceId,
68         const sptr<IRemoteObject> &listener, HmdfsInfo &info) override
69     {
70         return 0;
71     }
CancelCopyTask(const std::string & sessionName)72     int32_t CancelCopyTask(const std::string &sessionName) override
73     {
74         return 0;
75     }
CancelCopyTask(const std::string & srcUri,const std::string & dstUri)76     int32_t CancelCopyTask(const std::string &srcUri, const std::string &dstUri) override
77     {
78         return 0;
79     }
80 
PushAsset(int32_t userId,const sptr<AssetObj> & assetObj,const sptr<IAssetSendCallback> & sendCallback)81     int32_t PushAsset(int32_t userId, const sptr<AssetObj> &assetObj,
82         const sptr<IAssetSendCallback> &sendCallback) override
83     {
84         return 0;
85     }
GetSize(const std::string & uri,bool isSrcUri,uint64_t & size)86     int32_t GetSize(const std::string &uri, bool isSrcUri, uint64_t &size) override
87     {
88         return 0;
89     }
IsDirectory(const std::string & uri,bool isSrcUri,bool & isDirectory)90     int32_t IsDirectory(const std::string &uri, bool isSrcUri, bool &isDirectory) override
91     {
92         return 0;
93     }
Copy(const std::string & srcUri,const std::string & destUri,ProcessCallback processCallback)94     int32_t Copy(const std::string &srcUri, const std::string &destUri, ProcessCallback processCallback) override
95     {
96         return 0;
97     }
Cancel(const std::string & srcUri,const std::string & destUri)98     int32_t Cancel(const std::string &srcUri, const std::string &destUri) override
99     {
100         return 0;
101     }
Cancel()102     int32_t Cancel() override
103     {
104         return 0;
105     }
GetDfsSwitchStatus(const std::string & networkId,int32_t & switchStatus)106     int32_t GetDfsSwitchStatus(const std::string &networkId, int32_t &switchStatus) override
107     {
108         return 0;
109     }
UpdateDfsSwitchStatus(int32_t switchStatus)110     int32_t UpdateDfsSwitchStatus(int32_t switchStatus) override
111     {
112         return 0;
113     }
GetConnectedDeviceList(std::vector<DfsDeviceInfo> & deviceList)114     int32_t GetConnectedDeviceList(std::vector<DfsDeviceInfo> &deviceList) override
115     {
116         return 0;
117     }
118 };
119 } // namespace DistributedFile
120 } // namespace Storage
121 } // namespace OHOS
122 #endif