• 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     int32_t userId = 101;
60     uint32_t flag = CRYPTO_FLAG_EL1;
61     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
62     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_PrepareAddUser_0000 fail to get GetSystemAbilityManager";
63     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
64     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
65     auto proxy = iface_cast<IStorageManager>(remote);
66     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
67     int32_t result = proxy->PrepareAddUser(userId, flag);
68     EXPECT_EQ(result, E_PERMISSION_DENIED);
69     proxy->RemoveUser(userId, flag);
70     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_PrepareAddUser_0000";
71 }
72 
73 /**
74  * @tc.number: SUB_STORAGE_Storage_manager_proxy_PrepareAddUser_0001
75  * @tc.name: Storage_manager_proxy_PrepareAddUser_0001
76  * @tc.desc: Test function of PrepareAddUser interface for Parameters ERROR which userId<0.
77  * @tc.size: MEDIUM
78  * @tc.type: FUNC
79  * @tc.level Level 1
80  * @tc.require: AR000GK4HB
81  */
82 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_PrepareAddUser_0001, testing::ext::TestSize.Level1)
83 {
84     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_PrepareAddUser_0001";
85     int32_t userId = -1;
86     uint32_t flag = CRYPTO_FLAG_EL1;
87     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
88     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_PrepareAddUser_0001 fail to get GetSystemAbilityManager";
89     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
90     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
91     auto proxy = iface_cast<IStorageManager>(remote);
92     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
93     int32_t result = proxy->PrepareAddUser(userId, flag);
94     EXPECT_NE(result, E_OK);
95     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_PrepareAddUser_0001";
96 }
97 
98 /**
99  * @tc.number: SUB_STORAGE_Storage_manager_proxy_PrepareAddUser_0002
100  * @tc.name: Storage_manager_proxy_PrepareAddUser_0002
101  * @tc.desc: Test function of PrepareAddUser interface for Parameters ERROR which userId not in [101, 1099].
102  * @tc.size: MEDIUM
103  * @tc.type: FUNC
104  * @tc.level Level 1
105  * @tc.require: AR000GK4HB
106  */
107 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_PrepareAddUser_0002, testing::ext::TestSize.Level1)
108 {
109     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_PrepareAddUser_0002";
110     int32_t userId = 10000;
111     uint32_t flag = CRYPTO_FLAG_EL1;
112     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
113     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_PrepareAddUser_0002 fail to get GetSystemAbilityManager";
114     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
115     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
116     auto proxy = iface_cast<IStorageManager>(remote);
117     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
118     int32_t result = proxy->PrepareAddUser(userId, flag);
119     EXPECT_NE(result, E_OK);
120     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_PrepareAddUser_0002";
121 }
122 
123 /**
124  * @tc.number: SUB_STORAGE_Storage_manager_proxy_PrepareAddUser_0003
125  * @tc.name: Storage_manager_proxy_PrepareAddUser_0003
126  * @tc.desc: Test function of PrepareAddUser interface for SUCCESS which Repeated add.
127  * @tc.size: MEDIUM
128  * @tc.type: FUNC
129  * @tc.level Level 1
130  * @tc.require: AR000GK4HB
131  */
132 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_PrepareAddUser_0003, testing::ext::TestSize.Level1)
133 {
134     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_PrepareAddUser_0003";
135     int32_t userId = 102;
136     uint32_t flag = CRYPTO_FLAG_EL1;
137     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
138     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_PrepareAddUser_0003 fail to get GetSystemAbilityManager";
139     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
140     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
141     auto proxy = iface_cast<IStorageManager>(remote);
142     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
143     proxy->PrepareAddUser(userId, flag);
144     int32_t result = proxy->PrepareAddUser(userId, flag);
145     EXPECT_EQ(result, E_PERMISSION_DENIED);
146     proxy->RemoveUser(userId, flag);
147     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_PrepareAddUser_0003";
148 }
149 
150 /**
151  * @tc.number: SUB_STORAGE_Storage_manager_proxy_RemoveUser_0000
152  * @tc.name: Storage_manager_proxy_RemoveUser_0000
153  * @tc.desc: Test function of RemoveUser interface for SUCCESS.
154  * @tc.size: MEDIUM
155  * @tc.type: FUNC
156  * @tc.level Level 1
157  * @tc.require: AR000GK4HB
158  */
159 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_RemoveUser_0000, testing::ext::TestSize.Level1)
160 {
161     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_RemoveUser_0000";
162     int32_t userId = 103;
163     uint32_t flag = CRYPTO_FLAG_EL1;
164     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
165     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_RemoveUser_0000 fail to get GetSystemAbilityManager";
166     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
167     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
168     auto proxy = iface_cast<IStorageManager>(remote);
169     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
170     proxy->PrepareAddUser(userId, flag);
171     int32_t result = proxy->RemoveUser(userId, flag);
172     EXPECT_EQ(result, E_PERMISSION_DENIED);
173     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_RemoveUser_0000";
174 }
175 
176 /**
177  * @tc.number: SUB_STORAGE_Storage_manager_proxy_RemoveUser_0001
178  * @tc.name: Storage_manager_proxy_RemoveUser_0001
179  * @tc.desc: Test function of RemoveUser interface for SUCCESS which remove userId not exist.
180  * @tc.size: MEDIUM
181  * @tc.type: FUNC
182  * @tc.level Level 1
183  * @tc.require: AR000GK4HB
184  */
185 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_RemoveUser_0001, testing::ext::TestSize.Level1)
186 {
187     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_RemoveUser_0001";
188     int32_t userId = 104;
189     uint32_t flag = CRYPTO_FLAG_EL1;
190     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
191     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_RemoveUser_0001 fail to get GetSystemAbilityManager";
192     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
193     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
194     auto proxy = iface_cast<IStorageManager>(remote);
195     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
196     int32_t result = proxy->RemoveUser(userId, flag);
197     EXPECT_EQ(result, E_PERMISSION_DENIED);
198     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_RemoveUser_0001";
199 }
200 
201 /**
202  * @tc.number: SUB_STORAGE_Storage_manager_proxy_RemoveUser_0002
203  * @tc.name: Storage_manager_proxy_RemoveUser_0002
204  * @tc.desc: Test function of RemoveUser interface for Logic ERROR which userId<0.
205  * @tc.size: MEDIUM
206  * @tc.type: FUNC
207  * @tc.level Level 1
208  * @tc.require: AR000GK4HB
209  */
210 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_RemoveUser_0002, testing::ext::TestSize.Level1)
211 {
212     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_RemoveUser_0002";
213     int32_t userId = -2;
214     uint32_t flag = CRYPTO_FLAG_EL1;
215     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
216     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_RemoveUser_0002 fail to get GetSystemAbilityManager";
217     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
218     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
219     auto proxy = iface_cast<IStorageManager>(remote);
220     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
221     proxy->PrepareAddUser(userId, flag);
222     int32_t result = proxy->RemoveUser(userId, flag);
223     EXPECT_NE(result, E_OK);
224     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_RemoveUser_0002";
225 }
226 
227 /**
228  * @tc.number: SUB_STORAGE_Storage_manager_proxy_PrepareStartUser_0000
229  * @tc.name: Storage_manager_proxy_PrepareStartUser_0000
230  * @tc.desc: Test function of PrepareStartUser interface for SUCCESS.
231  * @tc.size: MEDIUM
232  * @tc.type: FUNC
233  * @tc.level Level 1
234  * @tc.require: AR000GK4HB
235  */
236 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_PrepareStartUser_0000, testing::ext::TestSize.Level1)
237 {
238     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_PrepareStartUser_0000";
239     int32_t userId = 105;
240     uint32_t flag = CRYPTO_FLAG_EL2;
241     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
242     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_PrepareStartUser_0000 fail to get GetSystemAbilityManager";
243     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
244     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
245     auto proxy = iface_cast<IStorageManager>(remote);
246     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
247     proxy->PrepareAddUser(userId, flag);
248     int32_t result = proxy->PrepareStartUser(userId);
249     EXPECT_EQ(result, E_PERMISSION_DENIED);
250     proxy->StopUser(userId);
251     proxy->RemoveUser(userId, flag);
252     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_PrepareStartUser_0000";
253 }
254 
255 /**
256  * @tc.number: SUB_STORAGE_Storage_manager_proxy_PrepareStartUser_0002
257  * @tc.name: Storage_manager_proxy_PrepareStartUser_0002
258  * @tc.desc: Test function of PrepareStartUser interface for Logic ERROR which start userId not exist.
259  * @tc.size: MEDIUM
260  * @tc.type: FUNC
261  * @tc.level Level 1
262  * @tc.require: AR000GK4HB
263  */
264 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_PrepareStartUser_0002, testing::ext::TestSize.Level1)
265 {
266     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_PrepareStartUser_0002";
267     int32_t userId = 107;
268     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
269     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_PrepareStartUser_0002 fail to get GetSystemAbilityManager";
270     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
271     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
272     auto proxy = iface_cast<IStorageManager>(remote);
273     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
274     int32_t result = proxy->PrepareStartUser(userId);
275     EXPECT_NE(result, E_OK);
276     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_PrepareStartUser_0002";
277 }
278 
279 /**
280  * @tc.number: SUB_STORAGE_Storage_manager_proxy_PrepareStartUser_0003
281  * @tc.name: Storage_manager_proxy_PrepareStartUser_0003
282  * @tc.desc: Test function of PrepareStartUser interface for Logic ERROR which  userId<0.
283  * @tc.size: MEDIUM
284  * @tc.type: FUNC
285  * @tc.level Level 1
286  * @tc.require: AR000GK4HB
287  */
288 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_PrepareStartUser_0003, testing::ext::TestSize.Level1)
289 {
290     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_PrepareStartUser_0003";
291     int32_t userId = -3;
292     uint32_t flag = CRYPTO_FLAG_EL1;
293     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
294     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_PrepareStartUser_0003 fail to get GetSystemAbilityManager";
295     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
296     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
297     auto proxy = iface_cast<IStorageManager>(remote);
298     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
299     proxy->PrepareAddUser(userId, flag);
300     int32_t result = proxy->PrepareStartUser(userId);
301     EXPECT_NE(result, E_OK);
302     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_PrepareStartUser_0003";
303 }
304 
305 /**
306  * @tc.number: SUB_STORAGE_Storage_manager_proxy_StopUser_0000
307  * @tc.name: Storage_manager_proxy_StopUser_0000
308  * @tc.desc: Test function of StopUser interface for SUCCESS.
309  * @tc.size: MEDIUM
310  * @tc.type: FUNC
311  * @tc.level Level 1
312  * @tc.require: AR000GK4HB
313  */
314 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_StopUser_0000, testing::ext::TestSize.Level1)
315 {
316     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_StopUser_0000";
317     int32_t userId = 108;
318     uint32_t flag = CRYPTO_FLAG_EL2;
319     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
320     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_StopUser_0000 fail to get GetSystemAbilityManager";
321     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
322     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
323     auto proxy = iface_cast<IStorageManager>(remote);
324     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
325     proxy->PrepareAddUser(userId, flag);
326     proxy->PrepareStartUser(userId);
327     int32_t result = proxy->StopUser(userId);
328     EXPECT_EQ(result, E_PERMISSION_DENIED);
329     proxy->RemoveUser(userId, flag);
330     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_StopUser_0000";
331 }
332 
333 /**
334  * @tc.number: SUB_STORAGE_Storage_manager_proxy_StopUser_0001
335  * @tc.name: Storage_manager_proxy_StopUser_0001
336  * @tc.desc: Test function of StopUser interface for Logic ERROR which stop userId not exist.
337  * @tc.size: MEDIUM
338  * @tc.type: FUNC
339  * @tc.level Level 1
340  * @tc.require: AR000GK4HB
341  */
342 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_StopUser_0001, testing::ext::TestSize.Level1)
343 {
344     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_StopUser_0001";
345     int32_t userId = 109;
346     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
347     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_StopUser_0001 fail to get GetSystemAbilityManager";
348     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
349     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
350     auto proxy = iface_cast<IStorageManager>(remote);
351     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
352     int32_t result = proxy->StopUser(userId);
353     EXPECT_NE(result, E_OK);
354     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_StopUser_0001";
355 }
356 
357 /**
358  * @tc.number: SUB_STORAGE_Storage_manager_proxy_StopUser_0002
359  * @tc.name: Storage_manager_proxy_StopUser_0002
360  * @tc.desc: Test function of StopUser interface for Logic ERROR which stop userId not start.
361  * @tc.size: MEDIUM
362  * @tc.type: FUNC
363  * @tc.level Level 1
364  * @tc.require: AR000GK4HB
365  */
366 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_StopUser_0002, testing::ext::TestSize.Level1)
367 {
368     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_StopUser_0002";
369     int32_t userId = 110;
370     uint32_t flag = CRYPTO_FLAG_EL1;
371     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
372     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_StopUser_0002 fail to get GetSystemAbilityManager";
373     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
374     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
375     auto proxy = iface_cast<IStorageManager>(remote);
376     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
377     proxy->PrepareAddUser(userId, flag);
378     int32_t result = proxy->StopUser(userId);
379     EXPECT_NE(result, E_OK);
380     proxy->RemoveUser(userId, flag);
381     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_StopUser_0002";
382 }
383 
384 /**
385  * @tc.number: SUB_STORAGE_Storage_manager_proxy_StopUser_0003
386  * @tc.name: Storage_manager_proxy_StopUser_0003
387  * @tc.desc: Test function of StopUser interface for Logic ERROR which userId<0.
388  * @tc.size: MEDIUM
389  * @tc.type: FUNC
390  * @tc.level Level 1
391  * @tc.require: AR000GK4HB
392  */
393 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_StopUser_0003, testing::ext::TestSize.Level1)
394 {
395     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_StopUser_0003";
396     int32_t userId = -4;
397     uint32_t flag = CRYPTO_FLAG_EL1;
398     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
399     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_StopUser_0003 fail to get GetSystemAbilityManager";
400     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
401     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
402     auto proxy = iface_cast<IStorageManager>(remote);
403     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
404     proxy->PrepareAddUser(userId, flag);
405     proxy->PrepareStartUser(userId);
406     int32_t result = proxy->StopUser(userId);
407     EXPECT_NE(result, E_OK);
408     proxy->RemoveUser(userId, flag);
409     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_StopUser_0003";
410 }
411 
412 /**
413  * @tc.number: SUB_STORAGE_Storage_manager_proxy_CompleteAddUser_0001
414  * @tc.name: Storage_manager_proxy_CompleteAddUser_0001
415  * @tc.desc: Test function of CompleteAddUser interface.
416  * @tc.size: MEDIUM
417  * @tc.type: FUNC
418  * @tc.level Level 1
419  * @tc.require: AR000GK4HB
420  */
421 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_CompleteAddUser_0001, testing::ext::TestSize.Level1)
422 {
423     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_CompleteAddUser_0001";
424     int32_t userId = 109;
425     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
426     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_CompleteAddUser_0001 fail to get GetSystemAbilityManager";
427     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
428     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
429     auto proxy = iface_cast<IStorageManager>(remote);
430     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
431     int32_t result = proxy->CompleteAddUser(userId);
432     EXPECT_NE(result, E_OK);
433     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_CompleteAddUser_0001";
434 }
435 
436 /**
437  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetFreeSizeOfVolume_0000
438  * @tc.name: Storage_manager_proxy_GetFreeSizeOfVolume_0000
439  * @tc.desc: Test function of GetFreeSizeOfVolume interface for SUCCESS.
440  * @tc.size: MEDIUM
441  * @tc.type: FUNC
442  * @tc.level Level 1
443  * @tc.require: AR000GK100
444  */
445 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetFreeSizeOfVolume_0000, testing::ext::TestSize.Level1)
446 {
447     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetFreeSizeOfVolume_0000";
448     std::string volumeUuid = "uuid-1";
449     int64_t freeSize;
450     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
451     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
452         .Times(1)
453         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
454     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
455     int32_t result = proxy_->GetFreeSizeOfVolume(volumeUuid, freeSize);
456     EXPECT_EQ(result, E_OK);
457     GTEST_LOG_(INFO) << result;
458     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetFreeSizeOfVolume_0000";
459 }
460 
461 /**
462  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetTotalSizeOfVolume_0000
463  * @tc.name: Storage_manager_proxy_GetTotalSizeOfVolume_0000
464  * @tc.desc: Test function of GetTotalSizeOfVolume interface for SUCCESS.
465  * @tc.size: MEDIUM
466  * @tc.type: FUNC
467  * @tc.level Level 1
468  * @tc.require: AR000GK100
469  */
470 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetTotalSizeOfVolume_0000, testing::ext::TestSize.Level1)
471 {
472     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetTotalSizeOfVolume_0000";
473     std::string volumeUuid = "uuid-2";
474     int64_t totalSize;
475     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
476     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
477         .Times(1)
478         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
479     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
480     int32_t result = proxy_->GetTotalSizeOfVolume(volumeUuid, totalSize);
481     EXPECT_EQ(result, E_OK);
482     GTEST_LOG_(INFO) << result;
483     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetTotalSizeOfVolume_0000";
484 }
485 
486 /**
487  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetBundleStats_0000
488  * @tc.name: Storage_manager_proxy_GetBundleStats_0000
489  * @tc.desc: Test function of GetBundleStats interface for SUCCESS.
490  * @tc.size: MEDIUM
491  * @tc.type: FUNC
492  * @tc.level Level 1
493  * @tc.require: AR000GK101
494  */
495 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetBundleStats_0000, testing::ext::TestSize.Level1)
496 {
497     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetBundleStats_0000";
498     std::string pkgName = "ohos.acts.storage.volume";
499     BundleStats bundleStats;
500     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
501     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
502         .Times(1)
503         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
504     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
505     int32_t result = proxy_->GetBundleStats(pkgName, bundleStats, 0, 0);
506     EXPECT_EQ(result, E_OK);
507     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetBundleStats_0000";
508 }
509 
510 /**
511  * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyVolumeCreated_0000
512  * @tc.name: Storage_manager_proxy_NotifyVolumeCreated_0001
513  * @tc.desc: Test function of NotifyVolumeCreated interface for SUCCESS.
514  * @tc.size: MEDIUM
515  * @tc.type: FUNC
516  * @tc.level Level 1
517  * @tc.require: SR000GGUPF
518  */
519 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyVolumeCreated_0000, testing::ext::TestSize.Level1)
520 {
521     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyVolumeCreated_0000";
522     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
523     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_NotifyVolumeCreated_0000 \
524     fail to get GetSystemAbilityManager";
525     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
526     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
527     auto proxy = iface_cast<IStorageManager>(remote);
528     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
529     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
530     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
531         .Times(1)
532         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
533     std::string volumeId = "vol-1-16";
534     int32_t fsType = 1;
535     std::string diskId = "disk-1-17";
536     VolumeCore vc(volumeId, fsType, diskId);
537     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
538     int64_t result = proxy_->NotifyVolumeCreated(vc);
539     EXPECT_EQ(result, E_OK);
540     GTEST_LOG_(INFO) << result;
541     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyVolumeCreated_0000";
542 }
543 
544 /**
545  * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyVolumeMounted_0000
546  * @tc.name: Storage_manager_proxy_NotifyVolumeMounted_0001
547  * @tc.desc: Test function of NotifyVolumeMounted interface for SUCCESS.
548  * @tc.size: MEDIUM
549  * @tc.type: FUNC
550  * @tc.level Level 1
551  * @tc.require: SR000GGUPF
552  */
553 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyVolumeMounted_0000, testing::ext::TestSize.Level1)
554 {
555     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyVolumeMounted_0000";
556     std::string volumeId = "vol-1-18";
557     int32_t fsType = 1;
558     std::string fsUuid = "uuid-3";
559     std::string path = "/";
560     std::string description = "description-1";
561     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
562     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_NotifyVolumeMounted_0000 \
563     fail to get GetSystemAbilityManager";
564     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
565     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
566     auto proxy = iface_cast<IStorageManager>(remote);
567     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
568     int64_t result = proxy->NotifyVolumeMounted(volumeId, fsType, fsUuid, path, description);
569     EXPECT_EQ(result, E_PERMISSION_DENIED);
570     GTEST_LOG_(INFO) << result;
571     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyVolumeMounted_0000";
572 }
573 
574 /**
575  * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyVolumeDestroyed_0000
576  * @tc.name: Storage_manager_proxy_NotifyVolumeDestroyed_0001
577  * @tc.desc: Test function of NotifyVolumeDestroyed interface for SUCCESS.
578  * @tc.size: MEDIUM
579  * @tc.type: FUNC
580  * @tc.level Level 1
581  * @tc.require: SR000GGUPF
582  */
583 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyVolumeDestroyed_0000, testing::ext::TestSize.Level1)
584 {
585     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyVolumeDestroyed_0000";
586     std::string volumeId = "vol-1-20";
587     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
588     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_NotifyVolumeDestroyed_0000 \
589     fail to get GetSystemAbilityManager";
590     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
591     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
592     auto proxy = iface_cast<IStorageManager>(remote);
593     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
594     int64_t result = proxy->NotifyVolumeStateChanged(volumeId, VolumeState::BAD_REMOVAL);
595     EXPECT_EQ(result, E_PERMISSION_DENIED);
596     GTEST_LOG_(INFO) << result;
597     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyVolumeDestroyed_0000";
598 }
599 
600 /**
601  * @tc.number: SUB_STORAGE_Storage_manager_proxy_Mount_0000
602  * @tc.name: Storage_manager_proxy_Mount_0000
603  * @tc.desc: Test function of Mount interface for SUCCESS.
604  * @tc.size: MEDIUM
605  * @tc.type: FUNC
606  * @tc.level Level 1
607  * @tc.require: SR000GGUOT
608  */
609 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_Mount_0000, testing::ext::TestSize.Level1)
610 {
611     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_Mount_0000";
612     std::string volumeId = "vol-1-21";
613     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
614     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
615         .Times(1)
616         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
617 
618     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
619     int32_t result = proxy_->Mount(volumeId);
620     EXPECT_EQ(result, E_OK);
621     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_Mount_0000";
622 }
623 
624 /**
625  * @tc.number: SUB_STORAGE_Storage_manager_proxy_Unmount_0000
626  * @tc.name: Storage_manager_proxy_Unmount_0000
627  * @tc.desc: Test function of Unmount interface for SUCCESS.
628  * @tc.size: MEDIUM
629  * @tc.type: FUNC
630  * @tc.level Level 1
631  * @tc.require: SR000GGUOT
632  */
633 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_Unmount_0000, testing::ext::TestSize.Level1)
634 {
635     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_Unmount_0000";
636     std::string volumeId = "vol-1-22";
637     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
638     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
639         .Times(1)
640         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
641 
642     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
643     int32_t result = proxy_->Unmount(volumeId);
644     EXPECT_EQ(result, E_OK);
645     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_Unmount_0000";
646 }
647 
648 /**
649  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetAllVolumes_0000
650  * @tc.name: Storage_manager_proxy_GetAllVolumes_0000
651  * @tc.desc: Test function of GetAllVolumes interface for SUCCESS.
652  * @tc.size: MEDIUM
653  * @tc.type: FUNC
654  * @tc.level Level 1
655  * @tc.require: SR000GGUPF
656  */
657 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetAllVolumes_0000, testing::ext::TestSize.Level1)
658 {
659     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetAllVolumes_0000";
660     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
661     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
662         .Times(1)
663         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
664     std::vector<VolumeExternal> vecOfVol;
665     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
666     int32_t result = proxy_->GetAllVolumes(vecOfVol);
667     EXPECT_EQ(result, E_OK);
668     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetAllVolumes_0000";
669 }
670 
671 /**
672  * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyDiskCreated_0000
673  * @tc.name: Storage_manager_proxy_NotifyDiskCreated_0001
674  * @tc.desc: Test function of NotifyDiskCreated interface for SUCCESS.
675  * @tc.size: MEDIUM
676  * @tc.type: FUNC
677  * @tc.level Level 1
678  * @tc.require: SR000GGUPG
679  */
680 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyDiskCreated_0000, testing::ext::TestSize.Level1)
681 {
682     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyDiskCreated_0000";
683     std::string diskId = "disk-1-23";
684     int64_t sizeBytes = 1024;
685     std::string sysPath = "/";
686     std::string vendor = "vendor-1";
687     int32_t flag = 1; // disk type
688     Disk disk(diskId, sizeBytes, sysPath, vendor, flag);
689     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
690     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_NotifyDiskCreated_0000 fail to get GetSystemAbilityManager";
691     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
692     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
693     auto proxy = iface_cast<IStorageManager>(remote);
694     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
695     int32_t result = proxy->NotifyDiskCreated(disk);
696     EXPECT_EQ(result, E_PERMISSION_DENIED);
697     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyDiskCreated_0000";
698 }
699 
700 /**
701  * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyDiskDestroyed_0000
702  * @tc.name: Storage_manager_proxy_NotifyDiskDestroyed_0001
703  * @tc.desc: Test function of NotifyDiskDestroyed interface for SUCCESS.
704  * @tc.size: MEDIUM
705  * @tc.type: FUNC
706  * @tc.level Level 1
707  * @tc.require: SR000GGUPG
708  */
709 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyDiskDestroyed_0000, testing::ext::TestSize.Level1)
710 {
711     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyDiskDestroyed_0000";
712     std::string diskId = "disk-1-24";
713     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
714     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_NotifyDiskDestroyed_0000 \
715     fail to get GetSystemAbilityManager";
716     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
717     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
718     auto proxy = iface_cast<IStorageManager>(remote);
719     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
720     int32_t result = proxy->NotifyDiskDestroyed(diskId);
721     EXPECT_EQ(result, E_PERMISSION_DENIED);
722     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyDiskDestroyed_0000";
723 }
724 
725 /**
726  * @tc.number: SUB_STORAGE_Storage_manager_proxy_Partition_0000
727  * @tc.name: Storage_manager_proxy_Partition_0000
728  * @tc.desc: Test function of Partition interface for SUCCESS.
729  * @tc.size: MEDIUM
730  * @tc.type: FUNC
731  * @tc.level Level 1
732  * @tc.require: SR000GGUOT
733  */
734 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_Partition_0000, testing::ext::TestSize.Level1)
735 {
736     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_Partition_0000";
737     std::string volumeId = "vol-1-25";
738     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
739     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
740         .Times(1)
741         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
742     std::string diskId = "disk-1-25";
743     int32_t type = 1;
744     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
745     int32_t result = proxy_->Partition(diskId, type);
746     EXPECT_EQ(result, E_OK);
747     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_Partition_0000";
748 }
749 
750 /**
751  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetAllDisks_0000
752  * @tc.name: Storage_manager_proxy_GetAllDisks_0000
753  * @tc.desc: Test function of GetAllDisks interface for SUCCESS.
754  * @tc.size: MEDIUM
755  * @tc.type: FUNC
756  * @tc.level Level 1
757  * @tc.require: SR000GGUPG
758  */
759 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetAllDisks_0000, testing::ext::TestSize.Level1)
760 {
761     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetAllDisks_0000";
762     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
763     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
764         .Times(1)
765         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
766     std::vector<Disk> vecOfDisk;
767     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
768     int32_t result = proxy_->GetAllDisks(vecOfDisk);
769     EXPECT_EQ(result, E_OK);
770     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetAllDisks_0000";
771 }
772 
773 /**
774  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetSystemSize_0000
775  * @tc.name: Storage_manager_proxy_GetSystemSize_0000
776  * @tc.desc: Test function of GetSystemSize interface for SUCCESS.
777  * @tc.size: MEDIUM
778  * @tc.type: FUNC
779  * @tc.level Level 1
780  * @tc.require: SR000H0372
781  */
782 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetSystemSize_0000, testing::ext::TestSize.Level1)
783 {
784     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetSystemSize_0000";
785     int64_t systemSize;
786     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
787     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
788         .Times(1)
789         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
790     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
791     int32_t result = proxy_->GetSystemSize(systemSize);
792     EXPECT_GE(result, E_OK);
793     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetSystemSize_0000";
794 }
795 
796 /**
797  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetTotalSize_0000
798  * @tc.name: Storage_manager_proxy_GetTotalSize_0000
799  * @tc.desc: Test function of GetTotalSize interface for SUCCESS.
800  * @tc.size: MEDIUM
801  * @tc.type: FUNC
802  * @tc.level Level 1
803  * @tc.require: SR000H0371
804  */
805 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetTotalSize_0000, testing::ext::TestSize.Level1)
806 {
807     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetTotalSize_0000";
808     int64_t totalSize;
809     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
810     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
811         .Times(1)
812         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
813     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
814     int32_t result = proxy_->GetTotalSize(totalSize);
815     EXPECT_GE(result, E_OK);
816     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetTotalSize_0000";
817 }
818 
819 /**
820  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetFreeSize_0000
821  * @tc.name: Storage_manager_proxy_GetFreeSize_0000
822  * @tc.desc: Test function of GetFreeSize interface for SUCCESS.
823  * @tc.size: MEDIUM
824  * @tc.type: FUNC
825  * @tc.level Level 1
826  * @tc.require: SR000H0371
827  */
828 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetFreeSize_0000, testing::ext::TestSize.Level1)
829 {
830     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetFreeSize_0000";
831     int64_t FreeSize;
832     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
833     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
834         .Times(1)
835         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
836     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
837     int32_t result = proxy_->GetFreeSize(FreeSize);
838     EXPECT_GE(result, E_OK);
839     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetFreeSize_0000";
840 }
841 
842 /**
843  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetUserStorageStats_0000
844  * @tc.name: Storage_manager_proxy_GetUserStorageStats_0000
845  * @tc.desc: Test function of GetUserStorageStats interface for SUCCESS.
846  * @tc.size: MEDIUM
847  * @tc.type: FUNC
848  * @tc.level Level 1
849  * @tc.require: SR000H0373
850  */
851 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetUserStorageStats_0000, testing::ext::TestSize.Level1)
852 {
853     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetUserStorageStats_0000";
854     StorageStats storageStats;
855     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
856     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
857         .Times(1)
858         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
859     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
860     int32_t result = proxy_->GetUserStorageStats(storageStats);
861     EXPECT_GE(result, E_OK);
862     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetUserStorageStats_0000";
863 }
864 
865 /**
866  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetUserStorageStats_0001
867  * @tc.name: Storage_manager_proxy_GetUserStorageStats_0001
868  * @tc.desc: Test function of GetUserStorageStats interface for SUCCESS.
869  * @tc.size: MEDIUM
870  * @tc.type: FUNC
871  * @tc.level Level 1
872  * @tc.require: SR000H0373
873  */
874 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetUserStorageStats_0001, testing::ext::TestSize.Level1)
875 {
876     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetUserStorageStats_0001";
877     StorageStats storageStats;
878     int32_t userId = 111;
879     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
880     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
881         .Times(1)
882         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
883     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
884     int32_t result = proxy_->GetUserStorageStats(userId, storageStats);
885     EXPECT_GE(result, E_OK);
886     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetUserStorageStats_0001";
887 }
888 
889 /**
890  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetVolumeByUuid_0000
891  * @tc.name: Storage_manager_proxy_GetVolumeByUuid_0000
892  * @tc.desc: Test function of GetVolumeByUuid interface for SUCCESS.
893  * @tc.size: MEDIUM
894  * @tc.type: FUNC
895  * @tc.level Level 1
896  * @tc.require: AR000H09L6
897  */
898 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetVolumeByUuid_0000, testing::ext::TestSize.Level1)
899 {
900     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetVolumeByUuid_0000";
901     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
902     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
903         .Times(1)
904         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
905     std::string fsUuid = "uuid-4";
906     VolumeExternal ve;
907     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
908     int64_t result = proxy_->GetVolumeByUuid(fsUuid, ve);
909     EXPECT_EQ(result, E_OK);
910     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetVolumeByUuid_0000";
911 }
912 
913 /**
914  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetVolumeById_0000
915  * @tc.name: Storage_manager_proxy_GetVolumeById_0000
916  * @tc.desc: Test function of GetVolumeById interface for SUCCESS.
917  * @tc.size: MEDIUM
918  * @tc.type: FUNC
919  * @tc.level Level 1
920  * @tc.require: AR000H09L6
921  */
922 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetVolumeById_0000, testing::ext::TestSize.Level1)
923 {
924     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetVolumeById_0000";
925     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
926     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_GetVolumeById_0000 fail to get GetSystemAbilityManager";
927     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
928     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
929     auto proxy = iface_cast<IStorageManager>(remote);
930     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
931     std::string volumeId = "vol-1-27";
932     int32_t fsType = 1;
933     std::string fsUuid = "uuid-5";
934     std::string diskId = "disk-1-27";
935     VolumeCore vc(volumeId, fsType, diskId);
936     proxy->NotifyVolumeCreated(vc);
937     VolumeExternal ve;
938     int64_t result = proxy->GetVolumeById(volumeId, ve);
939     EXPECT_EQ(result, E_PERMISSION_DENIED);
940     proxy->NotifyVolumeStateChanged(volumeId, VolumeState::BAD_REMOVAL);
941     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetVolumeById_0000";
942 }
943 
944 /**
945  * @tc.number: SUB_STORAGE_Storage_manager_proxy_SetVolumeDescription_0000
946  * @tc.name: Storage_manager_proxy_SetVolumeDescription_0000
947  * @tc.desc: Test function of SetVolumeDescription interface for SUCCESS.
948  * @tc.size: MEDIUM
949  * @tc.type: FUNC
950  * @tc.level Level 1
951  * @tc.require: AR000H09L6
952  */
953 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_SetVolumeDescription_0000, testing::ext::TestSize.Level1)
954 {
955     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_SetVolumeDescription_0000";
956     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
957     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
958         .Times(1)
959         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
960     std::string fsUuid = "uuid-6";
961     string description = "description-1";
962     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
963     int64_t result = proxy_->SetVolumeDescription(fsUuid, description);
964     EXPECT_EQ(result, E_OK);
965     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_SetVolumeDescription_0000";
966 }
967 
968 /**
969  * @tc.number: SUB_STORAGE_Storage_manager_proxy_Format_0000
970  * @tc.name: Storage_manager_proxy_Format_0000
971  * @tc.desc: Test function of Format interface for SUCCESS.
972  * @tc.size: MEDIUM
973  * @tc.type: FUNC
974  * @tc.level Level 1
975  * @tc.require: AR000H09L6
976  */
977 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_Format_0000, testing::ext::TestSize.Level1)
978 {
979     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_Format_0000";
980     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
981     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
982         .Times(1)
983         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
984     std::string volumeId = "vol-1-29";
985     string fsTypes = "1";
986     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
987     int64_t result = proxy_->Format(volumeId, fsTypes);
988     EXPECT_EQ(result, E_OK);
989     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_Format_0000";
990 }
991 
992 /**
993  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetDiskById_0000
994  * @tc.name: Storage_manager_proxy_GetDiskById_0000
995  * @tc.desc: Test function of GetDiskById interface for SUCCESS.
996  * @tc.size: MEDIUM
997  * @tc.type: FUNC
998  * @tc.level Level 1
999  * @tc.require: AR000H09L6
1000  */
1001 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetDiskById_0000, testing::ext::TestSize.Level1)
1002 {
1003     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetDiskById_0000";
1004     auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1005     ASSERT_TRUE(samgr != nullptr) << "Storage_manager_proxy_GetDiskById_0000 fail to get GetSystemAbilityManager";
1006     auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
1007     ASSERT_TRUE(remote != nullptr) << "GetSystemAbility failed";
1008     auto proxy = iface_cast<IStorageManager>(remote);
1009     ASSERT_TRUE(proxy != nullptr) << "fail to get proxy";
1010     std::string diskId = "disk-1-30";
1011     int64_t sizeBytes = 1024;
1012     std::string sysPath = "/";
1013     std::string vendor = "vendor-1";
1014     int32_t flag = 1; // disk type
1015     Disk disk(diskId, sizeBytes, sysPath, vendor, flag);
1016     proxy->NotifyDiskCreated(disk);
1017     int64_t result = proxy->GetDiskById(diskId, disk);
1018     EXPECT_EQ(result, E_PERMISSION_DENIED);
1019     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetDiskById_0000";
1020 }
1021 
1022 /**
1023  * @tc.number: SUB_STORAGE_Storage_manager_proxy_CreateShareFile_0000
1024  * @tc.name: Storage_manager_proxy_CreateShareFile_0000
1025  * @tc.desc: Test function of CreateShareFile interface for SUCCESS.
1026  * @tc.size: MEDIUM
1027  * @tc.type: FUNC
1028  * @tc.level Level 1
1029  * @tc.require: issueI7U9Z9
1030  */
1031 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_CreateShareFile_0000, testing::ext::TestSize.Level1)
1032 {
1033     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_CreateShareFile_0000";
1034     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1035     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1036         .Times(1)
1037         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1038     std::string uri = "file://com.demo.a/storage/share/files/test.txt";
1039     uint32_t tokenId = 100;
1040     uint32_t flag = 0;
1041     vector<string> uriList(1, uri);
1042     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1043     vector<int32_t> retList = proxy_->CreateShareFile(uriList, tokenId, flag);
1044     for (const auto &ret : retList) {
1045         EXPECT_EQ(ret, E_OK);
1046     }
1047     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_CreateShareFile_0000";
1048 }
1049 
1050 /**
1051  * @tc.number: SUB_STORAGE_Storage_manager_proxy_CreateShareFile_0100
1052  * @tc.name: Storage_manager_proxy_CreateShareFile_0100
1053  * @tc.desc: Test function of CreateShareFile interface for SendRequest failed.
1054  * @tc.size: MEDIUM
1055  * @tc.type: FUNC
1056  * @tc.level Level 1
1057  * @tc.require: issueI7U9Z9
1058  */
1059 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_CreateShareFile_0100, testing::ext::TestSize.Level1)
1060 {
1061     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_CreateShareFile_0100";
1062     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1063     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1064         .Times(1)
1065         .WillOnce(testing::Return(E_WRITE_DESCRIPTOR_ERR));
1066     std::string uri = "file://com.demo.a/storage/share/files/test.txt";
1067     uint32_t tokenId = 100;
1068     uint32_t flag = 0;
1069     vector<string> uriList(1, uri);
1070     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1071     vector<int32_t> retList = proxy_->CreateShareFile(uriList, tokenId, flag);
1072     for (const auto &ret : retList) {
1073         EXPECT_EQ(ret, E_WRITE_DESCRIPTOR_ERR);
1074     }
1075     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_CreateShareFile_0100";
1076 }
1077 
1078 /**
1079  * @tc.number: SUB_STORAGE_Storage_manager_proxy_DeleteShareFile_0000
1080  * @tc.name: Storage_manager_proxy_DeleteShareFile_0000
1081  * @tc.desc: Test function of DeleteShareFile interface for SUCCESS.
1082  * @tc.size: MEDIUM
1083  * @tc.type: FUNC
1084  * @tc.level Level 1
1085  * @tc.require: issueI7U9Z9
1086  */
1087 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_DeleteShareFile_0000, testing::ext::TestSize.Level1)
1088 {
1089     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_DeleteShareFile_0000";
1090     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1091     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1092         .Times(1)
1093         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1094     std::string uri = "file://com.demo.a/storage/share/files/test.txt";
1095     uint32_t tokenId = 100;
1096     std::vector<std::string> sharePathList;
1097     sharePathList.push_back(uri);
1098     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1099     int64_t result = proxy_->DeleteShareFile(tokenId, sharePathList);
1100     EXPECT_EQ(result, E_OK);
1101     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_DeleteShareFile_0000";
1102 }
1103 
1104 /**
1105  * @tc.number: SUB_STORAGE_Storage_manager_proxy_DeleteShareFile_0100
1106  * @tc.name: Storage_manager_proxy_DeleteShareFile_0100
1107  * @tc.desc: Test function of DeleteShareFile interface for SendRequest failed.
1108  * @tc.size: MEDIUM
1109  * @tc.type: FUNC
1110  * @tc.level Level 1
1111  * @tc.require: issueI7U9Z9
1112  */
1113 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_DeleteShareFile_0100, testing::ext::TestSize.Level1)
1114 {
1115     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_DeleteShareFile_0100";
1116     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1117     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1118         .Times(1)
1119         .WillOnce(testing::Return(E_WRITE_DESCRIPTOR_ERR));
1120     std::string uri = "file://com.demo.a/storage/share/files/test.txt";
1121     uint32_t tokenId = 100;
1122     std::vector<std::string> sharePathList;
1123     sharePathList.push_back(uri);
1124     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1125     int64_t result = proxy_->DeleteShareFile(tokenId, sharePathList);
1126     EXPECT_EQ(result, E_WRITE_DESCRIPTOR_ERR);
1127     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_DeleteShareFile_0100";
1128 }
1129 
1130 /**
1131  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GenerateUserKeys_0000
1132  * @tc.name: Storage_manager_proxy_GenerateUserKeys_0000
1133  * @tc.desc: Test function of GenerateUserKeys interface for SUCCESS.
1134  * @tc.size: MEDIUM
1135  * @tc.type: FUNC
1136  * @tc.level Level 1
1137  * @tc.require: AR000H0F7I
1138  */
1139 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GenerateUserKeys_0000, testing::ext::TestSize.Level1)
1140 {
1141     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GenerateUserKeys_0000";
1142     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1143     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1144         .Times(1)
1145         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1146     uint32_t userId = 112;
1147     uint32_t flags = 2; // UserKeys type
1148     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1149     uint32_t result = proxy_->GenerateUserKeys(userId, flags);
1150     EXPECT_EQ(result, E_OK);
1151     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GenerateUserKeys_0000";
1152 }
1153 
1154 /**
1155  * @tc.number: SUB_STORAGE_Storage_manager_proxy_DeleteUserKeys_0000
1156  * @tc.name: Storage_manager_proxy_DeleteUserKeys_0000
1157  * @tc.desc: Test function of DeleteUserKeys interface for SUCCESS.
1158  * @tc.size: MEDIUM
1159  * @tc.type: FUNC
1160  * @tc.level Level 1
1161  * @tc.require: AR000H0F7I
1162  */
1163 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_DeleteUserKeys_0000, testing::ext::TestSize.Level1)
1164 {
1165     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_DeleteUserKeys_0000";
1166     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1167     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1168         .Times(1)
1169         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1170     uint32_t userId = 113;
1171     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1172     uint32_t result = proxy_->DeleteUserKeys(userId);
1173     EXPECT_EQ(result, E_OK);
1174     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_DeleteUserKeys_0000";
1175 }
1176 
1177 /**
1178  * @tc.number: SUB_STORAGE_Storage_manager_proxy_UpdateUserAuth_0000
1179  * @tc.name: Storage_manager_proxy_UpdateUserAuth_0000
1180  * @tc.desc: Test function of UpdateUserAuth interface for SUCCESS.
1181  * @tc.size: MEDIUM
1182  * @tc.type: FUNC
1183  * @tc.level Level 1
1184  * @tc.require: AR000H0FG3
1185  */
1186 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_UpdateUserAuth_0000, testing::ext::TestSize.Level1)
1187 {
1188     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UpdateUserAuth_0000";
1189     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1190     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1191         .Times(1)
1192         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1193     uint32_t userId = 114;
1194     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1195     uint32_t result = proxy_->UpdateUserAuth(userId, 0, {}, {}, {});
1196     EXPECT_EQ(result, E_OK);
1197     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UpdateUserAuth_0000";
1198 }
1199 
1200 /**
1201  * @tc.number: SUB_STORAGE_Storage_manager_proxy_ActiveUserKey_0000
1202  * @tc.name: Storage_manager_proxy_ActiveUserKey_0000
1203  * @tc.desc: Test function of ActiveUserKey interface for SUCCESS.
1204  * @tc.size: MEDIUM
1205  * @tc.type: FUNC
1206  * @tc.level Level 1
1207  * @tc.require: AR000H0FG3
1208  */
1209 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_ActiveUserKey_0000, testing::ext::TestSize.Level1)
1210 {
1211     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_ActiveUserKey_0000";
1212     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1213     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1214         .Times(1)
1215         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1216     uint32_t userId = 115;
1217     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1218     uint32_t result = proxy_->ActiveUserKey(userId, {}, {});
1219     EXPECT_EQ(result, E_OK);
1220     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_ActiveUserKey_0000";
1221 }
1222 
1223 /**
1224  * @tc.number: SUB_STORAGE_Storage_manager_proxy_InactiveUserKey_0000
1225  * @tc.name: Storage_manager_proxy_InactiveUserKey_0000
1226  * @tc.desc: Test function of InactiveUserKey interface for SUCCESS.
1227  * @tc.size: MEDIUM
1228  * @tc.type: FUNC
1229  * @tc.level Level 1
1230  * @tc.require: AR000H0F7I
1231  */
1232 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_InactiveUserKey_0000, testing::ext::TestSize.Level1)
1233 {
1234     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_InactiveUserKey_0000";
1235     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1236     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1237         .Times(1)
1238         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1239     uint32_t userId = 116;
1240     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1241     uint32_t result = proxy_->InactiveUserKey(userId);
1242     EXPECT_EQ(result, E_OK);
1243     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_InactiveUserKey_0000";
1244 }
1245 
1246 /**
1247  * @tc.number: SUB_STORAGE_Storage_manager_proxy_LockUserScreen_0000
1248  * @tc.name: Storage_manager_proxy_LockUserScreen_0000
1249  * @tc.desc: Test function of LockUserScreen interface for SUCCESS.
1250  * @tc.size: MEDIUM
1251  * @tc.type: FUNC
1252  * @tc.level Level 1
1253  * @tc.require: AR000H0F7I
1254  */
1255 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_LockUserScreen_0000, testing::ext::TestSize.Level1)
1256 {
1257     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_LockUserScreen_0000";
1258     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1259     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1260         .Times(1)
1261         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1262     uint32_t userId = 116;
1263     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1264     uint32_t result = proxy_->LockUserScreen(userId);
1265     EXPECT_EQ(result, E_OK);
1266     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_LockUserScreen_0000";
1267 }
1268 
1269 /**
1270  * @tc.number: SUB_STORAGE_Storage_manager_proxy_UnlockUserScreen_0000
1271  * @tc.name: Storage_manager_proxy_UnlockUserScreen_0000
1272  * @tc.desc: Test function of UnlockUserScreen interface for SUCCESS.
1273  * @tc.size: MEDIUM
1274  * @tc.type: FUNC
1275  * @tc.level Level 1
1276  * @tc.require: AR000H0F7I
1277  */
1278 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_UnlockUserScreen_0000, testing::ext::TestSize.Level1)
1279 {
1280     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UnlockUserScreen_0000";
1281     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1282     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1283         .Times(1)
1284         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1285     uint32_t userId = 120;
1286     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1287     uint32_t result = proxy_->UnlockUserScreen(userId, {}, {});
1288     EXPECT_EQ(result, E_OK);
1289     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UnlockUserScreen_0000";
1290 }
1291 
1292 /**
1293  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GenerateAppkey_0000
1294  * @tc.name: Storage_manager_proxy_GenerateAppkey_0000
1295  * @tc.desc: Test function of UnlockUserScreen interface for SUCCESS.
1296  * @tc.size: MEDIUM
1297  * @tc.type: FUNC
1298  * @tc.level Level 1
1299  * @tc.require: AR000H0F7I
1300  */
1301 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GenerateAppkey_0000, testing::ext::TestSize.Level1)
1302 {
1303     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GenerateAppkey_0000";
1304     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1305     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1306         .Times(1)
1307         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1308     GTEST_LOG_(INFO) << proxy_;
1309     uint32_t hashId = 0;
1310     uint32_t userId = 0;
1311     std::string keyId;
1312     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1313     uint32_t result = proxy_->GenerateAppkey(hashId, userId, keyId);
1314     EXPECT_EQ(result, E_OK);
1315     GTEST_LOG_(INFO) << "Storage_manager_proxy_GenerateAppkey_0000 end";
1316 }
1317 
1318 /**
1319  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetLockScreenStatus_0000
1320  * @tc.name: Storage_manager_proxy_GetLockScreenStatus_0000
1321  * @tc.desc: Test function of GetLockScreenStatus interface for SUCCESS.
1322  * @tc.size: MEDIUM
1323  * @tc.type: FUNC
1324  * @tc.level Level 1
1325  * @tc.require: I9TCA3
1326  */
1327 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetLockScreenStatus_0000, testing::ext::TestSize.Level1)
1328 {
1329     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetLockScreenStatus_0000";
1330     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1331     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1332         .Times(1)
1333         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1334     uint32_t userId = 120;
1335     bool lockStatus;
1336     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1337     uint32_t result = proxy_->GetLockScreenStatus(userId, lockStatus);
1338     EXPECT_EQ(result, E_OK);
1339     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetLockScreenStatus_0000";
1340 }
1341 
1342 /**
1343  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetLockScreenStatus_0100
1344  * @tc.name: Storage_manager_proxy_GetLockScreenStatus_0000
1345  * @tc.desc: Test function of GetLockScreenStatus interface for FAILED.
1346  * @tc.size: MEDIUM
1347  * @tc.type: FUNC
1348  * @tc.level Level 1
1349  * @tc.require: I9TCA3
1350  */
1351 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetLockScreenStatus_0100, testing::ext::TestSize.Level1)
1352 {
1353     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetLockScreenStatus_0100";
1354     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1355     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1356         .Times(1)
1357         .WillOnce(testing::Return(E_SYS_ERR));
1358     uint32_t userId = 120;
1359     bool lockStatus;
1360     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1361     uint32_t result = proxy_->GetLockScreenStatus(userId, lockStatus);
1362     EXPECT_EQ(result, E_SYS_ERR);
1363     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetLockScreenStatus_0100";
1364 }
1365 
1366 
1367 /**
1368  * @tc.number: SUB_STORAGE_Storage_manager_proxy_DeleteAppkey_0000
1369  * @tc.name: Storage_manager_proxy_DeleteAppkey_0000
1370  * @tc.desc: Test function of UnlockUserScreen interface for SUCCESS.
1371  * @tc.size: MEDIUM
1372  * @tc.type: FUNC
1373  * @tc.level Level 1
1374  * @tc.require: AR000H0F7I
1375  */
1376 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_DeleteAppkey_0000, testing::ext::TestSize.Level1)
1377 {
1378     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_DeleteAppkey_0000";
1379     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1380     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1381         .Times(1)
1382         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1383     const std::string keyId;
1384     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1385     uint32_t result = proxy_->DeleteAppkey(keyId);
1386     EXPECT_EQ(result, E_OK);
1387     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_DeleteAppkey_0000";
1388 }
1389 
1390 /**
1391  * @tc.number: SUB_STORAGE_Storage_manager_proxy_MountDfsDocs_001
1392  * @tc.name: Storage_manager_proxy_MountDfsDocs_001
1393  * @tc.desc: Test function of MountDfsDocs interface for SUCCESS.
1394  * @tc.size: MEDIUM
1395  * @tc.type: FUNC
1396  * @tc.level Level 1
1397  * @tc.require: issueI9G5A0
1398  */
1399 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_MountDfsDocs_001, testing::ext::TestSize.Level1)
1400 {
1401     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_MountDfsDocs_001";
1402     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1403     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1404         .Times(1)
1405         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1406     uint32_t userId = 120;
1407     std::string relativePath = "account";
1408     std::string networkId = "testnetworkid";
1409     std::string deviceId = "testdevid";
1410     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1411     uint32_t result = proxy_->MountDfsDocs(userId, relativePath, networkId, deviceId);
1412     EXPECT_EQ(result, E_OK);
1413     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_MountDfsDocs_001";
1414 }
1415 
1416 /**
1417  * @tc.number: SUB_STORAGE_Storage_manager_proxy_UMountDfsDocs_001
1418  * @tc.name: Storage_manager_proxy_UMountDfsDocs_001
1419  * @tc.desc: Test function of UMountDfsDocs interface for SUCCESS.
1420  * @tc.size: MEDIUM
1421  * @tc.type: FUNC
1422  * @tc.level Level 1
1423  * @tc.require: issueI9G5A0
1424  */
1425 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_UMountDfsDocs_001, testing::ext::TestSize.Level1)
1426 {
1427     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UMountDfsDocs_001";
1428     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1429     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1430         .Times(1)
1431         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1432     uint32_t userId = 120;
1433     std::string relativePath = "account";
1434     std::string networkId = "testnetworkid";
1435     std::string deviceId = "testdevid";
1436     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1437     uint32_t result = proxy_->UMountDfsDocs(userId, relativePath, networkId, deviceId);
1438     EXPECT_EQ(result, E_OK);
1439     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UMountDfsDocs_001";
1440 }
1441 
1442 /**
1443  * @tc.number: SUB_STORAGE_Storage_manager_proxy_UpdateKeyContext_0000
1444  * @tc.name: Storage_manager_proxy_UpdateKeyContext_0000
1445  * @tc.desc: Test function of UpdateKeyContext interface for SUCCESS.
1446  * @tc.size: MEDIUM
1447  * @tc.type: FUNC
1448  * @tc.level Level 1
1449  * @tc.require: AR000H0F7I
1450  */
1451 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_UpdateKeyContext_0000, testing::ext::TestSize.Level1)
1452 {
1453     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UpdateKeyContext_0000";
1454     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1455     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1456         .Times(1)
1457         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1458     uint32_t userId = 117;
1459     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1460     uint32_t result = proxy_->UpdateKeyContext(userId);
1461     EXPECT_EQ(result, E_OK);
1462     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UpdateKeyContext_0000";
1463 }
1464 
1465 /**
1466  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetCurrentBundleStats_0000
1467  * @tc.name: Storage_manager_proxy_GetCurrentBundleStats_0000
1468  * @tc.desc: Test function of GetCurrentBundleStats interface for SUCCESS.
1469  * @tc.size: MEDIUM
1470  * @tc.type: FUNC
1471  * @tc.level Level 1
1472  * @tc.require: AR000H0F7I
1473  */
1474 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetCurrentBundleStats_0000, testing::ext::TestSize.Level1)
1475 {
1476     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetCurrentBundleStats_0000";
1477     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1478     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1479         .Times(1)
1480         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1481     BundleStats bundleStats;
1482     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1483     int32_t result = proxy_->GetCurrentBundleStats(bundleStats, 0);
1484     EXPECT_EQ(result, E_OK);
1485     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetCurrentBundleStats_0000";
1486 }
1487 
1488 /**
1489  * @tc.number: SUB_STORAGE_Storage_manager_proxy_SetBundleQuota_0000
1490  * @tc.name: Storage_manager_proxy_SetBundleQuota_0000
1491  * @tc.desc: Test function of SetBundleQuota interface for SUCCESS.
1492  * @tc.size: MEDIUM
1493  * @tc.type: FUNC
1494  * @tc.level Level 1
1495  * @tc.require: AR000HSKSO
1496  */
1497 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_SetBundleQuota_0000, testing::ext::TestSize.Level1)
1498 {
1499     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_SetBundleQuota_0000";
1500     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1501     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1502         .Times(1)
1503         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1504     std::string bundleName = "com.ohos.bundleName-0-1";
1505     std::string bundleDataDirPath = "/data/app/el2/100/base/" + bundleName;
1506     int32_t uid = 20000000;
1507     int32_t limitSizeMb = 1000;
1508     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1509     int32_t result = proxy_->SetBundleQuota(bundleName, uid, bundleDataDirPath, limitSizeMb);
1510     EXPECT_EQ(result, E_OK);
1511     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_SetBundleQuota_0000";
1512 }
1513 
1514 /**
1515  * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetUserStorageStatsByType_0000
1516  * @tc.name: Storage_manager_proxy_GetUserStorageStatsByType_0000
1517  * @tc.desc: Test function of GetUserStorageStatsByType interface for SUCCESS.
1518  * @tc.size: MEDIUM
1519  * @tc.type: FUNC
1520  * @tc.level Level 1
1521  */
1522 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetUserStorageStatsByType_0000, testing::ext::TestSize.Level1)
1523 {
1524     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetUserStorageStatsByType_0000";
1525     StorageStats storageStats;
1526     int32_t userId = 111;
1527     std::string type = "media";
1528     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1529     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1530         .Times(1)
1531         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1532     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1533     int32_t result = proxy_->GetUserStorageStatsByType(userId, storageStats, type);
1534     EXPECT_GE(result, E_OK);
1535     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetUserStorageStatsByType_0000";
1536 }
1537 
1538 /**
1539  * @tc.number: SUB_STORAGE_Storage_manager_proxy_UpdateMemoryPara_0000
1540  * @tc.name: Storage_manager_proxy_UpdateMemoryPara_0000
1541  * @tc.desc: Test function of UpdateMemoryPara interface for SUCCESS.
1542  * @tc.size: MEDIUM
1543  * @tc.type: FUNC
1544  * @tc.level Level 1
1545  * @tc.require: I90X2X
1546  */
1547 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_UpdateMemoryPara_0000, testing::ext::TestSize.Level1)
1548 {
1549     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UpdateMemoryPara_0000";
1550     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1551     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1552         .Times(1)
1553         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1554     int32_t size = 1000;
1555     int32_t oldSize =500;
1556     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1557     int32_t result = proxy_->UpdateMemoryPara(size, oldSize);
1558     EXPECT_EQ(result, E_OK);
1559     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UpdateMemoryPara_0000";
1560 }
1561 
1562 /**
1563  * @tc.number: SUB_Storage_manager_proxy_GetBundleStatsForIncrease_0000
1564  * @tc.name: Storage_manager_proxy_GetBundleStatsForIncrease_0000
1565  * @tc.desc: Test function of GetBundleStatsForIncrease interface for FAILED.
1566  * @tc.size: MEDIUM
1567  * @tc.type: FUNC
1568  * @tc.level Level 1
1569  */
1570 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetBundleStatsForIncrease_0000, testing::ext::TestSize.Level1)
1571 {
1572     GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetBundleStatsForIncrease_0000";
1573     ASSERT_TRUE(mock_ != nullptr) << "StorageManagerServiceMock failed";
1574     EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1575         .Times(1)
1576         .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1577     uint32_t userId = 100;
1578     std::vector<std::string> bundleNames;
1579     std::vector<int64_t> incrementalBackTimes;
1580     std::vector<int64_t> pkgFileSizes;
1581     std::vector<int64_t> incPkgFileSizes;
1582     ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
1583     int32_t result = proxy_->GetBundleStatsForIncrease(userId, bundleNames, incrementalBackTimes, pkgFileSizes,
1584         incPkgFileSizes);
1585     EXPECT_EQ(result, E_OK);
1586     GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetBundleStatsForIncrease_0000";
1587 }
1588 } // namespace