• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 #include <cstdio>
17 #include <gtest/gtest.h>
18 
19 #include "storage_manager_proxy.h"
20 #include "ipc/storage_manager.h"
21 #include "ipc_skeleton.h"
22 #include "iservice_registry.h"
23 #include "storage_manager_service_mock.h"
24 #include "system_ability_definition.h"
25 #include "volume/volume_manager_service.h"
26 
27 namespace {
28 using namespace std;
29 using namespace OHOS;
30 using namespace StorageManager;
31 class StorageManagerProxyTest : public testing::Test {
32 public:
SetUpTestCase(void)33     static void SetUpTestCase(void) {};
TearDownTestCase()34     static void TearDownTestCase() {};
35     void SetUp();
TearDown()36     void TearDown() {};
37     std::shared_ptr<StorageManagerProxy> proxy_ = nullptr;
38     sptr<StorageManagerServiceMock> mock_ = nullptr;
39 };
40 
SetUp()41 void StorageManagerProxyTest::SetUp()
42 {
43     mock_ = new StorageManagerServiceMock();
44     proxy_ = std::make_shared<StorageManagerProxy>(mock_);
45 }
46 
47 /**
48  * @tc.number: SUB_STORAGE_Storage_manager_proxy_PrepareAddUser_0000
49  * @tc.name: Storage_manager_proxy_PrepareAddUser_0000
50  * @tc.desc: Test function of PrepareAddUser interface for SUCCESS.
51  * @tc.size: MEDIUM
52  * @tc.type: FUNC
53  * @tc.level Level 1
54  * @tc.require: AR000GK4HB
55  */
56 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_PrepareAddUser_0000, testing::ext::TestSize.Level1)
57 {
58     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_PrepareAddUser_0000";
59     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
60     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
61         .Times(1)
62         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
63     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
64 
65     int32_t userId = 101;
66     uint32_t flag = CRYPTO_FLAG_EL1;
67     int32_t result = proxy_->PrepareAddUser(userId, flag);
68     EXPECT_EQ(result, E_OK);
69 
70     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
71         .Times(1)
72         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
73     result = proxy_->PrepareAddUser(userId, flag);
74     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
75     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_PrepareAddUser_0000";
76 }
77 
78 /**
79  * @tc.number: SUB_STORAGE_Storage_manager_proxy_RemoveUser_0000
80  * @tc.name: Storage_manager_proxy_RemoveUser_0000
81  * @tc.desc: Test function of RemoveUser interface for SUCCESS.
82  * @tc.size: MEDIUM
83  * @tc.type: FUNC
84  * @tc.level Level 1
85  * @tc.require: AR000GK4HB
86  */
87 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_RemoveUser_0000, testing::ext::TestSize.Level1)
88 {
89     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_RemoveUser_0000";
90     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
91     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
92         .Times(1)
93         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
94     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
95 
96     int32_t userId = 103;
97     uint32_t flag = CRYPTO_FLAG_EL1;
98     int32_t result = proxy_->RemoveUser(userId, flag);
99     EXPECT_EQ(result, E_OK);
100 
101     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
102         .Times(1)
103         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
104     result = proxy_->RemoveUser(userId, flag);
105     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
106     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_RemoveUser_0000";
107 }
108 
109 /**
110  * @tc.number: SUB_STORAGE_Storage_manager_proxy_PrepareStartUser_0000
111  * @tc.name: Storage_manager_proxy_PrepareStartUser_0000
112  * @tc.desc: Test function of PrepareStartUser interface for SUCCESS.
113  * @tc.size: MEDIUM
114  * @tc.type: FUNC
115  * @tc.level Level 1
116  * @tc.require: AR000GK4HB
117  */
118 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_PrepareStartUser_0000, testing::ext::TestSize.Level1)
119 {
120     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_PrepareStartUser_0000";
121     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
122     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
123         .Times(1)
124         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
125     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
126 
127     int32_t userId = 105;
128     int32_t result = proxy_->PrepareStartUser(userId);
129     EXPECT_EQ(result, E_OK);
130 
131     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
132         .Times(1)
133         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
134     result = proxy_->PrepareStartUser(userId);
135     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
136     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_PrepareStartUser_0000";
137 }
138 
139 /**
140  * @tc.number: SUB_STORAGE_Storage_manager_proxy_StopUser_0000
141  * @tc.name: Storage_manager_proxy_StopUser_0000
142  * @tc.desc: Test function of StopUser interface for SUCCESS.
143  * @tc.size: MEDIUM
144  * @tc.type: FUNC
145  * @tc.level Level 1
146  * @tc.require: AR000GK4HB
147  */
148 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_StopUser_0000, testing::ext::TestSize.Level1)
149 {
150     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_StopUser_0000";
151     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
152     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
153         .Times(1)
154         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
155     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
156 
157     int32_t userId = 108;
158     int32_t result = proxy_->StopUser(userId);
159     EXPECT_EQ(result, E_OK);
160 
161     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
162         .Times(1)
163         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
164     result = proxy_->StopUser(userId);
165     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
166     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_StopUser_0000";
167 }
168 
169 /**
170  * @tc.number: SUB_STORAGE_Storage_manager_proxy_CompleteAddUser_0000
171  * @tc.name: Storage_manager_proxy_CompleteAddUser_0000
172  * @tc.desc: Test function of CompleteAddUser interface.
173  * @tc.size: MEDIUM
174  * @tc.type: FUNC
175  * @tc.level Level 1
176  * @tc.require: AR000GK4HB
177  */
178 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_CompleteAddUser_0000, testing::ext::TestSize.Level1)
179 {
180     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_CompleteAddUser_0000";
181     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
182     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
183         .Times(1)
184         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
185     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
186 
187     int32_t userId = 109;
188     int32_t result = proxy_->CompleteAddUser(userId);
189     EXPECT_EQ(result, E_OK);
190 
191     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
192         .Times(1)
193         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
194     result = proxy_->CompleteAddUser(userId);
195     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
196     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_CompleteAddUser_0000";
197 }
198 
199 /**
200  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetFreeSizeOfVolume_0000
201  * @tc.name: Storage_manager_proxy_GetFreeSizeOfVolume_0000
202  * @tc.desc: Test function of GetFreeSizeOfVolume interface for SUCCESS.
203  * @tc.size: MEDIUM
204  * @tc.type: FUNC
205  * @tc.level Level 1
206  * @tc.require: AR000GK100
207  */
208 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetFreeSizeOfVolume_0000, testing::ext::TestSize.Level1)
209 {
210     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetFreeSizeOfVolume_0000";
211     std::string volumeUuid = "uuid-1";
212     int64_t freeSize;
213     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
214     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
215         .Times(1)
216         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
217     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
218     int32_t result = proxy_->GetFreeSizeOfVolume(volumeUuid, freeSize);
219     EXPECT_EQ(result, E_OK);
220 
221     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
222         .Times(1)
223         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
224     result = proxy_->GetFreeSizeOfVolume(volumeUuid, freeSize);
225     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
226     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetFreeSizeOfVolume_0000";
227 }
228 
229 /**
230  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetTotalSizeOfVolume_0000
231  * @tc.name: Storage_manager_proxy_GetTotalSizeOfVolume_0000
232  * @tc.desc: Test function of GetTotalSizeOfVolume interface for SUCCESS.
233  * @tc.size: MEDIUM
234  * @tc.type: FUNC
235  * @tc.level Level 1
236  * @tc.require: AR000GK100
237  */
238 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetTotalSizeOfVolume_0000, testing::ext::TestSize.Level1)
239 {
240     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetTotalSizeOfVolume_0000";
241     std::string volumeUuid = "uuid-2";
242     int64_t totalSize;
243     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
244     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
245         .Times(1)
246         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
247     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
248     int32_t result = proxy_->GetTotalSizeOfVolume(volumeUuid, totalSize);
249     EXPECT_EQ(result, E_OK);
250 
251     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
252         .Times(1)
253         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
254     result = proxy_->GetTotalSizeOfVolume(volumeUuid, totalSize);
255     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
256     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetTotalSizeOfVolume_0000";
257 }
258 
259 /**
260  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetBundleStats_0000
261  * @tc.name: Storage_manager_proxy_GetBundleStats_0000
262  * @tc.desc: Test function of GetBundleStats interface for SUCCESS.
263  * @tc.size: MEDIUM
264  * @tc.type: FUNC
265  * @tc.level Level 1
266  * @tc.require: AR000GK101
267  */
268 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetBundleStats_0000, testing::ext::TestSize.Level1)
269 {
270     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetBundleStats_0000";
271     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
272     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
273         .Times(1)
274         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
275     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
276 
277     std::string pkgName = "ohos.acts.storage.volume";
278     BundleStats bundleStats;
279     int32_t result = proxy_->GetBundleStats(pkgName, bundleStats, 0, 0);
280     EXPECT_EQ(result, E_OK);
281 
282     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
283         .Times(1)
284         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
285     result = proxy_->GetBundleStats(pkgName, bundleStats, 0, 0);
286     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
287     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetBundleStats_0000";
288 }
289 
290 /**
291  * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyVolumeCreated_0000
292  * @tc.name: Storage_manager_proxy_NotifyVolumeCreated_0000
293  * @tc.desc: Test function of NotifyVolumeCreated interface for SUCCESS.
294  * @tc.size: MEDIUM
295  * @tc.type: FUNC
296  * @tc.level Level 1
297  * @tc.require: SR000GGUPF
298  */
299 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyVolumeCreated_0000, testing::ext::TestSize.Level1)
300 {
301     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyVolumeCreated_0000";
302     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
303     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
304         .Times(1)
305         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
306     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
307 
308     std::string volumeId = "vol-1-16";
309     int32_t fsType = 1;
310     std::string diskId = "disk-1-17";
311     VolumeCore vc(volumeId, fsType, diskId);
312     int64_t result = proxy_->NotifyVolumeCreated(vc);
313     EXPECT_EQ(result, E_OK);
314 
315     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
316         .Times(1)
317         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
318     result = proxy_->NotifyVolumeCreated(vc);
319     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
320     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyVolumeCreated_0000";
321 }
322 
323 /**
324  * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyVolumeMounted_0000
325  * @tc.name: Storage_manager_proxy_NotifyVolumeMounted_0000
326  * @tc.desc: Test function of NotifyVolumeMounted interface for SUCCESS.
327  * @tc.size: MEDIUM
328  * @tc.type: FUNC
329  * @tc.level Level 1
330  * @tc.require: SR000GGUPF
331  */
332 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyVolumeMounted_0000, testing::ext::TestSize.Level1)
333 {
334     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyVolumeMounted_0000";
335     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
336     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
337         .Times(1)
338         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
339     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
340 
341     std::string volumeId = "vol-1-18";
342     int32_t fsType = 1;
343     std::string fsUuid = "uuid-3";
344     std::string path = "/";
345     std::string description = "description-1";
346     int64_t result = proxy_->NotifyVolumeMounted(volumeId, fsType, fsUuid, path, description);
347     EXPECT_EQ(result, E_OK);
348 
349     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
350         .Times(1)
351         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
352     result = proxy_->NotifyVolumeMounted(volumeId, fsType, fsUuid, path, description);
353     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
354     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyVolumeMounted_0000";
355 }
356 
357 /**
358  * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyVolumeDestroyed_0000
359  * @tc.name: Storage_manager_proxy_NotifyVolumeDestroyed_0000
360  * @tc.desc: Test function of NotifyVolumeDestroyed interface for SUCCESS.
361  * @tc.size: MEDIUM
362  * @tc.type: FUNC
363  * @tc.level Level 1
364  * @tc.require: SR000GGUPF
365  */
366 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyVolumeDestroyed_0000, testing::ext::TestSize.Level1)
367 {
368     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyVolumeDestroyed_0000";
369     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
370     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
371         .Times(1)
372         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
373     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
374 
375     std::string volumeId = "vol-1-20";
376     int64_t result = proxy_->NotifyVolumeStateChanged(volumeId, VolumeState::BAD_REMOVAL);
377     EXPECT_EQ(result, E_OK);
378 
379     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
380         .Times(1)
381         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
382     result = proxy_->NotifyVolumeStateChanged(volumeId, VolumeState::BAD_REMOVAL);
383     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
384     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyVolumeDestroyed_0000";
385 }
386 
387 /**
388  * @tc.number: SUB_STORAGE_Storage_manager_proxy_Mount_0000
389  * @tc.name: Storage_manager_proxy_Mount_0000
390  * @tc.desc: Test function of Mount interface for SUCCESS.
391  * @tc.size: MEDIUM
392  * @tc.type: FUNC
393  * @tc.level Level 1
394  * @tc.require: SR000GGUOT
395  */
396 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_Mount_0000, testing::ext::TestSize.Level1)
397 {
398     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_Mount_0000";
399     std::string volumeId = "vol-1-21";
400     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
401     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
402         .Times(1)
403         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
404 
405     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
406     int32_t result = proxy_->Mount(volumeId);
407     EXPECT_EQ(result, E_OK);
408 
409     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
410         .Times(1)
411         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
412     result = proxy_->Mount(volumeId);
413     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
414     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_Mount_0000";
415 }
416 
417 /**
418  * @tc.number: SUB_STORAGE_Storage_manager_proxy_Unmount_0000
419  * @tc.name: Storage_manager_proxy_Unmount_0000
420  * @tc.desc: Test function of Unmount interface for SUCCESS.
421  * @tc.size: MEDIUM
422  * @tc.type: FUNC
423  * @tc.level Level 1
424  * @tc.require: SR000GGUOT
425  */
426 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_Unmount_0000, testing::ext::TestSize.Level1)
427 {
428     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_Unmount_0000";
429     std::string volumeId = "vol-1-22";
430     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
431     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
432         .Times(1)
433         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
434 
435     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
436     int32_t result = proxy_->Unmount(volumeId);
437     EXPECT_EQ(result, E_OK);
438 
439     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
440         .Times(1)
441         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
442     result = proxy_->Unmount(volumeId);
443     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
444     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_Unmount_0000";
445 }
446 
447 /**
448  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetAllVolumes_0000
449  * @tc.name: Storage_manager_proxy_GetAllVolumes_0000
450  * @tc.desc: Test function of GetAllVolumes interface for SUCCESS.
451  * @tc.size: MEDIUM
452  * @tc.type: FUNC
453  * @tc.level Level 1
454  * @tc.require: SR000GGUPF
455  */
456 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetAllVolumes_0000, testing::ext::TestSize.Level1)
457 {
458     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetAllVolumes_0000";
459     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
460     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
461         .Times(1)
462         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
463     std::vector<VolumeExternal> vecOfVol;
464     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
465     int32_t result = proxy_->GetAllVolumes(vecOfVol);
466     EXPECT_EQ(result, E_OK);
467 
468     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
469         .Times(1)
470         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
471     result = proxy_->GetAllVolumes(vecOfVol);
472     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
473     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetAllVolumes_0000";
474 }
475 
476 /**
477  * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyDiskCreated_0000
478  * @tc.name: Storage_manager_proxy_NotifyDiskCreated_0000
479  * @tc.desc: Test function of NotifyDiskCreated interface for SUCCESS.
480  * @tc.size: MEDIUM
481  * @tc.type: FUNC
482  * @tc.level Level 1
483  * @tc.require: SR000GGUPG
484  */
485 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyDiskCreated_0000, testing::ext::TestSize.Level1)
486 {
487     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyDiskCreated_0000";
488     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
489     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
490         .Times(1)
491         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
492     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
493 
494     std::string diskId = "disk-1-23";
495     int64_t sizeBytes = 1024;
496     std::string sysPath = "/";
497     std::string vendor = "vendor-1";
498     int32_t flag = 1; // disk type
499     Disk disk(diskId, sizeBytes, sysPath, vendor, flag);
500     int32_t result = proxy_->NotifyDiskCreated(disk);
501     EXPECT_EQ(result, E_OK);
502 
503     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
504         .Times(1)
505         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
506     result = proxy_->NotifyDiskCreated(disk);
507     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
508     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyDiskCreated_0000";
509 }
510 
511 /**
512  * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyDiskDestroyed_0000
513  * @tc.name: Storage_manager_proxy_NotifyDiskDestroyed_0000
514  * @tc.desc: Test function of NotifyDiskDestroyed interface for SUCCESS.
515  * @tc.size: MEDIUM
516  * @tc.type: FUNC
517  * @tc.level Level 1
518  * @tc.require: SR000GGUPG
519  */
520 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyDiskDestroyed_0000, testing::ext::TestSize.Level1)
521 {
522     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyDiskDestroyed_0000";
523     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
524     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
525         .Times(1)
526         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
527     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
528 
529     std::string diskId = "disk-1-24";
530     int32_t result = proxy_->NotifyDiskDestroyed(diskId);
531     EXPECT_EQ(result, E_OK);
532 
533     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
534         .Times(1)
535         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
536     result = proxy_->NotifyDiskDestroyed(diskId);
537     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
538     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyDiskDestroyed_0000";
539 }
540 
541 /**
542  * @tc.number: SUB_STORAGE_Storage_manager_proxy_Partition_0000
543  * @tc.name: Storage_manager_proxy_Partition_0000
544  * @tc.desc: Test function of Partition interface for SUCCESS.
545  * @tc.size: MEDIUM
546  * @tc.type: FUNC
547  * @tc.level Level 1
548  * @tc.require: SR000GGUOT
549  */
550 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_Partition_0000, testing::ext::TestSize.Level1)
551 {
552     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_Partition_0000";
553     std::string volumeId = "vol-1-25";
554     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
555     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
556         .Times(1)
557         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
558     std::string diskId = "disk-1-25";
559     int32_t type = 1;
560     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
561     int32_t result = proxy_->Partition(diskId, type);
562     EXPECT_EQ(result, E_OK);
563 
564     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
565         .Times(1)
566         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
567     result = proxy_->Partition(diskId, type);
568     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
569     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_Partition_0000";
570 }
571 
572 /**
573  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetAllDisks_0000
574  * @tc.name: Storage_manager_proxy_GetAllDisks_0000
575  * @tc.desc: Test function of GetAllDisks interface for SUCCESS.
576  * @tc.size: MEDIUM
577  * @tc.type: FUNC
578  * @tc.level Level 1
579  * @tc.require: SR000GGUPG
580  */
581 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetAllDisks_0000, testing::ext::TestSize.Level1)
582 {
583     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetAllDisks_0000";
584     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
585     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
586         .Times(1)
587         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
588     std::vector<Disk> vecOfDisk;
589     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
590     int32_t result = proxy_->GetAllDisks(vecOfDisk);
591     EXPECT_EQ(result, E_OK);
592 
593     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
594         .Times(1)
595         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
596     result = proxy_->GetAllDisks(vecOfDisk);
597     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
598     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetAllDisks_0000";
599 }
600 
601 /**
602  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetSystemSize_0000
603  * @tc.name: Storage_manager_proxy_GetSystemSize_0000
604  * @tc.desc: Test function of GetSystemSize interface for SUCCESS.
605  * @tc.size: MEDIUM
606  * @tc.type: FUNC
607  * @tc.level Level 1
608  * @tc.require: SR000H0372
609  */
610 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetSystemSize_0000, testing::ext::TestSize.Level1)
611 {
612     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetSystemSize_0000";
613     int64_t systemSize;
614     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
615     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
616         .Times(1)
617         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
618     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
619     int32_t result = proxy_->GetSystemSize(systemSize);
620     EXPECT_GE(result, E_OK);
621 
622     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
623         .Times(1)
624         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
625     result = proxy_->GetSystemSize(systemSize);
626     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
627     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetSystemSize_0000";
628 }
629 
630 /**
631  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetTotalSize_0000
632  * @tc.name: Storage_manager_proxy_GetTotalSize_0000
633  * @tc.desc: Test function of GetTotalSize interface for SUCCESS.
634  * @tc.size: MEDIUM
635  * @tc.type: FUNC
636  * @tc.level Level 1
637  * @tc.require: SR000H0371
638  */
639 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetTotalSize_0000, testing::ext::TestSize.Level1)
640 {
641     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetTotalSize_0000";
642     int64_t totalSize;
643     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
644     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
645         .Times(1)
646         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
647     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
648     int32_t result = proxy_->GetTotalSize(totalSize);
649     EXPECT_GE(result, E_OK);
650 
651     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
652         .Times(1)
653         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
654     result = proxy_->GetTotalSize(totalSize);
655     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
656     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetTotalSize_0000";
657 }
658 
659 /**
660  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetFreeSize_0000
661  * @tc.name: Storage_manager_proxy_GetFreeSize_0000
662  * @tc.desc: Test function of GetFreeSize interface for SUCCESS.
663  * @tc.size: MEDIUM
664  * @tc.type: FUNC
665  * @tc.level Level 1
666  * @tc.require: SR000H0371
667  */
668 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetFreeSize_0000, testing::ext::TestSize.Level1)
669 {
670     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetFreeSize_0000";
671     int64_t FreeSize;
672     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
673     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
674         .Times(1)
675         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
676     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
677     int32_t result = proxy_->GetFreeSize(FreeSize);
678     EXPECT_GE(result, E_OK);
679 
680     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
681         .Times(1)
682         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
683     result = proxy_->GetFreeSize(FreeSize);
684     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
685     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetFreeSize_0000";
686 }
687 
688 /**
689  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetUserStorageStats_0000
690  * @tc.name: Storage_manager_proxy_GetUserStorageStats_0000
691  * @tc.desc: Test function of GetUserStorageStats interface for SUCCESS.
692  * @tc.size: MEDIUM
693  * @tc.type: FUNC
694  * @tc.level Level 1
695  * @tc.require: SR000H0373
696  */
697 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetUserStorageStats_0000, testing::ext::TestSize.Level1)
698 {
699     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetUserStorageStats_0000";
700     StorageStats storageStats;
701     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
702     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
703         .Times(1)
704         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
705     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
706     int32_t result = proxy_->GetUserStorageStats(storageStats);
707     EXPECT_GE(result, E_OK);
708 
709     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
710         .Times(1)
711         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
712     result = proxy_->GetUserStorageStats(storageStats);
713     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
714     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetUserStorageStats_0000";
715 }
716 
717 /**
718  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetUserStorageStats_0001
719  * @tc.name: Storage_manager_proxy_GetUserStorageStats_0001
720  * @tc.desc: Test function of GetUserStorageStats interface for SUCCESS.
721  * @tc.size: MEDIUM
722  * @tc.type: FUNC
723  * @tc.level Level 1
724  * @tc.require: SR000H0373
725  */
726 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetUserStorageStats_0001, testing::ext::TestSize.Level1)
727 {
728     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetUserStorageStats_0001";
729     StorageStats storageStats;
730     int32_t userId = 111;
731     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
732     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
733         .Times(1)
734         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
735     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
736     int32_t result = proxy_->GetUserStorageStats(userId, storageStats);
737     EXPECT_GE(result, E_OK);
738 
739     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
740         .Times(1)
741         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
742     result = proxy_->GetUserStorageStats(userId, storageStats);
743     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
744     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetUserStorageStats_0001";
745 }
746 
747 /**
748  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetVolumeByUuid_0000
749  * @tc.name: Storage_manager_proxy_GetVolumeByUuid_0000
750  * @tc.desc: Test function of GetVolumeByUuid interface for SUCCESS.
751  * @tc.size: MEDIUM
752  * @tc.type: FUNC
753  * @tc.level Level 1
754  * @tc.require: AR000H09L6
755  */
756 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetVolumeByUuid_0000, testing::ext::TestSize.Level1)
757 {
758     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetVolumeByUuid_0000";
759     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
760     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
761         .Times(1)
762         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
763     std::string fsUuid = "uuid-4";
764     VolumeExternal ve;
765     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
766     int64_t result = proxy_->GetVolumeByUuid(fsUuid, ve);
767     EXPECT_EQ(result, E_OK);
768 
769     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
770         .Times(1)
771         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
772     result = proxy_->GetVolumeByUuid(fsUuid, ve);
773     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
774     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetVolumeByUuid_0000";
775 }
776 
777 /**
778  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetVolumeById_0000
779  * @tc.name: Storage_manager_proxy_GetVolumeById_0000
780  * @tc.desc: Test function of GetVolumeById interface for SUCCESS.
781  * @tc.size: MEDIUM
782  * @tc.type: FUNC
783  * @tc.level Level 1
784  * @tc.require: AR000H09L6
785  */
786 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetVolumeById_0000, testing::ext::TestSize.Level1)
787 {
788     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetVolumeById_0000";
789     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
790     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
791         .Times(1)
792         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
793     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
794 
795     std::string volumeId = "vol-1-27";
796     VolumeExternal ve;
797     int64_t result = proxy_->GetVolumeById(volumeId, ve);
798     EXPECT_EQ(result, E_OK);
799 
800     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
801         .Times(1)
802         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
803     result = proxy_->GetVolumeById(volumeId, ve);
804     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
805     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetVolumeById_0000";
806 }
807 
808 /**
809  * @tc.number: SUB_STORAGE_Storage_manager_proxy_SetVolumeDescription_0000
810  * @tc.name: Storage_manager_proxy_SetVolumeDescription_0000
811  * @tc.desc: Test function of SetVolumeDescription interface for SUCCESS.
812  * @tc.size: MEDIUM
813  * @tc.type: FUNC
814  * @tc.level Level 1
815  * @tc.require: AR000H09L6
816  */
817 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_SetVolumeDescription_0000, testing::ext::TestSize.Level1)
818 {
819     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_SetVolumeDescription_0000";
820     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
821     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
822         .Times(1)
823         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
824     std::string fsUuid = "uuid-6";
825     string description = "description-1";
826     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
827     int64_t result = proxy_->SetVolumeDescription(fsUuid, description);
828     EXPECT_EQ(result, E_OK);
829 
830     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
831         .Times(1)
832         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
833     result = proxy_->SetVolumeDescription(fsUuid, description);
834     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
835     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_SetVolumeDescription_0000";
836 }
837 
838 /**
839  * @tc.number: SUB_STORAGE_Storage_manager_proxy_Format_0000
840  * @tc.name: Storage_manager_proxy_Format_0000
841  * @tc.desc: Test function of Format interface for SUCCESS.
842  * @tc.size: MEDIUM
843  * @tc.type: FUNC
844  * @tc.level Level 1
845  * @tc.require: AR000H09L6
846  */
847 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_Format_0000, testing::ext::TestSize.Level1)
848 {
849     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_Format_0000";
850     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
851     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
852         .Times(1)
853         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
854     std::string volumeId = "vol-1-29";
855     string fsTypes = "1";
856     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
857     int64_t result = proxy_->Format(volumeId, fsTypes);
858     EXPECT_EQ(result, E_OK);
859 
860     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
861         .Times(1)
862         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
863     result = proxy_->Format(volumeId, fsTypes);
864     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
865     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_Format_0000";
866 }
867 
868 /**
869  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetDiskById_0000
870  * @tc.name: Storage_manager_proxy_GetDiskById_0000
871  * @tc.desc: Test function of GetDiskById interface for SUCCESS.
872  * @tc.size: MEDIUM
873  * @tc.type: FUNC
874  * @tc.level Level 1
875  * @tc.require: AR000H09L6
876  */
877 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetDiskById_0000, testing::ext::TestSize.Level1)
878 {
879     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetDiskById_0000";
880     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
881     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
882         .Times(1)
883         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
884     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
885 
886     std::string diskId = "disk-1-30";
887     int64_t sizeBytes = 1024;
888     std::string sysPath = "/";
889     std::string vendor = "vendor-1";
890     int32_t flag = 1; // disk type
891     Disk disk(diskId, sizeBytes, sysPath, vendor, flag);
892     int64_t result = proxy_->GetDiskById(diskId, disk);
893     EXPECT_EQ(result, E_OK);
894 
895     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
896         .Times(1)
897         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
898     result = proxy_->GetDiskById(diskId, disk);
899     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
900     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetDiskById_0000";
901 }
902 
903 /**
904  * @tc.number: SUB_STORAGE_Storage_manager_proxy_CreateShareFile_0000
905  * @tc.name: Storage_manager_proxy_CreateShareFile_0000
906  * @tc.desc: Test function of CreateShareFile interface for SUCCESS.
907  * @tc.size: MEDIUM
908  * @tc.type: FUNC
909  * @tc.level Level 1
910  * @tc.require: issueI7U9Z9
911  */
912 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_CreateShareFile_0000, testing::ext::TestSize.Level1)
913 {
914     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_CreateShareFile_0000";
915     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
916     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
917         .Times(1)
918         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
919     std::string uri = "file://com.demo.a/storage/share/files/test.txt";
920     uint32_t tokenId = 100;
921     uint32_t flag = 0;
922     vector<string> uriList(1, uri);
923     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
924     vector<int32_t> retList = proxy_->CreateShareFile(uriList, tokenId, flag);
925     for (const auto &ret : retList) {
926         EXPECT_EQ(ret, E_OK);
927     }
928     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_CreateShareFile_0000";
929 }
930 
931 /**
932  * @tc.number: SUB_STORAGE_Storage_manager_proxy_CreateShareFile_0100
933  * @tc.name: Storage_manager_proxy_CreateShareFile_0100
934  * @tc.desc: Test function of CreateShareFile interface for SendRequest failed.
935  * @tc.size: MEDIUM
936  * @tc.type: FUNC
937  * @tc.level Level 1
938  * @tc.require: issueI7U9Z9
939  */
940 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_CreateShareFile_0100, testing::ext::TestSize.Level1)
941 {
942     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_CreateShareFile_0100";
943     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
944     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
945         .Times(1)
946         .WillOnce(testing::Return(E_WRITE_DESCRIPTOR_ERR));
947     std::string uri = "file://com.demo.a/storage/share/files/test.txt";
948     uint32_t tokenId = 100;
949     uint32_t flag = 0;
950     vector<string> uriList(1, uri);
951     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
952     vector<int32_t> retList = proxy_->CreateShareFile(uriList, tokenId, flag);
953     for (const auto &ret : retList) {
954         EXPECT_EQ(ret, E_WRITE_DESCRIPTOR_ERR);
955     }
956     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_CreateShareFile_0100";
957 }
958 
959 /**
960  * @tc.number: SUB_STORAGE_Storage_manager_proxy_DeleteShareFile_0000
961  * @tc.name: Storage_manager_proxy_DeleteShareFile_0000
962  * @tc.desc: Test function of DeleteShareFile interface for SUCCESS.
963  * @tc.size: MEDIUM
964  * @tc.type: FUNC
965  * @tc.level Level 1
966  * @tc.require: issueI7U9Z9
967  */
968 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_DeleteShareFile_0000, testing::ext::TestSize.Level1)
969 {
970     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_DeleteShareFile_0000";
971     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
972     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
973         .Times(1)
974         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
975     std::string uri = "file://com.demo.a/storage/share/files/test.txt";
976     uint32_t tokenId = 100;
977     std::vector<std::string> sharePathList;
978     sharePathList.push_back(uri);
979     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
980     int64_t result = proxy_->DeleteShareFile(tokenId, sharePathList);
981     EXPECT_EQ(result, E_OK);
982 
983     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
984         .Times(1)
985         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
986     result = proxy_->DeleteShareFile(tokenId, sharePathList);
987     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
988     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_DeleteShareFile_0000";
989 }
990 
991 /**
992  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GenerateUserKeys_0000
993  * @tc.name: Storage_manager_proxy_GenerateUserKeys_0000
994  * @tc.desc: Test function of GenerateUserKeys interface for SUCCESS.
995  * @tc.size: MEDIUM
996  * @tc.type: FUNC
997  * @tc.level Level 1
998  * @tc.require: AR000H0F7I
999  */
1000 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GenerateUserKeys_0000, testing::ext::TestSize.Level1)
1001 {
1002     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GenerateUserKeys_0000";
1003     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1004     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1005         .Times(1)
1006         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1007     uint32_t userId = 112;
1008     uint32_t flags = 2; // UserKeys type
1009     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1010     uint32_t result = proxy_->GenerateUserKeys(userId, flags);
1011     EXPECT_EQ(result, E_OK);
1012 
1013     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1014         .Times(1)
1015         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1016     result = proxy_->GenerateUserKeys(userId, flags);
1017     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1018     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GenerateUserKeys_0000";
1019 }
1020 
1021 /**
1022  * @tc.number: SUB_STORAGE_Storage_manager_proxy_DeleteUserKeys_0000
1023  * @tc.name: Storage_manager_proxy_DeleteUserKeys_0000
1024  * @tc.desc: Test function of DeleteUserKeys interface for SUCCESS.
1025  * @tc.size: MEDIUM
1026  * @tc.type: FUNC
1027  * @tc.level Level 1
1028  * @tc.require: AR000H0F7I
1029  */
1030 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_DeleteUserKeys_0000, testing::ext::TestSize.Level1)
1031 {
1032     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_DeleteUserKeys_0000";
1033     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1034     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1035         .Times(1)
1036         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1037     uint32_t userId = 113;
1038     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1039     uint32_t result = proxy_->DeleteUserKeys(userId);
1040     EXPECT_EQ(result, E_OK);
1041 
1042     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1043         .Times(1)
1044         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1045     result = proxy_->DeleteUserKeys(userId);
1046     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1047     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_DeleteUserKeys_0000";
1048 }
1049 
1050 /**
1051  * @tc.number: SUB_STORAGE_Storage_manager_proxy_UpdateUserAuth_0000
1052  * @tc.name: Storage_manager_proxy_UpdateUserAuth_0000
1053  * @tc.desc: Test function of UpdateUserAuth interface for SUCCESS.
1054  * @tc.size: MEDIUM
1055  * @tc.type: FUNC
1056  * @tc.level Level 1
1057  * @tc.require: AR000H0FG3
1058  */
1059 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_UpdateUserAuth_0000, testing::ext::TestSize.Level1)
1060 {
1061     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UpdateUserAuth_0000";
1062     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1063     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1064         .Times(1)
1065         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1066     uint32_t userId = 114;
1067     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1068     uint32_t result = proxy_->UpdateUserAuth(userId, 0, {}, {}, {});
1069     EXPECT_EQ(result, E_OK);
1070 
1071     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1072         .Times(1)
1073         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1074     result = proxy_->UpdateUserAuth(userId, 0, {}, {}, {});
1075     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1076     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UpdateUserAuth_0000";
1077 }
1078 
1079 /**
1080  * @tc.number: SUB_STORAGE_Storage_manager_proxy_ActiveUserKey_0000
1081  * @tc.name: Storage_manager_proxy_ActiveUserKey_0000
1082  * @tc.desc: Test function of ActiveUserKey interface for SUCCESS.
1083  * @tc.size: MEDIUM
1084  * @tc.type: FUNC
1085  * @tc.level Level 1
1086  * @tc.require: AR000H0FG3
1087  */
1088 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_ActiveUserKey_0000, testing::ext::TestSize.Level1)
1089 {
1090     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_ActiveUserKey_0000";
1091     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1092     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1093         .Times(1)
1094         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1095     uint32_t userId = 115;
1096     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1097     uint32_t result = proxy_->ActiveUserKey(userId, {}, {});
1098     EXPECT_EQ(result, E_OK);
1099 
1100     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1101         .Times(1)
1102         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1103     result = proxy_->ActiveUserKey(userId, {}, {});
1104     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1105     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_ActiveUserKey_0000";
1106 }
1107 
1108 /**
1109  * @tc.number: SUB_STORAGE_Storage_manager_proxy_InactiveUserKey_0000
1110  * @tc.name: Storage_manager_proxy_InactiveUserKey_0000
1111  * @tc.desc: Test function of InactiveUserKey interface for SUCCESS.
1112  * @tc.size: MEDIUM
1113  * @tc.type: FUNC
1114  * @tc.level Level 1
1115  * @tc.require: AR000H0F7I
1116  */
1117 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_InactiveUserKey_0000, testing::ext::TestSize.Level1)
1118 {
1119     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_InactiveUserKey_0000";
1120     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1121     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1122         .Times(1)
1123         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1124     uint32_t userId = 116;
1125     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1126     uint32_t result = proxy_->InactiveUserKey(userId);
1127     EXPECT_EQ(result, E_OK);
1128 
1129     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1130         .Times(1)
1131         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1132     result = proxy_->InactiveUserKey(userId);
1133     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1134     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_InactiveUserKey_0000";
1135 }
1136 
1137 /**
1138  * @tc.number: SUB_STORAGE_Storage_manager_proxy_LockUserScreen_0000
1139  * @tc.name: Storage_manager_proxy_LockUserScreen_0000
1140  * @tc.desc: Test function of LockUserScreen interface for SUCCESS.
1141  * @tc.size: MEDIUM
1142  * @tc.type: FUNC
1143  * @tc.level Level 1
1144  * @tc.require: AR000H0F7I
1145  */
1146 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_LockUserScreen_0000, testing::ext::TestSize.Level1)
1147 {
1148     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_LockUserScreen_0000";
1149     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1150     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1151         .Times(1)
1152         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1153     uint32_t userId = 116;
1154     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1155     uint32_t result = proxy_->LockUserScreen(userId);
1156     EXPECT_EQ(result, E_OK);
1157 
1158     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1159         .Times(1)
1160         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1161     result = proxy_->LockUserScreen(userId);
1162     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1163     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_LockUserScreen_0000";
1164 }
1165 
1166 /**
1167  * @tc.number: SUB_STORAGE_Storage_manager_proxy_UnlockUserScreen_0000
1168  * @tc.name: Storage_manager_proxy_UnlockUserScreen_0000
1169  * @tc.desc: Test function of UnlockUserScreen interface for SUCCESS.
1170  * @tc.size: MEDIUM
1171  * @tc.type: FUNC
1172  * @tc.level Level 1
1173  * @tc.require: AR000H0F7I
1174  */
1175 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_UnlockUserScreen_0000, testing::ext::TestSize.Level1)
1176 {
1177     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UnlockUserScreen_0000";
1178     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1179     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1180         .Times(1)
1181         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1182     uint32_t userId = 120;
1183     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1184     uint32_t result = proxy_->UnlockUserScreen(userId, {}, {});
1185     EXPECT_EQ(result, E_OK);
1186 
1187     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1188         .Times(1)
1189         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1190     result = proxy_->UnlockUserScreen(userId, {}, {});
1191     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1192     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UnlockUserScreen_0000";
1193 }
1194 
1195 /**
1196  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GenerateAppkey_0000
1197  * @tc.name: Storage_manager_proxy_GenerateAppkey_0000
1198  * @tc.desc: Test function of UnlockUserScreen interface for SUCCESS.
1199  * @tc.size: MEDIUM
1200  * @tc.type: FUNC
1201  * @tc.level Level 1
1202  * @tc.require: AR000H0F7I
1203  */
1204 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GenerateAppkey_0000, testing::ext::TestSize.Level1)
1205 {
1206     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GenerateAppkey_0000";
1207     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1208     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1209         .Times(1)
1210         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1211 
1212     uint32_t hashId = 0;
1213     uint32_t userId = 0;
1214     std::string keyId;
1215     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1216     uint32_t result = proxy_->GenerateAppkey(hashId, userId, keyId);
1217     EXPECT_EQ(result, E_OK);
1218 
1219     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1220         .Times(1)
1221         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1222     result = proxy_->GenerateAppkey(hashId, userId, keyId);
1223     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1224     GTEST_LOG_(INFO) << "Storage_manager_proxy_GenerateAppkey_0000 end";
1225 }
1226 
1227 /**
1228  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetLockScreenStatus_0000
1229  * @tc.name: Storage_manager_proxy_GetLockScreenStatus_0000
1230  * @tc.desc: Test function of GetLockScreenStatus interface for SUCCESS.
1231  * @tc.size: MEDIUM
1232  * @tc.type: FUNC
1233  * @tc.level Level 1
1234  * @tc.require: I9TCA3
1235  */
1236 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetLockScreenStatus_0000, testing::ext::TestSize.Level1)
1237 {
1238     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetLockScreenStatus_0000";
1239     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1240     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1241         .Times(1)
1242         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1243     uint32_t userId = 120;
1244     bool lockStatus;
1245     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1246     uint32_t result = proxy_->GetLockScreenStatus(userId, lockStatus);
1247     EXPECT_EQ(result, E_OK);
1248 
1249     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1250         .Times(1)
1251         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1252     result = proxy_->GetLockScreenStatus(userId, lockStatus);
1253     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1254     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetLockScreenStatus_0000";
1255 }
1256 
1257 /**
1258  * @tc.number: SUB_STORAGE_Storage_manager_proxy_DeleteAppkey_0000
1259  * @tc.name: Storage_manager_proxy_DeleteAppkey_0000
1260  * @tc.desc: Test function of UnlockUserScreen interface for SUCCESS.
1261  * @tc.size: MEDIUM
1262  * @tc.type: FUNC
1263  * @tc.level Level 1
1264  * @tc.require: AR000H0F7I
1265  */
1266 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_DeleteAppkey_0000, testing::ext::TestSize.Level1)
1267 {
1268     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_DeleteAppkey_0000";
1269     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1270     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1271         .Times(1)
1272         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1273     const std::string keyId;
1274     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1275     uint32_t result = proxy_->DeleteAppkey(keyId);
1276     EXPECT_EQ(result, E_OK);
1277 
1278     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1279         .Times(1)
1280         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1281     result = proxy_->DeleteAppkey(keyId);
1282     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1283     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_DeleteAppkey_0000";
1284 }
1285 
1286 /**
1287  * @tc.number: SUB_STORAGE_Storage_manager_proxy_CreateRecoverKey_0000
1288  * @tc.name: Storage_manager_proxy_CreateRecoverKey_0000
1289  * @tc.desc: Test function of CreateRecoverKey interface for SUCCESS.
1290  * @tc.size: MEDIUM
1291  * @tc.type: FUNC
1292  * @tc.level Level 1
1293  * @tc.require: AR000H0F7I
1294  */
1295 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_CreateRecoverKey_0000, testing::ext::TestSize.Level1)
1296 {
1297     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_CreateRecoverKey_0000";
1298     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1299         .Times(1)
1300         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1301     uint32_t userId = 120;
1302     uint32_t userType = 12;
1303     uint32_t result = proxy_->CreateRecoverKey(userId, userType, {}, {});
1304     EXPECT_EQ(result, E_OK);
1305 
1306     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1307         .Times(1)
1308         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1309     result = proxy_->CreateRecoverKey(userId, userType, {}, {});
1310     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1311     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_CreateRecoverKey_0000";
1312 }
1313 
1314 /**
1315  * @tc.number: SUB_STORAGE_Storage_manager_proxy_SetRecoverKey_0000
1316  * @tc.name: Storage_manager_proxy_SetRecoverKey_0000
1317  * @tc.desc: Test function of SetRecoverKey interface for SUCCESS.
1318  * @tc.size: MEDIUM
1319  * @tc.type: FUNC
1320  * @tc.level Level 1
1321  * @tc.require: AR000H0F7I
1322  */
1323 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_SetRecoverKey_0000, testing::ext::TestSize.Level1)
1324 {
1325     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_SetRecoverKey_0000";
1326     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1327         .Times(1)
1328         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1329     uint32_t result = proxy_->SetRecoverKey({});
1330     EXPECT_EQ(result, E_OK);
1331 
1332     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1333         .Times(1)
1334         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1335     result = proxy_->SetRecoverKey({});
1336     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1337     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_SetRecoverKey_0000";
1338 }
1339 
1340 /**
1341  * @tc.number: SUB_STORAGE_Storage_manager_proxy_MountDfsDocs_0000
1342  * @tc.name: Storage_manager_proxy_MountDfsDocs_0000
1343  * @tc.desc: Test function of MountDfsDocs interface for SUCCESS.
1344  * @tc.size: MEDIUM
1345  * @tc.type: FUNC
1346  * @tc.level Level 1
1347  * @tc.require: issueI9G5A0
1348  */
1349 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_MountDfsDocs_0000, testing::ext::TestSize.Level1)
1350 {
1351     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_MountDfsDocs_0000";
1352     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1353     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1354         .Times(1)
1355         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1356     uint32_t userId = 120;
1357     std::string relativePath = "account";
1358     std::string networkId = "testnetworkid";
1359     std::string deviceId = "testdevid";
1360     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1361     uint32_t result = proxy_->MountDfsDocs(userId, relativePath, networkId, deviceId);
1362     EXPECT_EQ(result, E_OK);
1363 
1364     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1365         .Times(1)
1366         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1367     result = proxy_->MountDfsDocs(userId, relativePath, networkId, deviceId);
1368     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1369     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_MountDfsDocs_0000";
1370 }
1371 
1372 /**
1373  * @tc.number: SUB_STORAGE_Storage_manager_proxy_UMountDfsDocs_0000
1374  * @tc.name: Storage_manager_proxy_UMountDfsDocs_0000
1375  * @tc.desc: Test function of UMountDfsDocs interface for SUCCESS.
1376  * @tc.size: MEDIUM
1377  * @tc.type: FUNC
1378  * @tc.level Level 1
1379  * @tc.require: issueI9G5A0
1380  */
1381 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_UMountDfsDocs_0000, testing::ext::TestSize.Level1)
1382 {
1383     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UMountDfsDocs_0000";
1384     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1385     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1386         .Times(1)
1387         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1388     uint32_t userId = 120;
1389     std::string relativePath = "account";
1390     std::string networkId = "testnetworkid";
1391     std::string deviceId = "testdevid";
1392     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1393     uint32_t result = proxy_->UMountDfsDocs(userId, relativePath, networkId, deviceId);
1394     EXPECT_EQ(result, E_OK);
1395 
1396     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1397         .Times(1)
1398         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1399     result = proxy_->UMountDfsDocs(userId, relativePath, networkId, deviceId);
1400     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1401     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UMountDfsDocs_0000";
1402 }
1403 
1404 /**
1405  * @tc.number: SUB_STORAGE_Storage_manager_proxy_UpdateKeyContext_0000
1406  * @tc.name: Storage_manager_proxy_UpdateKeyContext_0000
1407  * @tc.desc: Test function of UpdateKeyContext interface for SUCCESS.
1408  * @tc.size: MEDIUM
1409  * @tc.type: FUNC
1410  * @tc.level Level 1
1411  * @tc.require: AR000H0F7I
1412  */
1413 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_UpdateKeyContext_0000, testing::ext::TestSize.Level1)
1414 {
1415     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UpdateKeyContext_0000";
1416     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1417     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1418         .Times(1)
1419         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1420     uint32_t userId = 117;
1421     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1422     uint32_t result = proxy_->UpdateKeyContext(userId);
1423     EXPECT_EQ(result, E_OK);
1424 
1425     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1426         .Times(1)
1427         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1428     result = proxy_->UpdateKeyContext(userId);
1429     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1430     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UpdateKeyContext_0000";
1431 }
1432 
1433 /**
1434  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetCurrentBundleStats_0000
1435  * @tc.name: Storage_manager_proxy_GetCurrentBundleStats_0000
1436  * @tc.desc: Test function of GetCurrentBundleStats interface for SUCCESS.
1437  * @tc.size: MEDIUM
1438  * @tc.type: FUNC
1439  * @tc.level Level 1
1440  * @tc.require: AR000H0F7I
1441  */
1442 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetCurrentBundleStats_0000, testing::ext::TestSize.Level1)
1443 {
1444     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetCurrentBundleStats_0000";
1445     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1446     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1447         .Times(1)
1448         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1449     BundleStats bundleStats;
1450     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1451     int32_t result = proxy_->GetCurrentBundleStats(bundleStats, 0);
1452     EXPECT_EQ(result, E_OK);
1453 
1454     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1455         .Times(1)
1456         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1457     result = proxy_->GetCurrentBundleStats(bundleStats, 0);
1458     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1459     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetCurrentBundleStats_0000";
1460 }
1461 
1462 /**
1463  * @tc.number: SUB_STORAGE_Storage_manager_proxy_SetBundleQuota_0000
1464  * @tc.name: Storage_manager_proxy_SetBundleQuota_0000
1465  * @tc.desc: Test function of SetBundleQuota interface for SUCCESS.
1466  * @tc.size: MEDIUM
1467  * @tc.type: FUNC
1468  * @tc.level Level 1
1469  * @tc.require: AR000HSKSO
1470  */
1471 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_SetBundleQuota_0000, testing::ext::TestSize.Level1)
1472 {
1473     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_SetBundleQuota_0000";
1474     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1475     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1476         .Times(1)
1477         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1478     std::string bundleName = "com.ohos.bundleName-0-1";
1479     std::string bundleDataDirPath = "/data/app/el2/100/base/" + bundleName;
1480     int32_t uid = 20000000;
1481     int32_t limitSizeMb = 1000;
1482     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1483     int32_t result = proxy_->SetBundleQuota(bundleName, uid, bundleDataDirPath, limitSizeMb);
1484     EXPECT_EQ(result, E_OK);
1485 
1486     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1487         .Times(1)
1488         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1489     result = proxy_->SetBundleQuota(bundleName, uid, bundleDataDirPath, limitSizeMb);
1490     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1491     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_SetBundleQuota_0000";
1492 }
1493 
1494 /**
1495  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetUserStorageStatsByType_0000
1496  * @tc.name: Storage_manager_proxy_GetUserStorageStatsByType_0000
1497  * @tc.desc: Test function of GetUserStorageStatsByType interface for SUCCESS.
1498  * @tc.size: MEDIUM
1499  * @tc.type: FUNC
1500  * @tc.level Level 1
1501  */
1502 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetUserStorageStatsByType_0000, testing::ext::TestSize.Level1)
1503 {
1504     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetUserStorageStatsByType_0000";
1505     StorageStats storageStats;
1506     int32_t userId = 111;
1507     std::string type = "media";
1508     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1509     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1510         .Times(1)
1511         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1512     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1513     int32_t result = proxy_->GetUserStorageStatsByType(userId, storageStats, type);
1514     EXPECT_GE(result, E_OK);
1515 
1516     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1517         .Times(1)
1518         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1519     result = proxy_->GetUserStorageStatsByType(userId, storageStats, type);
1520     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1521     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetUserStorageStatsByType_0000";
1522 }
1523 
1524 /**
1525  * @tc.number: SUB_STORAGE_Storage_manager_proxy_UpdateMemoryPara_0000
1526  * @tc.name: Storage_manager_proxy_UpdateMemoryPara_0000
1527  * @tc.desc: Test function of UpdateMemoryPara interface for SUCCESS.
1528  * @tc.size: MEDIUM
1529  * @tc.type: FUNC
1530  * @tc.level Level 1
1531  * @tc.require: I90X2X
1532  */
1533 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_UpdateMemoryPara_0000, testing::ext::TestSize.Level1)
1534 {
1535     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UpdateMemoryPara_0000";
1536     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1537     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1538         .Times(1)
1539         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1540     int32_t size = 1000;
1541     int32_t oldSize =500;
1542     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1543     int32_t result = proxy_->UpdateMemoryPara(size, oldSize);
1544     EXPECT_EQ(result, E_OK);
1545 
1546     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1547         .Times(1)
1548         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1549     result = proxy_->UpdateMemoryPara(size, oldSize);
1550     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1551     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UpdateMemoryPara_0000";
1552 }
1553 
1554 /**
1555  * @tc.number: SUB_Storage_manager_proxy_GetBundleStatsForIncrease_0000
1556  * @tc.name: Storage_manager_proxy_GetBundleStatsForIncrease_0000
1557  * @tc.desc: Test function of GetBundleStatsForIncrease interface for FAILED.
1558  * @tc.size: MEDIUM
1559  * @tc.type: FUNC
1560  * @tc.level Level 1
1561  */
1562 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetBundleStatsForIncrease_0000, testing::ext::TestSize.Level1)
1563 {
1564     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetBundleStatsForIncrease_0000";
1565     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1566     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1567         .Times(1)
1568         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1569     uint32_t userId = 100;
1570     std::vector<std::string> bundleNames;
1571     std::vector<int64_t> incrementalBackTimes;
1572     std::vector<int64_t> pkgFileSizes;
1573     std::vector<int64_t> incPkgFileSizes;
1574     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1575     int32_t result = proxy_->GetBundleStatsForIncrease(userId, bundleNames, incrementalBackTimes, pkgFileSizes,
1576         incPkgFileSizes);
1577     EXPECT_EQ(result, E_OK);
1578 
1579     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1580         .Times(1)
1581         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1582     result = proxy_->GetBundleStatsForIncrease(userId, bundleNames, incrementalBackTimes, pkgFileSizes,
1583         incPkgFileSizes);
1584     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1585     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetBundleStatsForIncrease_0000";
1586 }
1587 
1588 /**
1589  * @tc.number: Storage_manager_proxy_GetFileEncryptStatus_0000
1590  * @tc.name: Storage_manager_proxy_GetFileEncryptStatus_0000
1591  * @tc.desc: Test function of GetFileEncryptStatus interface for FAILED.
1592  * @tc.size: MEDIUM
1593  * @tc.type: FUNC
1594  * @tc.level Level 1
1595  */
1596 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetFileEncryptStatus_0000, testing::ext::TestSize.Level1)
1597 {
1598     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetFileEncryptStatus_0000";
1599     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1600     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1601         .Times(1)
1602         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1603     uint32_t userId = 800;
1604     bool isEncrypted;
1605     int32_t result = proxy_->GetFileEncryptStatus(userId, isEncrypted);
1606     EXPECT_EQ(result, E_OK);
1607 
1608     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1609         .Times(1)
1610         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1611     result = proxy_->GetFileEncryptStatus(userId, isEncrypted);
1612     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1613     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetFileEncryptStatus_0000";
1614 }
1615 
1616 /**
1617  * @tc.number: Storage_manager_proxy_UpdateUseAuthWithRecoveryKey_0000
1618  * @tc.name: Storage_manager_proxy_UpdateUseAuthWithRecoveryKey_0000
1619  * @tc.desc: Test function of UpdateUseAuthWithRecoveryKey interface for FAILED.
1620  * @tc.size: MEDIUM
1621  * @tc.type: FUNC
1622  * @tc.level Level 1
1623  */
1624 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_UpdateUseAuthWithRecoveryKey_0000,
1625     testing::ext::TestSize.Level1)
1626 {
1627     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UpdateUseAuthWithRecoveryKey_0000";
1628     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1629     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1630         .Times(1)
1631         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1632     std::vector<uint8_t> authToken;
1633     std::vector<uint8_t> newSecret;
1634     uint64_t secureUid = 0;
1635     uint32_t userId = 800;
1636     std::vector<std::vector<uint8_t>> plainText;
1637     int32_t result = proxy_->UpdateUseAuthWithRecoveryKey(authToken, newSecret, secureUid, userId, plainText);
1638     EXPECT_EQ(result, E_OK);
1639 
1640     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1641         .Times(1)
1642         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1643     result = proxy_->UpdateUseAuthWithRecoveryKey(authToken, newSecret, secureUid, userId, plainText);
1644     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1645     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UpdateUseAuthWithRecoveryKey_0000";
1646 }
1647 
1648 /**
1649  * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyMtpMounted_0000
1650  * @tc.name: Storage_manager_proxy_NotifyMtpMounted_0000
1651  * @tc.desc: Test function of NotifyMtpMounted interface for SUCCESS.
1652  * @tc.size: MEDIUM
1653  * @tc.type: FUNC
1654  * @tc.level Level 1
1655  */
1656 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyMtpMounted_0000, testing::ext::TestSize.Level1)
1657 {
1658     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyMtpMounted_0000";
1659     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1660     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1661         .Times(1)
1662         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1663     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1664 
1665     std::string id = "vol-1-18";
1666     std::string path = "/";
1667     std::string description = "description-1";
1668     std::string uuid = "uuid-1";
1669     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1670     int64_t result = proxy_->NotifyMtpMounted(id, path, description, uuid);
1671     EXPECT_EQ(result, E_OK);
1672 
1673     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1674         .Times(1)
1675         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1676     result = proxy_->NotifyMtpMounted(id, path, description, uuid);
1677     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1678     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyMtpMounted_0000";
1679 }
1680 
1681 /**
1682  * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyMtpUnmounted_0000
1683  * @tc.name: Storage_manager_proxy_NotifyMtpUnmounted_0000
1684  * @tc.desc: Test function of NotifyMtpUnmounted interface for SUCCESS.
1685  * @tc.size: MEDIUM
1686  * @tc.type: FUNC
1687  * @tc.level Level 1
1688  */
1689 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyMtpUnmounted_0000, testing::ext::TestSize.Level1)
1690 {
1691     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyMtpUnmounted_0000";
1692     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1693     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1694         .Times(1)
1695         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1696 
1697     std::string id = "vol-1-18";
1698     std::string path = "/";
1699     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1700     int64_t result = proxy_->NotifyMtpUnmounted(id, path, false);
1701     EXPECT_EQ(result, E_OK);
1702 
1703     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1704         .Times(1)
1705         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1706     result = proxy_->NotifyMtpUnmounted(id, path, false);
1707     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1708     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyMtpUnmounted_0000";
1709 }
1710 
1711 /**
1712  * @tc.number: SUB_STORAGE_Storage_manager_proxy_MountMediaFuse_0000
1713  * @tc.name: Storage_manager_proxy_MountMediaFuse_0000
1714  * @tc.desc: Test function of MountMediaFuse interface for SUCCESS.
1715  * @tc.size: MEDIUM
1716  * @tc.type: FUNC
1717  * @tc.level Level 1
1718  */
1719 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_MountMediaFuse_0000, testing::ext::TestSize.Level1)
1720 {
1721     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_MountMediaFuse_0000";
1722     #ifdef STORAGE_SERVICE_MEDIA_FUSE
1723     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1724     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1725         .Times(1)
1726         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1727     #endif
1728     int32_t userId = 130;
1729     int32_t devFd = 140;
1730     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1731     int32_t result = proxy_->MountMediaFuse(userId, devFd);
1732     EXPECT_EQ(result, E_OK);
1733 
1734     #ifdef STORAGE_SERVICE_MEDIA_FUSE
1735     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1736         .Times(1)
1737         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1738     result = proxy_->MountMediaFuse(userId, devFd);
1739     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1740     #endif
1741     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_MountMediaFuse_0000";
1742 }
1743 
1744 /**
1745  * @tc.number: SUB_STORAGE_Storage_manager_proxy_UMountMediaFuse_0000
1746  * @tc.name: Storage_manager_proxy_UMountMediaFuse_0000
1747  * @tc.desc: Test function of UMountMediaFuse interface for SUCCESS.
1748  * @tc.size: MEDIUM
1749  * @tc.type: FUNC
1750  * @tc.level Level 1
1751  */
1752 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_UMountMediaFuse_0000, testing::ext::TestSize.Level1)
1753 {
1754     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UMountMediaFuse_0000";
1755     #ifdef STORAGE_SERVICE_MEDIA_FUSE
1756     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1757     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1758         .Times(1)
1759         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1760     #endif
1761     int32_t userId = 130;
1762     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1763     int32_t result = proxy_->UMountMediaFuse(userId);
1764     EXPECT_EQ(result, E_OK);
1765 
1766     #ifdef STORAGE_SERVICE_MEDIA_FUSE
1767     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1768         .Times(1)
1769         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1770     result = proxy_->UMountMediaFuse(userId);
1771     EXPET_EQ(result, E_WRITE_PARCEL_ERR);
1772     #endif
1773     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UMountMediaFuse_0000";
1774 }
1775 
1776 /**
1777  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetUserNeedActiveStatus_0000
1778  * @tc.name: Storage_manager_proxy_GetUserNeedActiveStatus_0000
1779  * @tc.desc: Test function of GetUserNeedActiveStatus interface for SUCCESS.
1780  * @tc.size: MEDIUM
1781  * @tc.type: FUNC
1782  * @tc.level Level 1
1783  */
1784 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetUserNeedActiveStatus_0000, testing::ext::TestSize.Level1)
1785 {
1786     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetUserNeedActiveStatus_0000";
1787     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1788     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1789         .Times(1)
1790         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1791     uint32_t userId = 120;
1792     bool needActive = false;
1793     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1794     uint32_t result = proxy_->GetUserNeedActiveStatus(userId, needActive);
1795     EXPECT_EQ(result, E_OK);
1796 
1797     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1798         .Times(1)
1799         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1800     result = proxy_->GetUserNeedActiveStatus(userId, needActive);
1801     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1802     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetUserNeedActiveStatus_0000";
1803 }
1804 
1805 /**
1806  * @tc.number: SUB_STORAGE_Storage_manager_proxy_MountFileMgrFuse_0000
1807  * @tc.name: Storage_manager_proxy_MountFileMgrFuse_0000
1808  * @tc.desc: Test function of MountFileMgrFuse interface for SUCCESS.
1809  * @tc.size: MEDIUM
1810  * @tc.type: FUNC
1811  * @tc.level Level 1
1812  */
1813 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_MountFileMgrFuse_0000, testing::ext::TestSize.Level1)
1814 {
1815     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_MountFileMgrFuse_0000";
1816     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1817     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1818         .Times(1)
1819         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1820     int32_t userId = 100;
1821     std::string path = "/mnt/data/100/smb/testStorageManagerProxy";
1822     int32_t fuseFd = -1;
1823     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1824     int32_t result = proxy_->MountFileMgrFuse(userId, path, fuseFd);
1825     EXPECT_EQ(result, E_OK);
1826 
1827     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1828         .Times(1)
1829         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1830     result = proxy_->MountFileMgrFuse(userId, path, fuseFd);
1831     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1832     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_MountFileMgrFuse_0000";
1833 }
1834 
1835 /**
1836  * @tc.number: SUB_STORAGE_Storage_manager_proxy_UMountFileMgrFuse_0000
1837  * @tc.name: Storage_manager_proxy_UMountFileMgrFuse_0000
1838  * @tc.desc: Test function of UMountFileMgrFuse interface for SUCCESS.
1839  * @tc.size: MEDIUM
1840  * @tc.type: FUNC
1841  * @tc.level Level 1
1842  */
1843 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_UMountFileMgrFuse_0000, testing::ext::TestSize.Level1)
1844 {
1845     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UMountFileMgrFuse_0000";
1846     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1847     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1848         .Times(1)
1849         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1850     int32_t userId = 100;
1851     std::string path = "/mnt/data/100/smb/testStorageManagerProxy";
1852     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1853     int32_t result = proxy_->UMountFileMgrFuse(userId, path);
1854     EXPECT_EQ(result, E_OK);
1855 
1856     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1857         .Times(1)
1858         .WillOnce(testing::Return(E_WRITE_PARCEL_ERR));
1859     result = proxy_->UMountFileMgrFuse(userId, path);
1860     EXPECT_EQ(result, E_WRITE_PARCEL_ERR);
1861     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UMountFileMgrFuse_0000";
1862 }
1863 } // namespace
1864