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 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
114 auto proxy = iface_cast<IStorageManager>(remote);
115 int32_t result = proxy->PrepareAddUser(userId, flag);
116 EXPECT_NE(result, E_OK);
117 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_PrepareAddUser_0002";
118 }
119
120 /**
121 * @tc.number: SUB_STORAGE_Storage_manager_proxy_PrepareAddUser_0003
122 * @tc.name: Storage_manager_proxy_PrepareAddUser_0003
123 * @tc.desc: Test function of PrepareAddUser interface for SUCCESS which Repeated add.
124 * @tc.size: MEDIUM
125 * @tc.type: FUNC
126 * @tc.level Level 1
127 * @tc.require: AR000GK4HB
128 */
129 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_PrepareAddUser_0003, testing::ext::TestSize.Level1)
130 {
131 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_PrepareAddUser_0003";
132 int32_t userId = 102;
133 uint32_t flag = CRYPTO_FLAG_EL1;
134 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
135 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
136 auto proxy = iface_cast<IStorageManager>(remote);
137 proxy->PrepareAddUser(userId, flag);
138 int32_t result = proxy->PrepareAddUser(userId, flag);
139 EXPECT_EQ(result, E_PERMISSION_DENIED);
140 proxy->RemoveUser(userId, flag);
141 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_PrepareAddUser_0003";
142 }
143
144 /**
145 * @tc.number: SUB_STORAGE_Storage_manager_proxy_RemoveUser_0000
146 * @tc.name: Storage_manager_proxy_RemoveUser_0000
147 * @tc.desc: Test function of RemoveUser interface for SUCCESS.
148 * @tc.size: MEDIUM
149 * @tc.type: FUNC
150 * @tc.level Level 1
151 * @tc.require: AR000GK4HB
152 */
153 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_RemoveUser_0000, testing::ext::TestSize.Level1)
154 {
155 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_RemoveUser_0000";
156 int32_t userId = 103;
157 uint32_t flag = CRYPTO_FLAG_EL1;
158 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
159 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
160 auto proxy = iface_cast<IStorageManager>(remote);
161 proxy->PrepareAddUser(userId, flag);
162 int32_t result = proxy->RemoveUser(userId, flag);
163 EXPECT_EQ(result, E_PERMISSION_DENIED);
164 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_RemoveUser_0000";
165 }
166
167 /**
168 * @tc.number: SUB_STORAGE_Storage_manager_proxy_RemoveUser_0001
169 * @tc.name: Storage_manager_proxy_RemoveUser_0001
170 * @tc.desc: Test function of RemoveUser interface for SUCCESS which remove userId not exist.
171 * @tc.size: MEDIUM
172 * @tc.type: FUNC
173 * @tc.level Level 1
174 * @tc.require: AR000GK4HB
175 */
176 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_RemoveUser_0001, testing::ext::TestSize.Level1)
177 {
178 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_RemoveUser_0001";
179 int32_t userId = 104;
180 uint32_t flag = CRYPTO_FLAG_EL1;
181 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
182 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
183 auto proxy = iface_cast<IStorageManager>(remote);
184 int32_t result = proxy->RemoveUser(userId, flag);
185 EXPECT_EQ(result, E_PERMISSION_DENIED);
186 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_RemoveUser_0001";
187 }
188
189 /**
190 * @tc.number: SUB_STORAGE_Storage_manager_proxy_RemoveUser_0002
191 * @tc.name: Storage_manager_proxy_RemoveUser_0002
192 * @tc.desc: Test function of RemoveUser interface for Logic ERROR which userId<0.
193 * @tc.size: MEDIUM
194 * @tc.type: FUNC
195 * @tc.level Level 1
196 * @tc.require: AR000GK4HB
197 */
198 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_RemoveUser_0002, testing::ext::TestSize.Level1)
199 {
200 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_RemoveUser_0002";
201 int32_t userId = -2;
202 uint32_t flag = CRYPTO_FLAG_EL1;
203 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
204 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
205 auto proxy = iface_cast<IStorageManager>(remote);
206 proxy->PrepareAddUser(userId, flag);
207 int32_t result = proxy->RemoveUser(userId, flag);
208 EXPECT_NE(result, E_OK);
209 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_RemoveUser_0002";
210 }
211
212 /**
213 * @tc.number: SUB_STORAGE_Storage_manager_proxy_PrepareStartUser_0000
214 * @tc.name: Storage_manager_proxy_PrepareStartUser_0000
215 * @tc.desc: Test function of PrepareStartUser interface for SUCCESS.
216 * @tc.size: MEDIUM
217 * @tc.type: FUNC
218 * @tc.level Level 1
219 * @tc.require: AR000GK4HB
220 */
221 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_PrepareStartUser_0000, testing::ext::TestSize.Level1)
222 {
223 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_PrepareStartUser_0000";
224 int32_t userId = 105;
225 uint32_t flag = CRYPTO_FLAG_EL2;
226 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
227 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
228 auto proxy = iface_cast<IStorageManager>(remote);
229 proxy->PrepareAddUser(userId, flag);
230 int32_t result = proxy->PrepareStartUser(userId);
231 EXPECT_EQ(result, E_PERMISSION_DENIED);
232 proxy->StopUser(userId);
233 proxy->RemoveUser(userId, flag);
234 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_PrepareStartUser_0000";
235 }
236
237 /**
238 * @tc.number: SUB_STORAGE_Storage_manager_proxy_PrepareStartUser_0002
239 * @tc.name: Storage_manager_proxy_PrepareStartUser_0002
240 * @tc.desc: Test function of PrepareStartUser interface for Logic ERROR which start userId not exist.
241 * @tc.size: MEDIUM
242 * @tc.type: FUNC
243 * @tc.level Level 1
244 * @tc.require: AR000GK4HB
245 */
246 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_PrepareStartUser_0002, testing::ext::TestSize.Level1)
247 {
248 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_PrepareStartUser_0001";
249 int32_t userId = 107;
250 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
251 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
252 auto proxy = iface_cast<IStorageManager>(remote);
253 int32_t result = proxy->PrepareStartUser(userId);
254 EXPECT_NE(result, E_OK);
255 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_PrepareStartUser_0002";
256 }
257
258 /**
259 * @tc.number: SUB_STORAGE_Storage_manager_proxy_PrepareStartUser_0003
260 * @tc.name: Storage_manager_proxy_PrepareStartUser_0003
261 * @tc.desc: Test function of PrepareStartUser interface for Logic ERROR which userId<0.
262 * @tc.size: MEDIUM
263 * @tc.type: FUNC
264 * @tc.level Level 1
265 * @tc.require: AR000GK4HB
266 */
267 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_PrepareStartUser_0003, testing::ext::TestSize.Level1)
268 {
269 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_PrepareStartUser_0001";
270 int32_t userId = -3;
271 uint32_t flag = CRYPTO_FLAG_EL1;
272 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
273 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
274 auto proxy = iface_cast<IStorageManager>(remote);
275 proxy->PrepareAddUser(userId, flag);
276 int32_t result = proxy->PrepareStartUser(userId);
277 EXPECT_NE(result, E_OK);
278 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_PrepareStartUser_0003";
279 }
280
281 /**
282 * @tc.number: SUB_STORAGE_Storage_manager_proxy_StopUser_0000
283 * @tc.name: Storage_manager_proxy_StopUser_0000
284 * @tc.desc: Test function of StopUser interface for SUCCESS.
285 * @tc.size: MEDIUM
286 * @tc.type: FUNC
287 * @tc.level Level 1
288 * @tc.require: AR000GK4HB
289 */
290 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_StopUser_0000, testing::ext::TestSize.Level1)
291 {
292 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_StopUser_0000";
293 int32_t userId = 108;
294 uint32_t flag = CRYPTO_FLAG_EL2;
295 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
296 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
297 auto proxy = iface_cast<IStorageManager>(remote);
298 proxy->PrepareAddUser(userId, flag);
299 proxy->PrepareStartUser(userId);
300 int32_t result = proxy->StopUser(userId);
301 EXPECT_EQ(result, E_PERMISSION_DENIED);
302 proxy->RemoveUser(userId, flag);
303 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_StopUser_0000";
304 }
305
306 /**
307 * @tc.number: SUB_STORAGE_Storage_manager_proxy_StopUser_0001
308 * @tc.name: Storage_manager_proxy_StopUser_0001
309 * @tc.desc: Test function of StopUser interface for Logic ERROR which stop userId not exist.
310 * @tc.size: MEDIUM
311 * @tc.type: FUNC
312 * @tc.level Level 1
313 * @tc.require: AR000GK4HB
314 */
315 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_StopUser_0001, testing::ext::TestSize.Level1)
316 {
317 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_StopUser_0001";
318 int32_t userId = 109;
319 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
320 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
321 auto proxy = iface_cast<IStorageManager>(remote);
322 int32_t result = proxy->StopUser(userId);
323 EXPECT_NE(result, E_OK);
324 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_StopUser_0001";
325 }
326
327 /**
328 * @tc.number: SUB_STORAGE_Storage_manager_proxy_StopUser_0002
329 * @tc.name: Storage_manager_proxy_StopUser_0002
330 * @tc.desc: Test function of StopUser interface for Logic ERROR which stop userId not start.
331 * @tc.size: MEDIUM
332 * @tc.type: FUNC
333 * @tc.level Level 1
334 * @tc.require: AR000GK4HB
335 */
336 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_StopUser_0002, testing::ext::TestSize.Level1)
337 {
338 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_StopUser_0002";
339 int32_t userId = 110;
340 uint32_t flag = CRYPTO_FLAG_EL1;
341 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
342 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
343 auto proxy = iface_cast<IStorageManager>(remote);
344 proxy->PrepareAddUser(userId, flag);
345 int32_t result = proxy->StopUser(userId);
346 EXPECT_NE(result, E_OK);
347 proxy->RemoveUser(userId, flag);
348 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_StopUser_0002";
349 }
350
351 /**
352 * @tc.number: SUB_STORAGE_Storage_manager_proxy_StopUser_0003
353 * @tc.name: Storage_manager_proxy_StopUser_0003
354 * @tc.desc: Test function of StopUser interface for Logic ERROR which userId<0.
355 * @tc.size: MEDIUM
356 * @tc.type: FUNC
357 * @tc.level Level 1
358 * @tc.require: AR000GK4HB
359 */
360 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_StopUser_0003, testing::ext::TestSize.Level1)
361 {
362 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_StopUser_0003";
363 int32_t userId = -4;
364 uint32_t flag = CRYPTO_FLAG_EL1;
365 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
366 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
367 auto proxy = iface_cast<IStorageManager>(remote);
368 proxy->PrepareAddUser(userId, flag);
369 proxy->PrepareStartUser(userId);
370 int32_t result = proxy->StopUser(userId);
371 EXPECT_NE(result, E_OK);
372 proxy->RemoveUser(userId, flag);
373 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_StopUser_0003";
374 }
375
376 /**
377 * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetFreeSizeOfVolume_0000
378 * @tc.name: Storage_manager_proxy_GetFreeSizeOfVolume_0000
379 * @tc.desc: Test function of GetFreeSizeOfVolume interface for SUCCESS.
380 * @tc.size: MEDIUM
381 * @tc.type: FUNC
382 * @tc.level Level 1
383 * @tc.require: AR000GK100
384 */
385 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetFreeSizeOfVolume_0000, testing::ext::TestSize.Level1)
386 {
387 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetFreeSizeOfVolume_0000";
388 std::string volumeUuid = "uuid-1";
389 int64_t freeSize;
390 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
391 .Times(1)
392 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
393 int32_t result = proxy_->GetFreeSizeOfVolume(volumeUuid, freeSize);
394 EXPECT_EQ(result, E_OK);
395 GTEST_LOG_(INFO) << result;
396 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetFreeSizeOfVolume_0000";
397 }
398
399 /**
400 * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetTotalSizeOfVolume_0000
401 * @tc.name: Storage_manager_proxy_GetTotalSizeOfVolume_0000
402 * @tc.desc: Test function of GetTotalSizeOfVolume interface for SUCCESS.
403 * @tc.size: MEDIUM
404 * @tc.type: FUNC
405 * @tc.level Level 1
406 * @tc.require: AR000GK100
407 */
408 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetTotalSizeOfVolume_0000, testing::ext::TestSize.Level1)
409 {
410 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetTotalSizeOfVolume_0000";
411 std::string volumeUuid = "uuid-2";
412 int64_t totalSize;
413 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
414 .Times(1)
415 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
416 int32_t result = proxy_->GetTotalSizeOfVolume(volumeUuid, totalSize);
417 EXPECT_EQ(result, E_OK);
418 GTEST_LOG_(INFO) << result;
419 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetTotalSizeOfVolume_0000";
420 }
421
422 /**
423 * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetBundleStats_0000
424 * @tc.name: Storage_manager_proxy_GetBundleStats_0000
425 * @tc.desc: Test function of GetBundleStats interface for SUCCESS.
426 * @tc.size: MEDIUM
427 * @tc.type: FUNC
428 * @tc.level Level 1
429 * @tc.require: AR000GK101
430 */
431 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetBundleStats_0000, testing::ext::TestSize.Level1)
432 {
433 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetBundleStats_0000";
434 std::string pkgName = "ohos.acts.storage.volume";
435 BundleStats bundleStats;
436 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
437 .Times(1)
438 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
439 int32_t result = proxy_->GetBundleStats(pkgName, bundleStats);
440 EXPECT_EQ(result, E_OK);
441 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetBundleStats_0000";
442 }
443
444 /**
445 * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyVolumeCreated_0000
446 * @tc.name: Storage_manager_proxy_NotifyVolumeCreated_0001
447 * @tc.desc: Test function of NotifyVolumeCreated interface for SUCCESS.
448 * @tc.size: MEDIUM
449 * @tc.type: FUNC
450 * @tc.level Level 1
451 * @tc.require: SR000GGUPF
452 */
453 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyVolumeCreated_0000, testing::ext::TestSize.Level1)
454 {
455 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyVolumeCreated_0000";
456 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
457 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
458 auto proxy = iface_cast<IStorageManager>(remote);
459 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
460 .Times(1)
461 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
462 std::string volumeId = "vol-1-16";
463 int32_t fsType = 1;
464 std::string diskId = "disk-1-17";
465 VolumeCore vc(volumeId, fsType, diskId);
466 int64_t result = proxy_->NotifyVolumeCreated(vc);
467 EXPECT_EQ(result, E_OK);
468 GTEST_LOG_(INFO) << result;
469 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyVolumeCreated_0000";
470 }
471
472 /**
473 * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyVolumeMounted_0000
474 * @tc.name: Storage_manager_proxy_NotifyVolumeMounted_0001
475 * @tc.desc: Test function of NotifyVolumeMounted interface for SUCCESS.
476 * @tc.size: MEDIUM
477 * @tc.type: FUNC
478 * @tc.level Level 1
479 * @tc.require: SR000GGUPF
480 */
481 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyVolumeMounted_0000, testing::ext::TestSize.Level1)
482 {
483 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyVolumeMounted_0000";
484 std::string volumeId = "vol-1-18";
485 int32_t fsType = 1;
486 std::string fsUuid = "uuid-3";
487 std::string path = "/";
488 std::string description = "description-1";
489 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
490 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
491 auto proxy = iface_cast<IStorageManager>(remote);
492 int64_t result = proxy->NotifyVolumeMounted(volumeId, fsType, fsUuid, path, description);
493 EXPECT_EQ(result, E_PERMISSION_DENIED);
494 GTEST_LOG_(INFO) << result;
495 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyVolumeMounted_0000";
496 }
497
498 /**
499 * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyVolumeDestroyed_0000
500 * @tc.name: Storage_manager_proxy_NotifyVolumeDestroyed_0001
501 * @tc.desc: Test function of NotifyVolumeDestroyed interface for SUCCESS.
502 * @tc.size: MEDIUM
503 * @tc.type: FUNC
504 * @tc.level Level 1
505 * @tc.require: SR000GGUPF
506 */
507 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyVolumeDestroyed_0000, testing::ext::TestSize.Level1)
508 {
509 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyVolumeDestroyed_0000";
510 std::string volumeId = "vol-1-20";
511 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
512 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
513 auto proxy = iface_cast<IStorageManager>(remote);
514 int64_t result = proxy->NotifyVolumeStateChanged(volumeId, VolumeState::BAD_REMOVAL);
515 EXPECT_EQ(result, E_PERMISSION_DENIED);
516 GTEST_LOG_(INFO) << result;
517 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyVolumeDestroyed_0000";
518 }
519
520 /**
521 * @tc.number: SUB_STORAGE_Storage_manager_proxy_Mount_0000
522 * @tc.name: Storage_manager_proxy_Mount_0000
523 * @tc.desc: Test function of Mount interface for SUCCESS.
524 * @tc.size: MEDIUM
525 * @tc.type: FUNC
526 * @tc.level Level 1
527 * @tc.require: SR000GGUOT
528 */
529 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_Mount_0000, testing::ext::TestSize.Level1)
530 {
531 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_Mount_0000";
532 std::string volumeId = "vol-1-21";
533 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
534 .Times(1)
535 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
536
537 int32_t result = proxy_->Mount(volumeId);
538 EXPECT_EQ(result, E_OK);
539 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_Mount_0000";
540 }
541
542 /**
543 * @tc.number: SUB_STORAGE_Storage_manager_proxy_Unmount_0000
544 * @tc.name: Storage_manager_proxy_Unmount_0000
545 * @tc.desc: Test function of Unmount interface for SUCCESS.
546 * @tc.size: MEDIUM
547 * @tc.type: FUNC
548 * @tc.level Level 1
549 * @tc.require: SR000GGUOT
550 */
551 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_Unmount_0000, testing::ext::TestSize.Level1)
552 {
553 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_Unmount_0000";
554 std::string volumeId = "vol-1-22";
555 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
556 .Times(1)
557 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
558
559 int32_t result = proxy_->Unmount(volumeId);
560 EXPECT_EQ(result, E_OK);
561 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_Unmount_0000";
562 }
563
564 /**
565 * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetAllVolumes_0000
566 * @tc.name: Storage_manager_proxy_GetAllVolumes_0000
567 * @tc.desc: Test function of GetAllVolumes interface for SUCCESS.
568 * @tc.size: MEDIUM
569 * @tc.type: FUNC
570 * @tc.level Level 1
571 * @tc.require: SR000GGUPF
572 */
573 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetAllVolumes_0000, testing::ext::TestSize.Level1)
574 {
575 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetAllVolumes_0000";
576 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
577 .Times(1)
578 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
579 std::vector<VolumeExternal> vecOfVol;
580 int32_t result = proxy_->GetAllVolumes(vecOfVol);
581 EXPECT_EQ(result, E_OK);
582 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetAllVolumes_0000";
583 }
584
585 /**
586 * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyDiskCreated_0000
587 * @tc.name: Storage_manager_proxy_NotifyDiskCreated_0001
588 * @tc.desc: Test function of NotifyDiskCreated interface for SUCCESS.
589 * @tc.size: MEDIUM
590 * @tc.type: FUNC
591 * @tc.level Level 1
592 * @tc.require: SR000GGUPG
593 */
594 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyDiskCreated_0000, testing::ext::TestSize.Level1)
595 {
596 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyDiskCreated_0000";
597 std::string diskId = "disk-1-23";
598 int64_t sizeBytes = 1024;
599 std::string sysPath = "/";
600 std::string vendor = "vendor-1";
601 int32_t flag = 1; // disk type
602 Disk disk(diskId, sizeBytes, sysPath, vendor, flag);
603 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
604 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
605 auto proxy = iface_cast<IStorageManager>(remote);
606 int32_t result = proxy->NotifyDiskCreated(disk);
607 EXPECT_EQ(result, E_PERMISSION_DENIED);
608 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyDiskCreated_0000";
609 }
610
611 /**
612 * @tc.number: SUB_STORAGE_Storage_manager_proxy_NotifyDiskDestroyed_0000
613 * @tc.name: Storage_manager_proxy_NotifyDiskDestroyed_0001
614 * @tc.desc: Test function of NotifyDiskDestroyed interface for SUCCESS.
615 * @tc.size: MEDIUM
616 * @tc.type: FUNC
617 * @tc.level Level 1
618 * @tc.require: SR000GGUPG
619 */
620 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_NotifyDiskDestroyed_0000, testing::ext::TestSize.Level1)
621 {
622 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_NotifyDiskDestroyed_0000";
623 std::string diskId = "disk-1-24";
624 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
625 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
626 auto proxy = iface_cast<IStorageManager>(remote);
627 int32_t result = proxy->NotifyDiskDestroyed(diskId);
628 EXPECT_EQ(result, E_PERMISSION_DENIED);
629 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_NotifyDiskDestroyed_0000";
630 }
631
632 /**
633 * @tc.number: SUB_STORAGE_Storage_manager_proxy_Partition_0000
634 * @tc.name: Storage_manager_proxy_Partition_0000
635 * @tc.desc: Test function of Partition interface for SUCCESS.
636 * @tc.size: MEDIUM
637 * @tc.type: FUNC
638 * @tc.level Level 1
639 * @tc.require: SR000GGUOT
640 */
641 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_Partition_0000, testing::ext::TestSize.Level1)
642 {
643 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_Partition_0000";
644 std::string volumeId = "vol-1-25";
645 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
646 .Times(1)
647 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
648 std::string diskId = "disk-1-25";
649 int32_t type = 1;
650 int32_t result = proxy_->Partition(diskId, type);
651 EXPECT_EQ(result, E_OK);
652 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_Partition_0000";
653 }
654
655 /**
656 * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetAllDisks_0000
657 * @tc.name: Storage_manager_proxy_GetAllDisks_0000
658 * @tc.desc: Test function of GetAllDisks interface for SUCCESS.
659 * @tc.size: MEDIUM
660 * @tc.type: FUNC
661 * @tc.level Level 1
662 * @tc.require: SR000GGUPG
663 */
664 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetAllDisks_0000, testing::ext::TestSize.Level1)
665 {
666 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetAllDisks_0000";
667 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
668 .Times(1)
669 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
670 std::vector<Disk> vecOfDisk;
671 int32_t result = proxy_->GetAllDisks(vecOfDisk);
672 EXPECT_EQ(result, E_OK);
673 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetAllDisks_0000";
674 }
675
676 /**
677 * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetSystemSize_0000
678 * @tc.name: Storage_manager_proxy_GetSystemSize_0000
679 * @tc.desc: Test function of GetSystemSize interface for SUCCESS.
680 * @tc.size: MEDIUM
681 * @tc.type: FUNC
682 * @tc.level Level 1
683 * @tc.require: SR000H0372
684 */
685 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetSystemSize_0000, testing::ext::TestSize.Level1)
686 {
687 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetSystemSize_0000";
688 int64_t systemSize;
689 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
690 .Times(1)
691 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
692 int32_t result = proxy_->GetSystemSize(systemSize);
693 EXPECT_GE(result, E_OK);
694 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetSystemSize_0000";
695 }
696
697 /**
698 * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetTotalSize_0000
699 * @tc.name: Storage_manager_proxy_GetTotalSize_0000
700 * @tc.desc: Test function of GetTotalSize interface for SUCCESS.
701 * @tc.size: MEDIUM
702 * @tc.type: FUNC
703 * @tc.level Level 1
704 * @tc.require: SR000H0371
705 */
706 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetTotalSize_0000, testing::ext::TestSize.Level1)
707 {
708 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetTotalSize_0000";
709 int64_t totalSize;
710 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
711 .Times(1)
712 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
713 int32_t result = proxy_->GetTotalSize(totalSize);
714 EXPECT_GE(result, E_OK);
715 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetTotalSize_0000";
716 }
717
718 /**
719 * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetFreeSize_0000
720 * @tc.name: Storage_manager_proxy_GetFreeSize_0000
721 * @tc.desc: Test function of GetFreeSize interface for SUCCESS.
722 * @tc.size: MEDIUM
723 * @tc.type: FUNC
724 * @tc.level Level 1
725 * @tc.require: SR000H0371
726 */
727 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetFreeSize_0000, testing::ext::TestSize.Level1)
728 {
729 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetFreeSize_0000";
730 int64_t FreeSize;
731 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
732 .Times(1)
733 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
734 int32_t result = proxy_->GetFreeSize(FreeSize);
735 EXPECT_GE(result, E_OK);
736 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetFreeSize_0000";
737 }
738
739 /**
740 * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetUserStorageStats_0000
741 * @tc.name: Storage_manager_proxy_GetUserStorageStats_0000
742 * @tc.desc: Test function of GetUserStorageStats interface for SUCCESS.
743 * @tc.size: MEDIUM
744 * @tc.type: FUNC
745 * @tc.level Level 1
746 * @tc.require: SR000H0373
747 */
748 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetUserStorageStats_0000, testing::ext::TestSize.Level1)
749 {
750 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetUserStorageStats_0000";
751 StorageStats storageStats;
752 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
753 .Times(1)
754 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
755 int32_t result = proxy_->GetUserStorageStats(storageStats);
756 EXPECT_GE(result, E_OK);
757 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetUserStorageStats_0000";
758 }
759
760 /**
761 * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetUserStorageStats_0001
762 * @tc.name: Storage_manager_proxy_GetUserStorageStats_0001
763 * @tc.desc: Test function of GetUserStorageStats interface for SUCCESS.
764 * @tc.size: MEDIUM
765 * @tc.type: FUNC
766 * @tc.level Level 1
767 * @tc.require: SR000H0373
768 */
769 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetUserStorageStats_0001, testing::ext::TestSize.Level1)
770 {
771 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetUserStorageStats_0001";
772 StorageStats storageStats;
773 int32_t userId = 111;
774 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
775 .Times(1)
776 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
777 int32_t result = proxy_->GetUserStorageStats(userId, storageStats);
778 EXPECT_GE(result, E_OK);
779 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetUserStorageStats_0001";
780 }
781
782 /**
783 * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetVolumeByUuid_0000
784 * @tc.name: Storage_manager_proxy_GetVolumeByUuid_0000
785 * @tc.desc: Test function of GetVolumeByUuid interface for SUCCESS.
786 * @tc.size: MEDIUM
787 * @tc.type: FUNC
788 * @tc.level Level 1
789 * @tc.require: AR000H09L6
790 */
791 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetVolumeByUuid_0000, testing::ext::TestSize.Level1)
792 {
793 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetVolumeByUuid_0000";
794 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
795 .Times(1)
796 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
797 std::string fsUuid = "uuid-4";
798 VolumeExternal ve;
799 int64_t result = proxy_->GetVolumeByUuid(fsUuid, ve);
800 EXPECT_EQ(result, E_OK);
801 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetVolumeByUuid_0000";
802 }
803
804 /**
805 * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetVolumeById_0000
806 * @tc.name: Storage_manager_proxy_GetVolumeById_0000
807 * @tc.desc: Test function of GetVolumeById interface for SUCCESS.
808 * @tc.size: MEDIUM
809 * @tc.type: FUNC
810 * @tc.level Level 1
811 * @tc.require: AR000H09L6
812 */
813 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetVolumeById_0000, testing::ext::TestSize.Level1)
814 {
815 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetVolumeById_0000";
816 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
817 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
818 auto proxy = iface_cast<IStorageManager>(remote);
819 std::string volumeId = "vol-1-27";
820 int32_t fsType = 1;
821 std::string fsUuid = "uuid-5";
822 std::string diskId = "disk-1-27";
823 VolumeCore vc(volumeId, fsType, diskId);
824 proxy->NotifyVolumeCreated(vc);
825 VolumeExternal ve;
826 int64_t result = proxy->GetVolumeById(volumeId, ve);
827 EXPECT_EQ(result, E_PERMISSION_DENIED);
828 proxy->NotifyVolumeStateChanged(volumeId, VolumeState::BAD_REMOVAL);
829 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetVolumeById_0000";
830 }
831
832 /**
833 * @tc.number: SUB_STORAGE_Storage_manager_proxy_SetVolumeDescription_0000
834 * @tc.name: Storage_manager_proxy_SetVolumeDescription_0000
835 * @tc.desc: Test function of SetVolumeDescription interface for SUCCESS.
836 * @tc.size: MEDIUM
837 * @tc.type: FUNC
838 * @tc.level Level 1
839 * @tc.require: AR000H09L6
840 */
841 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_SetVolumeDescription_0000, testing::ext::TestSize.Level1)
842 {
843 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_SetVolumeDescription_0000";
844 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
845 .Times(1)
846 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
847 std::string fsUuid = "uuid-6";
848 string description = "description-1";
849 int64_t result = proxy_->SetVolumeDescription(fsUuid, description);
850 EXPECT_EQ(result, E_OK);
851 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_SetVolumeDescription_0000";
852 }
853
854 /**
855 * @tc.number: SUB_STORAGE_Storage_manager_proxy_Format_0000
856 * @tc.name: Storage_manager_proxy_Format_0000
857 * @tc.desc: Test function of Format interface for SUCCESS.
858 * @tc.size: MEDIUM
859 * @tc.type: FUNC
860 * @tc.level Level 1
861 * @tc.require: AR000H09L6
862 */
863 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_Format_0000, testing::ext::TestSize.Level1)
864 {
865 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_Format_0000";
866 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
867 .Times(1)
868 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
869 std::string volumeId = "vol-1-29";
870 string fsTypes = "1";
871 int64_t result = proxy_->Format(volumeId, fsTypes);
872 EXPECT_EQ(result, E_OK);
873 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_Format_0000";
874 }
875
876 /**
877 * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetDiskById_0000
878 * @tc.name: Storage_manager_proxy_GetDiskById_0000
879 * @tc.desc: Test function of GetDiskById interface for SUCCESS.
880 * @tc.size: MEDIUM
881 * @tc.type: FUNC
882 * @tc.level Level 1
883 * @tc.require: AR000H09L6
884 */
885 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetDiskById_0000, testing::ext::TestSize.Level1)
886 {
887 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetDiskById_0000";
888 auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
889 auto remote = samgr->GetSystemAbility(STORAGE_MANAGER_MANAGER_ID);
890 auto proxy = iface_cast<IStorageManager>(remote);
891 std::string diskId = "disk-1-30";
892 int64_t sizeBytes = 1024;
893 std::string sysPath = "/";
894 std::string vendor = "vendor-1";
895 int32_t flag = 1; // disk type
896 Disk disk(diskId, sizeBytes, sysPath, vendor, flag);
897 proxy->NotifyDiskCreated(disk);
898 int64_t result = proxy->GetDiskById(diskId, disk);
899 EXPECT_EQ(result, E_PERMISSION_DENIED);
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 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
916 .Times(1)
917 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
918 std::string uri = "file://com.demo.a/storage/share/files/test.txt";
919 uint32_t tokenId = 100;
920 uint32_t flag = 0;
921 vector<string> uriList(1, uri);
922 vector<int32_t> retList = proxy_->CreateShareFile(uriList, tokenId, flag);
923 for (const auto &ret : retList) {
924 EXPECT_EQ(ret, E_OK);
925 }
926 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_CreateShareFile_0000";
927 }
928
929 /**
930 * @tc.number: SUB_STORAGE_Storage_manager_proxy_CreateShareFile_0100
931 * @tc.name: Storage_manager_proxy_CreateShareFile_0100
932 * @tc.desc: Test function of CreateShareFile interface for SendRequest failed.
933 * @tc.size: MEDIUM
934 * @tc.type: FUNC
935 * @tc.level Level 1
936 * @tc.require: issueI7U9Z9
937 */
938 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_CreateShareFile_0100, testing::ext::TestSize.Level1)
939 {
940 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_CreateShareFile_0100";
941 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
942 .Times(1)
943 .WillOnce(testing::Return(E_WRITE_DESCRIPTOR_ERR));
944 std::string uri = "file://com.demo.a/storage/share/files/test.txt";
945 uint32_t tokenId = 100;
946 uint32_t flag = 0;
947 vector<string> uriList(1, uri);
948 vector<int32_t> retList = proxy_->CreateShareFile(uriList, tokenId, flag);
949 for (const auto &ret : retList) {
950 EXPECT_EQ(ret, E_WRITE_DESCRIPTOR_ERR);
951 }
952 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_CreateShareFile_0100";
953 }
954
955 /**
956 * @tc.number: SUB_STORAGE_Storage_manager_proxy_DeleteShareFile_0000
957 * @tc.name: Storage_manager_proxy_DeleteShareFile_0000
958 * @tc.desc: Test function of DeleteShareFile interface for SUCCESS.
959 * @tc.size: MEDIUM
960 * @tc.type: FUNC
961 * @tc.level Level 1
962 * @tc.require: issueI7U9Z9
963 */
964 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_DeleteShareFile_0000, testing::ext::TestSize.Level1)
965 {
966 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_DeleteShareFile_0000";
967 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
968 .Times(1)
969 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
970 std::string uri = "file://com.demo.a/storage/share/files/test.txt";
971 uint32_t tokenId = 100;
972 std::vector<std::string> sharePathList;
973 sharePathList.push_back(uri);
974 int64_t result = proxy_->DeleteShareFile(tokenId, sharePathList);
975 EXPECT_EQ(result, E_OK);
976 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_DeleteShareFile_0000";
977 }
978
979 /**
980 * @tc.number: SUB_STORAGE_Storage_manager_proxy_DeleteShareFile_0100
981 * @tc.name: Storage_manager_proxy_DeleteShareFile_0100
982 * @tc.desc: Test function of DeleteShareFile interface for SendRequest failed.
983 * @tc.size: MEDIUM
984 * @tc.type: FUNC
985 * @tc.level Level 1
986 * @tc.require: issueI7U9Z9
987 */
988 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_DeleteShareFile_0100, testing::ext::TestSize.Level1)
989 {
990 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_DeleteShareFile_0100";
991 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
992 .Times(1)
993 .WillOnce(testing::Return(E_WRITE_DESCRIPTOR_ERR));
994 std::string uri = "file://com.demo.a/storage/share/files/test.txt";
995 uint32_t tokenId = 100;
996 std::vector<std::string> sharePathList;
997 sharePathList.push_back(uri);
998 int64_t result = proxy_->DeleteShareFile(tokenId, sharePathList);
999 EXPECT_EQ(result, E_WRITE_DESCRIPTOR_ERR);
1000 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_DeleteShareFile_0100";
1001 }
1002
1003 /**
1004 * @tc.number: SUB_STORAGE_Storage_manager_proxy_GenerateUserKeys_0000
1005 * @tc.name: Storage_manager_proxy_GenerateUserKeys_0000
1006 * @tc.desc: Test function of GenerateUserKeys interface for SUCCESS.
1007 * @tc.size: MEDIUM
1008 * @tc.type: FUNC
1009 * @tc.level Level 1
1010 * @tc.require: AR000H0F7I
1011 */
1012 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GenerateUserKeys_0000, testing::ext::TestSize.Level1)
1013 {
1014 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GenerateUserKeys_0000";
1015 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1016 .Times(1)
1017 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1018 uint32_t userId = 112;
1019 uint32_t flags = 2; // UserKeys type
1020 uint32_t result = proxy_->GenerateUserKeys(userId, flags);
1021 EXPECT_EQ(result, E_OK);
1022 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GenerateUserKeys_0000";
1023 }
1024
1025 /**
1026 * @tc.number: SUB_STORAGE_Storage_manager_proxy_DeleteUserKeys_0000
1027 * @tc.name: Storage_manager_proxy_DeleteUserKeys_0000
1028 * @tc.desc: Test function of DeleteUserKeys interface for SUCCESS.
1029 * @tc.size: MEDIUM
1030 * @tc.type: FUNC
1031 * @tc.level Level 1
1032 * @tc.require: AR000H0F7I
1033 */
1034 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_DeleteUserKeys_0000, testing::ext::TestSize.Level1)
1035 {
1036 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_DeleteUserKeys_0000";
1037 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1038 .Times(1)
1039 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1040 uint32_t userId = 113;
1041 uint32_t result = proxy_->DeleteUserKeys(userId);
1042 EXPECT_EQ(result, E_OK);
1043 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_DeleteUserKeys_0000";
1044 }
1045
1046 /**
1047 * @tc.number: SUB_STORAGE_Storage_manager_proxy_UpdateUserAuth_0000
1048 * @tc.name: Storage_manager_proxy_UpdateUserAuth_0000
1049 * @tc.desc: Test function of UpdateUserAuth interface for SUCCESS.
1050 * @tc.size: MEDIUM
1051 * @tc.type: FUNC
1052 * @tc.level Level 1
1053 * @tc.require: AR000H0FG3
1054 */
1055 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_UpdateUserAuth_0000, testing::ext::TestSize.Level1)
1056 {
1057 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UpdateUserAuth_0000";
1058 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1059 .Times(1)
1060 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1061 uint32_t userId = 114;
1062 uint32_t result = proxy_->UpdateUserAuth(userId, 0, {}, {}, {});
1063 EXPECT_EQ(result, E_OK);
1064 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UpdateUserAuth_0000";
1065 }
1066
1067 /**
1068 * @tc.number: SUB_STORAGE_Storage_manager_proxy_ActiveUserKey_0000
1069 * @tc.name: Storage_manager_proxy_ActiveUserKey_0000
1070 * @tc.desc: Test function of ActiveUserKey interface for SUCCESS.
1071 * @tc.size: MEDIUM
1072 * @tc.type: FUNC
1073 * @tc.level Level 1
1074 * @tc.require: AR000H0FG3
1075 */
1076 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_ActiveUserKey_0000, testing::ext::TestSize.Level1)
1077 {
1078 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_ActiveUserKey_0000";
1079 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1080 .Times(1)
1081 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1082 uint32_t userId = 115;
1083 uint32_t result = proxy_->ActiveUserKey(userId, {}, {});
1084 EXPECT_EQ(result, E_OK);
1085 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_ActiveUserKey_0000";
1086 }
1087
1088 /**
1089 * @tc.number: SUB_STORAGE_Storage_manager_proxy_InactiveUserKey_0000
1090 * @tc.name: Storage_manager_proxy_InactiveUserKey_0000
1091 * @tc.desc: Test function of InactiveUserKey interface for SUCCESS.
1092 * @tc.size: MEDIUM
1093 * @tc.type: FUNC
1094 * @tc.level Level 1
1095 * @tc.require: AR000H0F7I
1096 */
1097 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_InactiveUserKey_0000, testing::ext::TestSize.Level1)
1098 {
1099 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_InactiveUserKey_0000";
1100 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1101 .Times(1)
1102 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1103 uint32_t userId = 116;
1104 uint32_t result = proxy_->InactiveUserKey(userId);
1105 EXPECT_EQ(result, E_OK);
1106 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_InactiveUserKey_0000";
1107 }
1108
1109 /**
1110 * @tc.number: SUB_STORAGE_Storage_manager_proxy_LockUserScreen_0000
1111 * @tc.name: Storage_manager_proxy_LockUserScreen_0000
1112 * @tc.desc: Test function of LockUserScreen interface for SUCCESS.
1113 * @tc.size: MEDIUM
1114 * @tc.type: FUNC
1115 * @tc.level Level 1
1116 * @tc.require: AR000H0F7I
1117 */
1118 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_LockUserScreen_0000, testing::ext::TestSize.Level1)
1119 {
1120 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_LockUserScreen_0000";
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 uint32_t result = proxy_->LockUserScreen(userId);
1126 EXPECT_EQ(result, E_OK);
1127 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_LockUserScreen_0000";
1128 }
1129
1130 /**
1131 * @tc.number: SUB_STORAGE_Storage_manager_proxy_UnlockUserScreen_0000
1132 * @tc.name: Storage_manager_proxy_UnlockUserScreen_0000
1133 * @tc.desc: Test function of UnlockUserScreen 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_UnlockUserScreen_0000, testing::ext::TestSize.Level1)
1140 {
1141 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UnlockUserScreen_0000";
1142 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1143 .Times(1)
1144 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1145 uint32_t userId = 120;
1146 uint32_t result = proxy_->UnlockUserScreen(userId);
1147 EXPECT_EQ(result, E_OK);
1148 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UnlockUserScreen_0000";
1149 }
1150
1151 /**
1152 * @tc.number: SUB_STORAGE_Storage_manager_proxy_UpdateKeyContext_0000
1153 * @tc.name: Storage_manager_proxy_UpdateKeyContext_0000
1154 * @tc.desc: Test function of UpdateKeyContext interface for SUCCESS.
1155 * @tc.size: MEDIUM
1156 * @tc.type: FUNC
1157 * @tc.level Level 1
1158 * @tc.require: AR000H0F7I
1159 */
1160 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_UpdateKeyContext_0000, testing::ext::TestSize.Level1)
1161 {
1162 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UpdateKeyContext_0000";
1163 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1164 .Times(1)
1165 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1166 uint32_t userId = 117;
1167 uint32_t result = proxy_->UpdateKeyContext(userId);
1168 EXPECT_EQ(result, E_OK);
1169 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UpdateKeyContext_0000";
1170 }
1171
1172 /**
1173 * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetCurrentBundleStats_0000
1174 * @tc.name: Storage_manager_proxy_GetCurrentBundleStats_0000
1175 * @tc.desc: Test function of GetCurrentBundleStats interface for SUCCESS.
1176 * @tc.size: MEDIUM
1177 * @tc.type: FUNC
1178 * @tc.level Level 1
1179 * @tc.require: AR000H0F7I
1180 */
1181 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetCurrentBundleStats_0000, testing::ext::TestSize.Level1)
1182 {
1183 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetCurrentBundleStats_0000";
1184 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1185 .Times(1)
1186 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1187 BundleStats bundleStats;
1188 int32_t result = proxy_->GetCurrentBundleStats(bundleStats);
1189 EXPECT_EQ(result, E_OK);
1190 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetCurrentBundleStats_0000";
1191 }
1192
1193 /**
1194 * @tc.number: SUB_STORAGE_Storage_manager_proxy_SetBundleQuota_0000
1195 * @tc.name: Storage_manager_proxy_SetBundleQuota_0000
1196 * @tc.desc: Test function of SetBundleQuota interface for SUCCESS.
1197 * @tc.size: MEDIUM
1198 * @tc.type: FUNC
1199 * @tc.level Level 1
1200 * @tc.require: AR000HSKSO
1201 */
1202 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_SetBundleQuota_0000, testing::ext::TestSize.Level1)
1203 {
1204 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_SetBundleQuota_0000";
1205 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1206 .Times(1)
1207 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1208 std::string bundleName = "com.ohos.bundleName-0-1";
1209 std::string bundleDataDirPath = "/data/app/el2/100/base/" + bundleName;
1210 int32_t uid = 20000000;
1211 int32_t limitSizeMb = 1000;
1212 int32_t result = proxy_->SetBundleQuota(bundleName, uid, bundleDataDirPath, limitSizeMb);
1213 EXPECT_EQ(result, E_OK);
1214 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_SetBundleQuota_0000";
1215 }
1216
1217 /**
1218 * @tc.number: SUB_STORAGE_Storage_manager_proxy_GetUserStorageStatsByType_0000
1219 * @tc.name: Storage_manager_proxy_GetUserStorageStatsByType_0000
1220 * @tc.desc: Test function of GetUserStorageStatsByType interface for SUCCESS.
1221 * @tc.size: MEDIUM
1222 * @tc.type: FUNC
1223 * @tc.level Level 1
1224 */
1225 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetUserStorageStatsByType_0000, testing::ext::TestSize.Level1)
1226 {
1227 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_GetUserStorageStatsByType_0000";
1228 StorageStats storageStats;
1229 int32_t userId = 111;
1230 std::string type = "media";
1231 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1232 .Times(1)
1233 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1234 int32_t result = proxy_->GetUserStorageStatsByType(userId, storageStats, type);
1235 EXPECT_GE(result, E_OK);
1236 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetUserStorageStatsByType_0000";
1237 }
1238
1239 /**
1240 * @tc.number: SUB_STORAGE_Storage_manager_proxy_UpdateMemoryPara_0000
1241 * @tc.name: Storage_manager_proxy_UpdateMemoryPara_0000
1242 * @tc.desc: Test function of UpdateMemoryPara interface for SUCCESS.
1243 * @tc.size: MEDIUM
1244 * @tc.type: FUNC
1245 * @tc.level Level 1
1246 * @tc.require: I90X2X
1247 */
1248 HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_UpdateMemoryPara_0000, testing::ext::TestSize.Level1)
1249 {
1250 GTEST_LOG_(INFO) << "StorageManagerProxyTest-begin Storage_manager_proxy_UpdateMemoryPara_0000";
1251 EXPECT_CALL(*mock_, SendRequest(testing::_, testing::_, testing::_, testing::_))
1252 .Times(1)
1253 .WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
1254 int32_t size = 1000;
1255 int32_t oldSize =500;
1256 int32_t result = proxy_->UpdateMemoryPara(size, oldSize);
1257 EXPECT_EQ(result, E_OK);
1258 GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_UpdateMemoryPara_0000";
1259 }
1260 } // namespace