1 /*
2  * Copyright (c) 2024 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 
16 #ifndef OHOS_STORAGEMANAGERPROXYMOCK_H
17 #define OHOS_STORAGEMANAGERPROXYMOCK_H
18 
19 #include "storage_manager.h"
20 #include "storage_service_errno.h"
21 
22 namespace OHOS {
23 namespace StorageManager {
24 class StorageManagerProxyMock final : public IRemoteStub<IStorageManager> {
25 public:
26     int code_ = 0;
StorageManagerProxyMock()27     StorageManagerProxyMock() : code_(0) {}
~StorageManagerProxyMock()28     virtual ~StorageManagerProxyMock() {}
InvokeSendRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)29     int32_t InvokeSendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
30     {
31         code_ = code;
32         return E_OK;
33     }
34 
PrepareAddUser(int32_t userId,uint32_t flags)35     int32_t PrepareAddUser(int32_t userId, uint32_t flags) override
36     {
37         return E_OK;
38     }
39 
RemoveUser(int32_t userId,uint32_t flags)40     int32_t RemoveUser(int32_t userId, uint32_t flags) override
41     {
42         return E_OK;
43     }
44 
PrepareStartUser(int32_t userId)45     int32_t PrepareStartUser(int32_t userId) override
46     {
47         return E_OK;
48     }
49 
StopUser(int32_t userId)50     int32_t StopUser(int32_t userId) override
51     {
52         return E_OK;
53     }
54 
CompleteAddUser(int32_t userId)55     int32_t CompleteAddUser(int32_t userId) override
56     {
57         return E_OK;
58     }
59 
GetFreeSizeOfVolume(std::string volumeUuid,int64_t & freeSize)60     int32_t GetFreeSizeOfVolume(std::string volumeUuid, int64_t &freeSize) override
61     {
62         return E_OK;
63     }
64 
GetTotalSizeOfVolume(std::string volumeUuid,int64_t & totalSize)65     int32_t GetTotalSizeOfVolume(std::string volumeUuid, int64_t &totalSize) override
66     {
67         return E_OK;
68     }
69 
GetBundleStats(std::string pkgName,BundleStats & bundleStats,int32_t appIndex,uint32_t statFlag)70     int32_t GetBundleStats(std::string pkgName, BundleStats &bundleStats, int32_t appIndex, uint32_t statFlag) override
71     {
72         return E_OK;
73     }
74 
GetSystemSize(int64_t & systemSize)75     int32_t GetSystemSize(int64_t &systemSize) override
76     {
77         return E_OK;
78     }
79 
GetTotalSize(int64_t & totalSize)80     int32_t GetTotalSize(int64_t &totalSize) override
81     {
82         return E_OK;
83     }
84 
GetFreeSize(int64_t & freeSize)85     int32_t GetFreeSize(int64_t &freeSize) override
86     {
87         return E_OK;
88     }
89 
GetUserStorageStats(StorageStats & storageStats)90     int32_t GetUserStorageStats(StorageStats &storageStats) override
91     {
92         return E_OK;
93     }
94 
GetUserStorageStats(int32_t userId,StorageStats & storageStats)95     int32_t GetUserStorageStats(int32_t userId, StorageStats &storageStats) override
96     {
97         return E_OK;
98     }
99 
GetUserStorageStatsByType(int32_t userId,StorageStats & storageStats,std::string type)100     int32_t GetUserStorageStatsByType(int32_t userId, StorageStats &storageStats, std::string type) override
101     {
102         return E_OK;
103     }
104 
GetCurrentBundleStats(BundleStats & bundleStats,uint32_t statFlag)105     int32_t GetCurrentBundleStats(BundleStats &bundleStats, uint32_t statFlag) override
106     {
107         return E_OK;
108     }
109 
NotifyVolumeCreated(VolumeCore vc)110     int32_t NotifyVolumeCreated(VolumeCore vc) override
111     {
112         return E_OK;
113     }
114 
NotifyVolumeMounted(std::string volumeId,int fsType,std::string fsUuid,std::string path,std::string description)115     int32_t NotifyVolumeMounted(std::string volumeId, int fsType, std::string fsUuid,
116                                         std::string path, std::string description) override
117     {
118         return E_OK;
119     }
120 
NotifyVolumeStateChanged(std::string volumeId,VolumeState state)121     int32_t NotifyVolumeStateChanged(std::string volumeId, VolumeState state) override
122     {
123         return E_OK;
124     }
125 
Mount(std::string volumeId)126     int32_t Mount(std::string volumeId) override
127     {
128         return E_OK;
129     }
130 
Unmount(std::string volumeId)131     int32_t Unmount(std::string volumeId) override
132     {
133         return E_OK;
134     }
135 
GetAllVolumes(std::vector<VolumeExternal> & vecOfVol)136     int32_t GetAllVolumes(std::vector<VolumeExternal> &vecOfVol) override
137     {
138         return E_OK;
139     }
140 
NotifyDiskCreated(Disk disk)141     int32_t NotifyDiskCreated(Disk disk) override
142     {
143         return E_OK;
144     }
145 
NotifyDiskDestroyed(std::string diskId)146     int32_t NotifyDiskDestroyed(std::string diskId) override
147     {
148         return E_OK;
149     }
150 
Partition(std::string diskId,int32_t type)151     int32_t Partition(std::string diskId, int32_t type) override
152     {
153         return E_OK;
154     }
155 
GetAllDisks(std::vector<Disk> & vecOfDisk)156     int32_t GetAllDisks(std::vector<Disk> &vecOfDisk) override
157     {
158         return E_OK;
159     }
160 
GetVolumeByUuid(std::string fsUuid,VolumeExternal & vc)161     int32_t GetVolumeByUuid(std::string fsUuid, VolumeExternal &vc) override
162     {
163         return E_OK;
164     }
165 
GetVolumeById(std::string volumeId,VolumeExternal & vc)166     int32_t GetVolumeById(std::string volumeId, VolumeExternal &vc) override
167     {
168         return E_OK;
169     }
170 
SetVolumeDescription(std::string fsUuid,std::string description)171     int32_t SetVolumeDescription(std::string fsUuid, std::string description) override
172     {
173         return E_OK;
174     }
175 
Format(std::string volumeId,std::string fsType)176     int32_t Format(std::string volumeId, std::string fsType) override
177     {
178         return E_OK;
179     }
180 
GetDiskById(std::string diskId,Disk & disk)181     int32_t GetDiskById(std::string diskId, Disk &disk) override
182     {
183         return E_OK;
184     }
185 
GenerateUserKeys(uint32_t userId,uint32_t flags)186     int32_t GenerateUserKeys(uint32_t userId, uint32_t flags) override
187     {
188         return E_OK;
189     }
190 
DeleteUserKeys(uint32_t userId)191     int32_t DeleteUserKeys(uint32_t userId) override
192     {
193         return E_OK;
194     }
195 
UpdateUserAuth(uint32_t userId,uint64_t secureUid,const std::vector<uint8_t> & token,const std::vector<uint8_t> & oldSecret,const std::vector<uint8_t> & newSecret)196     int32_t UpdateUserAuth(uint32_t userId, uint64_t secureUid,
197                                    const std::vector<uint8_t> &token,
198                                    const std::vector<uint8_t> &oldSecret,
199                                    const std::vector<uint8_t> &newSecret) override
200     {
201         return E_OK;
202     }
203 
ActiveUserKey(uint32_t userId,const std::vector<uint8_t> & token,const std::vector<uint8_t> & secret)204     int32_t ActiveUserKey(uint32_t userId,
205                                   const std::vector<uint8_t> &token,
206                                   const std::vector<uint8_t> &secret) override
207     {
208         return E_OK;
209     }
210 
InactiveUserKey(uint32_t userId)211     int32_t InactiveUserKey(uint32_t userId) override
212     {
213         return E_OK;
214     }
215 
LockUserScreen(uint32_t userId)216     int32_t LockUserScreen(uint32_t userId) override
217     {
218         return E_OK;
219     }
220 
UnlockUserScreen(uint32_t userId,const std::vector<uint8_t> & token,const std::vector<uint8_t> & secret)221     int32_t UnlockUserScreen(uint32_t userId,
222                              const std::vector<uint8_t> &token,
223                              const std::vector<uint8_t> &secret) override
224     {
225         return E_OK;
226     }
227 
GetLockScreenStatus(uint32_t userId,bool & lockScreenStatus)228     int32_t GetLockScreenStatus(uint32_t userId, bool &lockScreenStatus) override
229     {
230         return E_OK;
231     }
232 
GenerateAppkey(uint32_t hashId,uint32_t userId,std::string & keyId)233     int32_t GenerateAppkey(uint32_t hashId, uint32_t userId, std::string &keyId) override
234     {
235         return E_OK;
236     }
237 
DeleteAppkey(const std::string keyId)238     int32_t DeleteAppkey(const std::string keyId) override
239     {
240         return E_OK;
241     }
242 
UpdateKeyContext(uint32_t userId)243     int32_t UpdateKeyContext(uint32_t userId) override
244     {
245         return E_OK;
246     }
247 
MountDfsDocs(int32_t userId,const std::string & relativePath,const std::string & networkId,const std::string & deviceId)248     int32_t MountDfsDocs(int32_t userId, const std::string &relativePath,
249         const std::string &networkId, const std::string &deviceId) override
250     {
251         return E_OK;
252     }
253 
UMountDfsDocs(int32_t userId,const std::string & relativePath,const std::string & networkId,const std::string & deviceId)254     int32_t UMountDfsDocs(int32_t userId, const std::string &relativePath,
255         const std::string &networkId, const std::string &deviceId) override
256     {
257         return E_OK;
258     }
259 
CreateShareFile(const std::vector<std::string> & uriList,uint32_t tokenId,uint32_t flag)260     std::vector<int32_t> CreateShareFile(const std::vector<std::string> &uriList,
261                                                  uint32_t tokenId, uint32_t flag) override
262     {
263         return std::vector<int32_t>{E_OK};
264     }
265 
DeleteShareFile(uint32_t tokenId,const std::vector<std::string> & uriList)266     int32_t DeleteShareFile(uint32_t tokenId, const std::vector<std::string> &uriList) override
267     {
268         return E_OK;
269     }
UpdateMemoryPara(int32_t size,int32_t & oldSize)270     int32_t UpdateMemoryPara(int32_t size, int32_t &oldSize) override
271     {
272         return E_OK;
273     }
GetBundleStatsForIncrease(uint32_t userId,const std::vector<std::string> & bundleNames,const std::vector<int64_t> & incrementalBackTimes,std::vector<int64_t> & pkgFileSizes,std::vector<int64_t> & incPkgFileSizes)274     int32_t GetBundleStatsForIncrease(uint32_t userId,
275                                       const std::vector<std::string> &bundleNames,
276                                       const std::vector<int64_t> &incrementalBackTimes,
277                                       std::vector<int64_t> &pkgFileSizes,
278                                       std::vector<int64_t> &incPkgFileSizes) override
279     {
280         return E_OK;
281     }
282     int32_t GetFileEncryptStatus(uint32_t userId, bool &isEncrypted, bool needCheckDirMount = false) override
283      {
284          return E_OK;
285      }
286 };
287 } // namespace StorageManager
288 } // namespace OHOS
289 
290 #endif //OHOS_STORAGEMANAGERPROXYMOCK_H
291