• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 MOCK_STORAGE_MANAGER_SERVICE_H
16 #define MOCK_STORAGE_MANAGER_SERVICE_H
17 
18 #include "gmock/gmock.h"
19 #include "iremote_stub.h"
20 #include "istorage_manager.h"
21 #include "storage_service_errno.h"
22 
23 namespace OHOS {
24 namespace StorageManager {
25 class StorageManagerServiceMock :  public IRemoteStub<IStorageManager> {
26 public:
27     int code_ = 0;
StorageManagerServiceMock()28     StorageManagerServiceMock() : code_(0) {}
~StorageManagerServiceMock()29     virtual ~StorageManagerServiceMock() {}
30 
31     MOCK_METHOD4(SendRequest, int(uint32_t, MessageParcel &, MessageParcel &, MessageOption &));
InvokeSendRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)32     int32_t InvokeSendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
33     {
34         code_ = code;
35         return E_OK;
36     }
37 
PrepareAddUser(int32_t userId,uint32_t flags)38     virtual int32_t PrepareAddUser(int32_t userId, uint32_t flags) override
39     {
40         return E_OK;
41     }
42 
RemoveUser(int32_t userId,uint32_t flags)43     virtual int32_t RemoveUser(int32_t userId, uint32_t flags) override
44     {
45         return E_OK;
46     }
47 
PrepareStartUser(int32_t userId)48     virtual int32_t PrepareStartUser(int32_t userId) override
49     {
50         return E_OK;
51     }
52 
StopUser(int32_t userId)53     virtual int32_t StopUser(int32_t userId) override
54     {
55         return E_OK;
56     }
57 
GetFreeSizeOfVolume(std::string volumeUuid)58     virtual int64_t GetFreeSizeOfVolume(std::string volumeUuid) override
59     {
60         return E_OK;
61     }
62 
GetTotalSizeOfVolume(std::string volumeUuid)63     virtual int64_t GetTotalSizeOfVolume(std::string volumeUuid) override
64     {
65         return E_OK;
66     }
67 
GetBundleStats(std::string pkgName)68     virtual std::vector<int64_t> GetBundleStats(std::string pkgName) override
69     {
70         std::vector<int64_t> result;
71         return result;
72     }
73 
NotifyVolumeCreated(VolumeCore vc)74     virtual void NotifyVolumeCreated(VolumeCore vc) override {}
75 
NotifyVolumeMounted(std::string volumeId,int fsType,std::string fsUuid,std::string path,std::string description)76     virtual void NotifyVolumeMounted(std::string volumeId, int fsType, std::string fsUuid,
77                                      std::string path, std::string description) override {}
78 
NotifyVolumeDestroyed(std::string volumeId)79     virtual void NotifyVolumeDestroyed(std::string volumeId) override {}
80 
Mount(std::string volumeId)81     virtual int32_t Mount(std::string volumeId) override
82     {
83         return E_OK;
84     }
85 
Unmount(std::string volumeId)86     virtual int32_t Unmount(std::string volumeId) override
87     {
88         return E_OK;
89     }
90 
GetAllVolumes()91     virtual std::vector<VolumeExternal> GetAllVolumes() override
92     {
93         std::vector<VolumeExternal> result;
94         return result;
95     }
96 
NotifyDiskCreated(Disk disk)97     virtual void NotifyDiskCreated(Disk disk) override {}
98 
NotifyDiskDestroyed(std::string diskId)99     virtual void NotifyDiskDestroyed(std::string diskId) override {}
100 
Partition(std::string diskId,int32_t type)101     virtual int32_t Partition(std::string diskId, int32_t type) override
102     {
103         return E_OK;
104     }
105 
GetAllDisks()106     virtual std::vector<Disk> GetAllDisks() override
107     {
108         std::vector<Disk> result;
109         return result;
110     }
111 
GenerateUserKeys(uint32_t userId,uint32_t flags)112     virtual int32_t GenerateUserKeys(uint32_t userId, uint32_t flags) override
113     {
114         return E_OK;
115     }
116 
DeleteUserKeys(uint32_t userId)117     virtual int32_t DeleteUserKeys(uint32_t userId) override
118     {
119         return E_OK;
120     }
121 
UpdateUserAuth(uint32_t userId,std::string auth,std::string compSecret)122     virtual int32_t UpdateUserAuth(uint32_t userId, std::string auth, std::string compSecret) override
123     {
124         return E_OK;
125     }
126 
ActiveUserKey(uint32_t userId,std::string auth,std::string compSecret)127     virtual int32_t ActiveUserKey(uint32_t userId, std::string auth, std::string compSecret) override
128     {
129         return E_OK;
130     }
131 
InactiveUserKey(uint32_t userId)132     virtual int32_t InactiveUserKey(uint32_t userId) override
133     {
134         return E_OK;
135     }
136 
UpdateKeyContext(uint32_t userId)137     virtual int32_t UpdateKeyContext(uint32_t userId) override
138     {
139         return E_OK;
140     }
141 };
142 } // namespace StorageManager
143 } // namespace OHOS
144 #endif // MOCK_STORAGE_MANAGER_SERVICE_H