1 /*
2 * Copyright (c) 2023 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 <gtest/gtest.h>
17
18 #define private public
19 #define protected public
20 #include "installd_client.h"
21 #undef private
22 #undef protected
23
24 using namespace testing::ext;
25 using namespace OHOS;
26 using namespace OHOS::AppExecFwk;
27
28 namespace OHOS {
29 namespace AppExecFwk {
30 namespace {
31 const std::string BUNDLE_DIR = "bundleDir";
32 const std::string SRC_MODULE_PATH = "srcModulePath";
33 const std::string TARGET_PATH = "targetPath";
34 const std::string TARGET_SO_PATH = "targetSoPath";
35 const std::string CPU_ABI = "cpuAbi";
36 const std::string SRC_PATH = "srcPath";
37 const std::string OLD_PATH = "oldPath";
38 const std::string NEW_PATH = "newPath";
39 const std::string BUNDLE_NAME = "bundleName";
40 const std::string APL = "apl";
41 const std::string MODULE_NAME = "ModuleName";
42 const std::string DIR = "dir";
43 const std::string FILE = "file";
44 const std::string FILE_PATH = "filePath";
45 const std::string OLD_SO_PATH = "oldSoPath";
46 const std::string DIFF_FILE_PATH = "diffFilePath";
47 const std::string NEW_SO_PATH = "newSoPath";
48 const std::string SOURCE_DIR = "sourceDir";
49 const std::string DESTINATION_DIR = "destinationDir";
50 const int32_t USERID = 100;
51 const int32_t UID = 1000;
52 const int32_t GID = 1000;
53 const std::string EMPTY_STRING = "";
54 } // namespace
55
56 class BmsInstalldClientTest : public testing::Test {
57 public:
58 BmsInstalldClientTest();
59 ~BmsInstalldClientTest();
60 std::shared_ptr<InstalldClient> installClient_ = nullptr;
61 static void SetUpTestCase();
62 static void TearDownTestCase();
63 void SetUp();
64 void TearDown();
65 };
66
BmsInstalldClientTest()67 BmsInstalldClientTest::BmsInstalldClientTest()
68 {}
69
~BmsInstalldClientTest()70 BmsInstalldClientTest::~BmsInstalldClientTest()
71 {}
72
SetUpTestCase()73 void BmsInstalldClientTest::SetUpTestCase()
74 {}
75
TearDownTestCase()76 void BmsInstalldClientTest::TearDownTestCase()
77 {}
78
SetUp()79 void BmsInstalldClientTest::SetUp()
80 {
81 installClient_ = std::make_shared<InstalldClient>();
82 }
83
TearDown()84 void BmsInstalldClientTest::TearDown()
85 {}
86
87 /**
88 * @tc.number: BmsInstalldClientTest_CreateBundleDir_0100
89 * @tc.name: CreateBundleDir
90 * @tc.desc: Test whether CreateBundleDir is called normally.(bundleDir is empty)
91 */
92 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CreateBundleDir_0100, TestSize.Level1)
93 {
94 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CreateBundleDir_0100 start";
95 std::string bundleDir = EMPTY_STRING;
96 ErrCode result = installClient_->CreateBundleDir(bundleDir);
97 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
98 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CreateBundleDir_0100 end";
99 }
100
101 /**
102 * @tc.number: BmsInstalldClientTest_CreateBundleDir_0200
103 * @tc.name: CreateBundleDir
104 * @tc.desc: Test whether CreateBundleDir is called normally.
105 */
106 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CreateBundleDir_0200, TestSize.Level1)
107 {
108 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CreateBundleDir_0200 start";
109 std::string bundleDir = BUNDLE_DIR;
110 ErrCode result = installClient_->CreateBundleDir(bundleDir);
111 EXPECT_EQ(result, installClient_->CallService(&IInstalld::CreateBundleDir, bundleDir));
112 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CreateBundleDir_0200 end";
113 }
114
115 /**
116 * @tc.number: BmsInstalldClientTest_ExtractModuleFiles_0100
117 * @tc.name: ExtractModuleFiles
118 * @tc.desc: Test whether ExtractModuleFiles is called normally.(srcModulePath is empty)
119 */
120 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractModuleFiles_0100, TestSize.Level1)
121 {
122 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractModuleFiles_0100 start";
123 std::string srcModulePath = EMPTY_STRING;
124 std::string targetPath = TARGET_PATH;
125 std::string targetSoPath = TARGET_SO_PATH;
126 std::string cpuAbi = CPU_ABI;
127 ErrCode result = installClient_->ExtractModuleFiles(srcModulePath, targetPath, targetSoPath, cpuAbi);
128 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
129 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractModuleFiles_0100 end";
130 }
131
132 /**
133 * @tc.number: BmsInstalldClientTest_ExtractModuleFiles_0200
134 * @tc.name: ExtractModuleFiles
135 * @tc.desc: Test whether init is called normally.(targetPath is empty)
136 */
137 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractModuleFiles_0200, TestSize.Level1)
138 {
139 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractModuleFiles_0200 start";
140 std::string srcModulePath = SRC_MODULE_PATH;
141 std::string targetPath = EMPTY_STRING;
142 std::string targetSoPath = TARGET_SO_PATH;
143 std::string cpuAbi = CPU_ABI;
144 ErrCode result = installClient_->ExtractModuleFiles(srcModulePath, targetPath, targetSoPath, cpuAbi);
145 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
146 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractModuleFiles_0200 end";
147 }
148
149 /**
150 * @tc.number: BmsInstalldClientTest_ExtractModuleFiles_0300
151 * @tc.name: ExtractModuleFiles
152 * @tc.desc: Test whether ExtractModuleFiles is called normally.
153 */
154 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractModuleFiles_0300, TestSize.Level1)
155 {
156 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractModuleFiles_0300 start";
157 std::string srcModulePath = SRC_MODULE_PATH;
158 std::string targetPath = TARGET_PATH;
159 std::string targetSoPath = TARGET_SO_PATH;
160 std::string cpuAbi = CPU_ABI;
161 ErrCode result = installClient_->ExtractModuleFiles(srcModulePath, targetPath, targetSoPath, cpuAbi);
162 EXPECT_EQ(result, installClient_->CallService(&IInstalld::ExtractModuleFiles,
163 srcModulePath, targetPath, targetSoPath, cpuAbi));
164 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractModuleFiles_0300 end";
165 }
166
167 /**
168 * @tc.number: BmsInstalldClientTest_ExtractFiles_0100
169 * @tc.name: ExtractFiles
170 * @tc.desc: Test whether ExtractFiles is called normally.(extractParam.srcPath is empty)
171 */
172 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractFiles_0100, TestSize.Level1)
173 {
174 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractFiles_0100 start";
175 ExtractParam extractParam;
176 extractParam.srcPath = EMPTY_STRING;
177 extractParam.targetPath = TARGET_PATH;
178 ErrCode result = installClient_->ExtractFiles(extractParam);
179 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
180 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractFiles_0100 end";
181 }
182
183 /**
184 * @tc.number: BmsInstalldClientTest_ExtractFiles_0200
185 * @tc.name: ExtractFiles
186 * @tc.desc: Test whether ExtractFiles is called normally.(extractParam.targetPath is empty)
187 */
188 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractFiles_0200, TestSize.Level1)
189 {
190 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractFiles_0200 start";
191 ExtractParam extractParam;
192 extractParam.srcPath = SRC_PATH;
193 extractParam.targetPath = EMPTY_STRING;
194 ErrCode result = installClient_->ExtractFiles(extractParam);
195 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
196 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractFiles_0200 end";
197 }
198
199 /**
200 * @tc.number: BmsInstalldClientTest_ExtractFiles_0300
201 * @tc.name: ExtractFiles
202 * @tc.desc: Test whether ExtractFiles is called normally.
203 */
204 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractFiles_0300, TestSize.Level1)
205 {
206 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractFiles_0300 start";
207 ExtractParam extractParam;
208 extractParam.srcPath = SRC_PATH;
209 extractParam.targetPath = TARGET_PATH;
210 ErrCode result = installClient_->ExtractFiles(extractParam);
211 EXPECT_EQ(result, installClient_->CallService(&IInstalld::ExtractFiles, extractParam));
212 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractFiles_0300 end";
213 }
214
215 /**
216 * @tc.number: BmsInstalldClientTest_ExtractHnpFiles_0100
217 * @tc.name: ExtractHnpFiles
218 * @tc.desc: Test whether ExtractHnpFiles is called normally.(extractParam.srcPath is empty)
219 */
220 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractHnpFiles_0100, TestSize.Level1)
221 {
222 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractHnpFiles_0100 start";
223 std::string hnpPackageInfo = EMPTY_STRING;
224 ExtractParam extractParam;
225 extractParam.srcPath = EMPTY_STRING;
226 extractParam.targetPath = TARGET_PATH;
227 ErrCode result = installClient_->ExtractHnpFiles(hnpPackageInfo, extractParam);
228 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
229 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractHnpFiles_0100 end";
230 }
231
232 /**
233 * @tc.number: BmsInstalldClientTest_ExtractHnpFiles_0200
234 * @tc.name: ExtractHnpFiles
235 * @tc.desc: Test whether ExtractHnpFiles is called normally.(extractParam.targetPath is empty)
236 */
237 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractHnpFiles_0200, TestSize.Level1)
238 {
239 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractHnpFiles_0200 start";
240 std::string hnpPackageInfo = "hnpPackageInfo";
241 ExtractParam extractParam;
242 extractParam.srcPath = SRC_PATH;
243 extractParam.targetPath = EMPTY_STRING;
244 ErrCode result = installClient_->ExtractHnpFiles(hnpPackageInfo, extractParam);
245 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
246 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractHnpFiles_0200 end";
247 }
248
249 /**
250 * @tc.number: BmsInstalldClientTest_ExtractHnpFiles_0300
251 * @tc.name: ExtractHnpFiles
252 * @tc.desc: Test whether ExtractHnpFiles is called normally.
253 */
254 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractHnpFiles_0300, TestSize.Level1)
255 {
256 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractHnpFiles_0300 start";
257 std::string hnpPackageInfo = "hnpPackageInfo";
258 ExtractParam extractParam;
259 extractParam.srcPath = SRC_PATH;
260 extractParam.targetPath = TARGET_PATH;
261 ErrCode result = installClient_->ExtractHnpFiles(hnpPackageInfo, extractParam);
262 EXPECT_EQ(result, installClient_->CallService(&IInstalld::ExtractHnpFiles, hnpPackageInfo, extractParam));
263 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractHnpFiles_0300 end";
264 }
265
266 /**
267 * @tc.number: BmsInstalldClientTest_ProcessBundleInstallNative_0100
268 * @tc.name: ProcessBundleInstallNative
269 * @tc.desc: Test whether ProcessBundleInstallNative is called normally.
270 */
271 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ProcessBundleInstallNative_0100, TestSize.Level1)
272 {
273 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ProcessBundleInstallNative_0100 start";
274 std::string userId = std::to_string(USERID);
275 std::string hnpRootPath = SRC_PATH;
276 std::string hapPath = SRC_PATH;
277 std::string cpuAbi = CPU_ABI;
278 std::string packageName = "com.example.test";
279
280 ErrCode result = installClient_->ProcessBundleInstallNative(userId, hnpRootPath, hapPath, cpuAbi, packageName);
281 EXPECT_EQ(result, installClient_->CallService(&IInstalld::ProcessBundleInstallNative,
282 userId, hnpRootPath, hapPath, cpuAbi, packageName));
283 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ProcessBundleInstallNative_0100 end";
284 }
285
286 /**
287 * @tc.number: BmsInstalldClientTest_ProcessBundleUnInstallNative_0100
288 * @tc.name: ProcessBundleInstallNative
289 * @tc.desc: Test whether ProcessBundleInstallNative is called normally.
290 */
291 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ProcessBundleUnInstallNative_0100, TestSize.Level1)
292 {
293 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ProcessBundleUnInstallNative_0100 start";
294 std::string userId = std::to_string(USERID);
295 std::string packageName = "com.example.test";
296
297 ErrCode result = installClient_->ProcessBundleUnInstallNative(userId, packageName);
298 EXPECT_EQ(result, installClient_->CallService(&IInstalld::ProcessBundleUnInstallNative, userId, packageName));
299 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ProcessBundleUnInstallNative_0100 end";
300 }
301
302 /**
303 * @tc.number: BmsInstalldClientTest_RenameModuleDir_0100
304 * @tc.name: RenameModuleDir
305 * @tc.desc: Test whether RenameModuleDir is called normally.(oldPath is empty)
306 */
307 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_RenameModuleDir_0100, TestSize.Level1)
308 {
309 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RenameModuleDir_0100 start";
310 std::string oldPath = EMPTY_STRING;
311 std::string newPath = NEW_PATH;
312 ErrCode result = installClient_->RenameModuleDir(oldPath, newPath);
313 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
314 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RenameModuleDir_0100 end";
315 }
316
317 /**
318 * @tc.number: BmsInstalldClientTest_RenameModuleDir_0200
319 * @tc.name: RenameModuleDir
320 * @tc.desc: Test whether RenameModuleDir is called normally.(newPath is empty)
321 */
322 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_RenameModuleDir_0200, TestSize.Level1)
323 {
324 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RenameModuleDir_0200 start";
325 std::string oldPath = OLD_PATH;
326 std::string newPath = EMPTY_STRING;
327 ErrCode result = installClient_->RenameModuleDir(oldPath, newPath);
328 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
329 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RenameModuleDir_0200 end";
330 }
331
332 /**
333 * @tc.number: BmsInstalldClientTest_RenameModuleDir_0300
334 * @tc.name: RenameModuleDir
335 * @tc.desc: Test whether RenameModuleDir is called normally.
336 */
337 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_RenameModuleDir_0300, TestSize.Level1)
338 {
339 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RenameModuleDir_0300 start";
340 std::string oldPath = OLD_PATH;
341 std::string newPath = NEW_PATH;
342 ErrCode result = installClient_->RenameModuleDir(oldPath, newPath);
343 EXPECT_EQ(result, installClient_->CallService(&IInstalld::RenameModuleDir, oldPath, newPath));
344 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RenameModuleDir_0300 end";
345 }
346
347 /**
348 * @tc.number: BmsInstalldClientTest_CreateBundleDataDir_0100
349 * @tc.name: CreateBundleDataDir
350 * @tc.desc: Test whether CreateBundleDataDir is called normally.(bundleName is empty)
351 */
352 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CreateBundleDataDir_0100, TestSize.Level1)
353 {
354 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CreateBundleDataDir_0100 start";
355 CreateDirParam createDirParam;
356 createDirParam.bundleName = EMPTY_STRING;
357 createDirParam.userId = USERID;
358 createDirParam.uid = UID;
359 createDirParam.gid = GID;
360 createDirParam.apl = APL;
361 createDirParam.isPreInstallApp = false;
362 ErrCode result = installClient_->CreateBundleDataDir(createDirParam);
363 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
364 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CreateBundleDataDir_0100 end";
365 }
366
367 /**
368 * @tc.number: BmsInstalldClientTest_CreateBundleDataDir_0200
369 * @tc.name: CreateBundleDataDir
370 * @tc.desc: Test whether CreateBundleDataDir is called normally.(userid < 0)
371 */
372 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CreateBundleDataDir_0200, TestSize.Level1)
373 {
374 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CreateBundleDataDir_0200 start";
375 CreateDirParam createDirParam;
376 createDirParam.bundleName = BUNDLE_NAME;
377 createDirParam.userId = -1;
378 createDirParam.uid = UID;
379 createDirParam.gid = GID;
380 createDirParam.apl = APL;
381 createDirParam.isPreInstallApp = false;
382 ErrCode result = installClient_->CreateBundleDataDir(createDirParam);
383 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
384 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CreateBundleDataDir_0200 end";
385 }
386
387 /**
388 * @tc.number: BmsInstalldClientTest_CreateBundleDataDir_0300
389 * @tc.name: CreateBundleDataDir
390 * @tc.desc: Test whether CreateBundleDataDir is called normally.(uid < 0)
391 */
392 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CreateBundleDataDir_0300, TestSize.Level1)
393 {
394 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CreateBundleDataDir_0300 start";
395 CreateDirParam createDirParam;
396 createDirParam.bundleName = BUNDLE_NAME;
397 createDirParam.userId = USERID;
398 createDirParam.uid = -1;
399 createDirParam.gid = GID;
400 createDirParam.apl = APL;
401 createDirParam.isPreInstallApp = false;
402 ErrCode result = installClient_->CreateBundleDataDir(createDirParam);
403 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
404 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CreateBundleDataDir_0300 end";
405 }
406
407 /**
408 * @tc.number: BmsInstalldClientTest_CreateBundleDataDir_0400
409 * @tc.name: CreateBundleDataDir
410 * @tc.desc: Test whether CreateBundleDataDir is called normally.(gid < 0)
411 */
412 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CreateBundleDataDir_0400, TestSize.Level1)
413 {
414 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CreateBundleDataDir_0400 start";
415 CreateDirParam createDirParam;
416 createDirParam.bundleName = BUNDLE_NAME;
417 createDirParam.userId = USERID;
418 createDirParam.uid = UID;
419 createDirParam.gid = -1;
420 createDirParam.apl = APL;
421 createDirParam.isPreInstallApp = false;
422 ErrCode result = installClient_->CreateBundleDataDir(createDirParam);
423 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
424 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CreateBundleDataDir_0400 end";
425 }
426
427 /**
428 * @tc.number: BmsInstalldClientTest_CreateBundleDataDir_0500
429 * @tc.name: CreateBundleDataDir
430 * @tc.desc: Test whether CreateBundleDataDir is called normally.
431 */
432 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CreateBundleDataDir_0500, TestSize.Level1)
433 {
434 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CreateBundleDataDir_0500 start";
435 CreateDirParam createDirParam;
436 createDirParam.bundleName = BUNDLE_NAME;
437 createDirParam.userId = USERID;
438 createDirParam.uid = UID;
439 createDirParam.gid = GID;
440 createDirParam.apl = APL;
441 createDirParam.isPreInstallApp = false;
442 ErrCode result = installClient_->CreateBundleDataDir(createDirParam);
443 EXPECT_EQ(result, installClient_->CallService(&IInstalld::CreateBundleDataDir, createDirParam));
444 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CreateBundleDataDir_0500 end";
445 }
446
447 /**
448 * @tc.number: BmsInstalldClientTest_RemoveBundleDataDir_0100
449 * @tc.name: RemoveBundleDataDir
450 * @tc.desc: Test whether RemoveBundleDataDir is called normally.(bundleName is empty)
451 */
452 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_RemoveBundleDataDir_0100, TestSize.Level1)
453 {
454 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RemoveBundleDataDir_0100 start";
455 std::string bundleName = EMPTY_STRING;
456 int userid = USERID;
457 ErrCode result = installClient_->RemoveBundleDataDir(bundleName, userid);
458 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
459 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RemoveBundleDataDir_0100 end";
460 }
461
462 /**
463 * @tc.number: BmsInstalldClientTest_RemoveBundleDataDir_0200
464 * @tc.name: RemoveBundleDataDir
465 * @tc.desc: Test whether RemoveBundleDataDir is called normally.(userid < 0)
466 */
467 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_RemoveBundleDataDir_0200, TestSize.Level1)
468 {
469 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RemoveBundleDataDir_0200 start";
470 std::string bundleName = BUNDLE_NAME;
471 int userid = -1;
472 ErrCode result = installClient_->RemoveBundleDataDir(bundleName, userid);
473 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
474 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RemoveBundleDataDir_0200 end";
475 }
476
477 /**
478 * @tc.number: BmsInstalldClientTest_RemoveBundleDataDir_0300
479 * @tc.name: RemoveBundleDataDir
480 * @tc.desc: Test whether RemoveBundleDataDir is called normally.
481 */
482 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_RemoveBundleDataDir_0300, TestSize.Level1)
483 {
484 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RemoveBundleDataDir_0300 start";
485 std::string bundleName = BUNDLE_NAME;
486 int userid = USERID;
487 ErrCode result = installClient_->RemoveBundleDataDir(bundleName, userid);
488 EXPECT_EQ(result, installClient_->CallService(&IInstalld::RemoveBundleDataDir, bundleName, userid, false, false));
489 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RemoveBundleDataDir_0300 end";
490 }
491
492 /**
493 * @tc.number: BmsInstalldClientTest_RemoveModuleDataDir_0100
494 * @tc.name: RemoveModuleDataDir
495 * @tc.desc: Test whether RemoveModuleDataDir is called normally.(ModuleName is empty)
496 */
497 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_RemoveModuleDataDir_0100, TestSize.Level1)
498 {
499 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RemoveModuleDataDir_0100 start";
500 std::string ModuleName = EMPTY_STRING;
501 int userid = USERID;
502 ErrCode result = installClient_->RemoveModuleDataDir(ModuleName, userid);
503 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
504 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RemoveModuleDataDir_0100 end";
505 }
506
507 /**
508 * @tc.number: BmsInstalldClientTest_RemoveModuleDataDir_0200
509 * @tc.name: RemoveModuleDataDir
510 * @tc.desc: Test whether RemoveModuleDataDir is called normally.(userid < 0)
511 */
512 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_RemoveModuleDataDir_0200, TestSize.Level1)
513 {
514 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RemoveModuleDataDir_0200 start";
515 std::string ModuleName = MODULE_NAME;
516 int userid = -1;
517 ErrCode result = installClient_->RemoveModuleDataDir(ModuleName, userid);
518 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
519 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RemoveModuleDataDir_0200 end";
520 }
521
522 /**
523 * @tc.number: BmsInstalldClientTest_RemoveModuleDataDir_0300
524 * @tc.name: RemoveModuleDataDir
525 * @tc.desc: Test whether RemoveModuleDataDir is called normally.
526 */
527 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_RemoveModuleDataDir_0300, TestSize.Level1)
528 {
529 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RemoveModuleDataDir_0300 start";
530 std::string ModuleName = MODULE_NAME;
531 int userid = USERID;
532 ErrCode result = installClient_->RemoveModuleDataDir(ModuleName, userid);
533 EXPECT_EQ(result, installClient_->CallService(&IInstalld::RemoveModuleDataDir, ModuleName, userid));
534 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RemoveModuleDataDir_0300 end";
535 }
536
537 /**
538 * @tc.number: BmsInstalldClientTest_RemoveDir_0100
539 * @tc.name: RemoveDir
540 * @tc.desc: Test whether RemoveDir is called normally.(dir is empty)
541 */
542 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_RemoveDir_0100, TestSize.Level1)
543 {
544 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RemoveDir_0100 start";
545 std::string dir = EMPTY_STRING;
546 ErrCode result = installClient_->RemoveDir(dir);
547 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
548 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RemoveDir_0100 end";
549 }
550
551 /**
552 * @tc.number: BmsInstalldClientTest_RemoveDir_0200
553 * @tc.name: RemoveDir
554 * @tc.desc: Test whether RemoveDir is called normally.
555 */
556 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_RemoveDir_0200, TestSize.Level1)
557 {
558 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RemoveDir_0200 start";
559 std::string dir = DIR;
560 ErrCode result = installClient_->RemoveDir(dir);
561 EXPECT_EQ(result, installClient_->CallService(&IInstalld::RemoveDir, dir));
562 GTEST_LOG_(INFO) << "BmsInstalldClientTest_RemoveDir_0200 end";
563 }
564
565 /**
566 * @tc.number: BmsInstalldClientTest_CleanBundleDataDir_0100
567 * @tc.name: CleanBundleDataDir
568 * @tc.desc: Test whether CleanBundleDataDir is called normally.(bundleDir is empty)
569 */
570 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CleanBundleDataDir_0100, TestSize.Level1)
571 {
572 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CleanBundleDataDir_0100 start";
573 std::string bundleDir = EMPTY_STRING;
574 ErrCode result = installClient_->CleanBundleDataDir(bundleDir);
575 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
576 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CleanBundleDataDir_0100 end";
577 }
578
579 /**
580 * @tc.number: BmsInstalldClientTest_CleanBundleDataDir_0200
581 * @tc.name: CleanBundleDataDir
582 * @tc.desc: Test whether CleanBundleDataDir is called normally.
583 */
584 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CleanBundleDataDir_0200, TestSize.Level1)
585 {
586 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CleanBundleDataDir_0200 start";
587 std::string bundleDir = BUNDLE_DIR;
588 ErrCode result = installClient_->CleanBundleDataDir(bundleDir);
589 EXPECT_EQ(result, installClient_->CallService(&IInstalld::CleanBundleDataDir, bundleDir));
590 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CleanBundleDataDir_0200 end";
591 }
592
593 /**
594 * @tc.number: BmsInstalldClientTest_GetBundleStats_0100
595 * @tc.name: GetBundleStats
596 * @tc.desc: Test whether GetBundleStats is called normally.(bundleName is empty)
597 */
598 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_GetBundleStats_0100, TestSize.Level1)
599 {
600 GTEST_LOG_(INFO) << "BmsInstalldClientTest_GetBundleStats_0100 start";
601 std::string bundleName = EMPTY_STRING;
602 int userId = USERID;
603 std::vector<int64_t> bundleStats;
604 ErrCode result = installClient_->GetBundleStats(bundleName, userId, bundleStats, 0, 0);
605 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
606 GTEST_LOG_(INFO) << "BmsInstalldClientTest_GetBundleStats_0100 end";
607 }
608
609 /**
610 * @tc.number: BmsInstalldClientTest_GetBundleStats_0200
611 * @tc.name: GetBundleStats
612 * @tc.desc: Test whether GetBundleStats is called normally.
613 */
614 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_GetBundleStats_0200, TestSize.Level1)
615 {
616 GTEST_LOG_(INFO) << "BmsInstalldClientTest_GetBundleStats_0200 start";
617 std::string bundleName = BUNDLE_NAME;
618 int userId = USERID;
619 std::vector<int64_t> bundleStats;
620 std::vector<std::string> moduleNameList = {};
621 ErrCode result = installClient_->GetBundleStats(bundleName, userId, bundleStats, 0, 0, 0);
622 EXPECT_EQ(result, installClient_->CallService(&IInstalld::GetBundleStats,
623 bundleName, userId, bundleStats, 0, 0, 0, moduleNameList));
624 GTEST_LOG_(INFO) << "BmsInstalldClientTest_GetBundleStats_0200 end";
625 }
626
627 /**
628 * @tc.number: BmsInstalldClientTest_SetDirApl_0100
629 * @tc.name: SetDirApl
630 * @tc.desc: Test whether SetDirApl is called normally.(dir is empty)
631 */
632 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_SetDirApl_0100, TestSize.Level1)
633 {
634 GTEST_LOG_(INFO) << "BmsInstalldClientTest_SetDirApl_0100 start";
635 std::string dir = EMPTY_STRING;
636 std::string bundleName = BUNDLE_NAME;
637 std::string apl = APL;
638 ErrCode result = installClient_->SetDirApl(dir, bundleName, apl, false, false);
639 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
640 GTEST_LOG_(INFO) << "BmsInstalldClientTest_SetDirApl_0100 end";
641 }
642
643 /**
644 * @tc.number: BmsInstalldClientTest_SetDirApl_0200
645 * @tc.name: SetDirApl
646 * @tc.desc: Test whether SetDirApl is called normally.(bundleName is empty)
647 */
648 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_SetDirApl_0200, TestSize.Level1)
649 {
650 GTEST_LOG_(INFO) << "BmsInstalldClientTest_SetDirApl_0200 start";
651 std::string dir = DIR;
652 std::string bundleName = EMPTY_STRING;
653 std::string apl = APL;
654 ErrCode result = installClient_->SetDirApl(dir, bundleName, apl, true, false);
655 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
656 GTEST_LOG_(INFO) << "BmsInstalldClientTest_SetDirApl_0200 end";
657 }
658
659 /**
660 * @tc.number: BmsInstalldClientTest_SetDirApl_0300
661 * @tc.name: SetDirApl
662 * @tc.desc: Test whether SetDirApl is called normally.(apl is empty)
663 */
664 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_SetDirApl_0300, TestSize.Level1)
665 {
666 GTEST_LOG_(INFO) << "BmsInstalldClientTest_SetDirApl_0300 start";
667 std::string dir = DIR;
668 std::string bundleName = BUNDLE_NAME;
669 std::string apl = EMPTY_STRING;
670 ErrCode result = installClient_->SetDirApl(dir, bundleName, apl, false, true);
671 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
672 GTEST_LOG_(INFO) << "BmsInstalldClientTest_SetDirApl_0300 end";
673 }
674
675 /**
676 * @tc.number: BmsInstalldClientTest_SetDirApl_0400
677 * @tc.name: SetDirApl
678 * @tc.desc: Test whether SetDirApl is called normally.
679 */
680 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_SetDirApl_0400, TestSize.Level1)
681 {
682 GTEST_LOG_(INFO) << "BmsInstalldClientTest_SetDirApl_0400 start";
683 std::string dir = DIR;
684 std::string bundleName = BUNDLE_NAME;
685 std::string apl = APL;
686 ErrCode result = installClient_->SetDirApl(dir, bundleName, apl, true, false);
687 EXPECT_EQ(result, installClient_->CallService(&IInstalld::SetDirApl, dir, bundleName, apl, true, false));
688 GTEST_LOG_(INFO) << "BmsInstalldClientTest_SetDirApl_0400 end";
689 }
690
691 /**
692 * @tc.number: BmsInstalldClientTest_GetBundleCachePath_0100
693 * @tc.name: GetBundleCachePath
694 * @tc.desc: Test whether GetBundleCachePath is called normally.(dir is empty)
695 */
696 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_GetBundleCachePath_0100, TestSize.Level1)
697 {
698 GTEST_LOG_(INFO) << "BmsInstalldClientTest_GetBundleCachePath_0100 start";
699 std::string dir = EMPTY_STRING;
700 std::vector<std::string> cachePath;
701 ErrCode result = installClient_->GetBundleCachePath(dir, cachePath);
702 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
703 GTEST_LOG_(INFO) << "BmsInstalldClientTest_GetBundleCachePath_0100 end";
704 }
705
706 /**
707 * @tc.number: BmsInstalldClientTest_GetBundleCachePath_0200
708 * @tc.name: GetBundleCachePath
709 * @tc.desc: Test whether GetBundleCachePath is called normally.
710 */
711 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_GetBundleCachePath_0200, TestSize.Level1)
712 {
713 GTEST_LOG_(INFO) << "BmsInstalldClientTest_GetBundleCachePath_0200 start";
714 std::string dir = DIR;
715 std::vector<std::string> cachePath;
716 ErrCode result = installClient_->GetBundleCachePath(dir, cachePath);
717 EXPECT_EQ(result, installClient_->CallService(&IInstalld::GetBundleCachePath, dir, cachePath));
718 GTEST_LOG_(INFO) << "BmsInstalldClientTest_GetBundleCachePath_0200 end";
719 }
720
721 /**
722 * @tc.number: BmsInstalldClientTest_ResetInstalldProxy_0100
723 * @tc.name: ResetInstalldProxy
724 * @tc.desc: Test whether ResetInstalldProxy is called normally.
725 */
726 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ResetInstalldProxy_0100, TestSize.Level1)
727 {
728 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ResetInstalldProxy_0100 start";
729 installClient_->ResetInstalldProxy();
730 EXPECT_EQ(installClient_->installdProxy_, nullptr);
731 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ResetInstalldProxy_0100 end";
732 }
733
734 /**
735 * @tc.number: BmsInstalldClientTest_ScanDir_0100
736 * @tc.name: ScanDir
737 * @tc.desc: Test whether ScanDir is called normally.(dir is empty)
738 */
739 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ScanDir_0100, TestSize.Level1)
740 {
741 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ScanDir_0100 start";
742 std::string dir = EMPTY_STRING;
743 std::vector<std::string> paths;
744 ErrCode result = installClient_->ScanDir(dir, ScanMode::SUB_FILE_ALL, ResultMode::ABSOLUTE_PATH, paths);
745 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
746 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ScanDir_0100 end";
747 }
748
749 /**
750 * @tc.number: BmsInstalldClientTest_ScanDir_0200
751 * @tc.name: ScanDir
752 * @tc.desc: Test whether ScanDir is called normally.
753 */
754 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ScanDir_0200, TestSize.Level1)
755 {
756 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ScanDir_0200 start";
757 std::string dir = DIR;
758 std::vector<std::string> paths;
759 ErrCode result = installClient_->ScanDir(dir, ScanMode::SUB_FILE_ALL, ResultMode::ABSOLUTE_PATH, paths);
760 EXPECT_EQ(result, installClient_->CallService(&IInstalld::ScanDir,
761 dir, ScanMode::SUB_FILE_ALL, ResultMode::ABSOLUTE_PATH, paths));
762 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ScanDir_0200 end";
763 }
764
765 /**
766 * @tc.number: BmsInstalldClientTest_MoveFile_0100
767 * @tc.name: MoveFile
768 * @tc.desc: Test whether MoveFile is called normally.(oldPath is empty)
769 */
770 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_MoveFile_0100, TestSize.Level1)
771 {
772 GTEST_LOG_(INFO) << "BmsInstalldClientTest_MoveFile_0100 start";
773 std::string oldPath = EMPTY_STRING;
774 std::string newPath = NEW_PATH;
775 ErrCode result = installClient_->MoveFile(oldPath, newPath);
776 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
777 GTEST_LOG_(INFO) << "BmsInstalldClientTest_MoveFile_0100 end";
778 }
779
780 /**
781 * @tc.number: BmsInstalldClientTest_MoveFile_0200
782 * @tc.name: MoveFile
783 * @tc.desc: Test whether MoveFile is called normally.(newPath is empty)
784 */
785 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_MoveFile_0200, TestSize.Level1)
786 {
787 GTEST_LOG_(INFO) << "BmsInstalldClientTest_MoveFile_0200 start";
788 std::string oldPath = OLD_PATH;
789 std::string newPath = EMPTY_STRING;
790 ErrCode result = installClient_->MoveFile(oldPath, newPath);
791 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
792 GTEST_LOG_(INFO) << "BmsInstalldClientTest_MoveFile_0200 end";
793 }
794
795 /**
796 * @tc.number: BmsInstalldClientTest_MoveFile_0300
797 * @tc.name: MoveFile
798 * @tc.desc: Test whether MoveFile is called normally.
799 */
800 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_MoveFile_0300, TestSize.Level1)
801 {
802 GTEST_LOG_(INFO) << "BmsInstalldClientTest_MoveFile_0300 start";
803 std::string oldPath = OLD_PATH;
804 std::string newPath = NEW_PATH;
805 ErrCode result = installClient_->MoveFile(oldPath, newPath);
806 EXPECT_EQ(result, installClient_->CallService(&IInstalld::MoveFile, oldPath, newPath));
807 GTEST_LOG_(INFO) << "BmsInstalldClientTest_MoveFile_0300 end";
808 }
809
810 /**
811 * @tc.number: BmsInstalldClientTest_CopyFile_0100
812 * @tc.name: CopyFile
813 * @tc.desc: Test whether CopyFile is called normally.(oldPath is empty)
814 */
815 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CopyFile_0100, TestSize.Level1)
816 {
817 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CopyFile_0100 start";
818 std::string oldPath = EMPTY_STRING;
819 std::string newPath = NEW_PATH;
820 ErrCode result = installClient_->CopyFile(oldPath, newPath);
821 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
822 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CopyFile_0100 end";
823 }
824
825 /**
826 * @tc.number: BmsInstalldClientTest_CopyFile_0200
827 * @tc.name: CopyFile
828 * @tc.desc: Test whether CopyFile is called normally.(newPath is empty)
829 */
830 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CopyFile_0200, TestSize.Level1)
831 {
832 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CopyFile_0200 start";
833 std::string oldPath = OLD_PATH;
834 std::string newPath = EMPTY_STRING;
835 ErrCode result = installClient_->CopyFile(oldPath, newPath);
836 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
837 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CopyFile_0200 end";
838 }
839
840 /**
841 * @tc.number: BmsInstalldClientTest_CopyFile_0300
842 * @tc.name: CopyFile
843 * @tc.desc: Test whether CopyFile is called normally.
844 */
845 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CopyFile_0300, TestSize.Level1)
846 {
847 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CopyFile_0300 start";
848 std::string oldPath = OLD_PATH;
849 std::string newPath = NEW_PATH;
850 ErrCode result = installClient_->CopyFile(oldPath, newPath);
851 EXPECT_EQ(result, installClient_->CallService(&IInstalld::CopyFile, oldPath, newPath, ""));
852 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CopyFile_0300 end";
853 }
854
855 /**
856 * @tc.number: BmsInstalldClientTest_Mkdir_0100
857 * @tc.name: Mkdir
858 * @tc.desc: Test whether Mkdir is called normally.(dir is empty)
859 */
860 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_Mkdir_0100, TestSize.Level1)
861 {
862 GTEST_LOG_(INFO) << "BmsInstalldClientTest_Mkdir_0100 start";
863 std::string dir = EMPTY_STRING;
864 int32_t mode = 1;
865 int32_t uid = UID;
866 int32_t gid = GID;
867 ErrCode result = installClient_->Mkdir(dir, mode, uid, gid);
868 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
869 GTEST_LOG_(INFO) << "BmsInstalldClientTest_Mkdir_0100 end";
870 }
871
872 /**
873 * @tc.number: BmsInstalldClientTest_Mkdir_0200
874 * @tc.name: Mkdir
875 * @tc.desc: Test whether Mkdir is called normally.
876 */
877 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_Mkdir_0200, TestSize.Level1)
878 {
879 GTEST_LOG_(INFO) << "BmsInstalldClientTest_Mkdir_0200 start";
880 std::string dir = DIR;
881 int32_t mode = 1;
882 int32_t uid = UID;
883 int32_t gid = GID;
884 ErrCode result = installClient_->Mkdir(dir, mode, uid, gid);
885 EXPECT_EQ(result, installClient_->CallService(&IInstalld::Mkdir, dir, mode, uid, gid));
886 GTEST_LOG_(INFO) << "BmsInstalldClientTest_Mkdir_0200 end";
887 }
888
889 /**
890 * @tc.number: BmsInstalldClientTest_GetFileStat_0100
891 * @tc.name: GetFileStat
892 * @tc.desc: Test whether GetFileStat is called normally.(file is empty)
893 */
894 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_GetFileStat_0100, TestSize.Level1)
895 {
896 GTEST_LOG_(INFO) << "BmsInstalldClientTest_GetFileStat_0100 start";
897 std::string file = EMPTY_STRING;
898 FileStat fileStat;
899 ErrCode result = installClient_->GetFileStat(file, fileStat);
900 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
901 GTEST_LOG_(INFO) << "BmsInstalldClientTest_GetFileStat_0100 end";
902 }
903
904 /**
905 * @tc.number: BmsInstalldClientTest_GetFileStat_0200
906 * @tc.name: GetFileStat
907 * @tc.desc: Test whether GetFileStat is called normally.
908 */
909 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_GetFileStat_0200, TestSize.Level1)
910 {
911 GTEST_LOG_(INFO) << "BmsInstalldClientTest_GetFileStat_0200 start";
912 std::string file = FILE;
913 FileStat fileStat;
914 ErrCode result = installClient_->GetFileStat(file, fileStat);
915 EXPECT_EQ(result, installClient_->CallService(&IInstalld::GetFileStat, file, fileStat));
916 GTEST_LOG_(INFO) << "BmsInstalldClientTest_GetFileStat_0200 end";
917 }
918
919 /**
920 * @tc.number: BmsInstalldClientTest_ExtractDiffFiles_0100
921 * @tc.name: ExtractDiffFiles
922 * @tc.desc: Test whether ExtractDiffFiles is called normally.(filePath is empty)
923 */
924 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractDiffFiles_0100, TestSize.Level1)
925 {
926 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractDiffFiles_0100 start";
927 std::string filePath = EMPTY_STRING;
928 std::string targetPath = TARGET_PATH;
929 std::string cpuAbi = CPU_ABI;
930 ErrCode result = installClient_->ExtractDiffFiles(filePath, targetPath, cpuAbi);
931 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
932 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractDiffFiles_0100 end";
933 }
934
935 /**
936 * @tc.number: BmsInstalldClientTest_ExtractDiffFiles_0200
937 * @tc.name: ExtractDiffFiles
938 * @tc.desc: Test whether ExtractDiffFiles is called normally.(targetPath is empty)
939 */
940 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractDiffFiles_0200, TestSize.Level1)
941 {
942 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractDiffFiles_0200 start";
943 std::string filePath = FILE_PATH;
944 std::string targetPath = EMPTY_STRING;
945 std::string cpuAbi = CPU_ABI;
946 ErrCode result = installClient_->ExtractDiffFiles(filePath, targetPath, cpuAbi);
947 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
948 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractDiffFiles_0200 end";
949 }
950
951 /**
952 * @tc.number: BmsInstalldClientTest_ExtractDiffFiles_0300
953 * @tc.name: ExtractDiffFiles
954 * @tc.desc: Test whether ExtractDiffFiles is called normally.(cpuAbi is empty)
955 */
956 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractDiffFiles_0300, TestSize.Level1)
957 {
958 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractDiffFiles_0300 start";
959 std::string filePath = FILE_PATH;
960 std::string targetPath = TARGET_PATH;
961 std::string cpuAbi = EMPTY_STRING;
962 ErrCode result = installClient_->ExtractDiffFiles(filePath, targetPath, cpuAbi);
963 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
964 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractDiffFiles_0300 end";
965 }
966
967 /**
968 * @tc.number: BmsInstalldClientTest_ExtractDiffFiles_0400
969 * @tc.name: ExtractDiffFiles
970 * @tc.desc: Test whether ExtractDiffFiles is called normally.
971 */
972 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractDiffFiles_0400, TestSize.Level1)
973 {
974 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractDiffFiles_0400 start";
975 std::string filePath = FILE_PATH;
976 std::string targetPath = TARGET_PATH;
977 std::string cpuAbi = CPU_ABI;
978 ErrCode result = installClient_->ExtractDiffFiles(filePath, targetPath, cpuAbi);
979 EXPECT_EQ(result, installClient_->CallService(&IInstalld::ExtractDiffFiles, filePath, targetPath, cpuAbi));
980 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ExtractDiffFiles_0400 end";
981 }
982
983 /**
984 * @tc.number: BmsInstalldClientTest_ApplyDiffPatch_0100
985 * @tc.name: ApplyDiffPatch
986 * @tc.desc: Test whether ApplyDiffPatch is called normally.(oldSoPath is empty)
987 */
988 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ApplyDiffPatch_0100, TestSize.Level1)
989 {
990 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ApplyDiffPatch_0100 start";
991 std::string oldSoPath = EMPTY_STRING;
992 std::string diffFilePath = DIFF_FILE_PATH;
993 std::string newSoPath = NEW_SO_PATH;
994 ErrCode result = installClient_->ApplyDiffPatch(oldSoPath, diffFilePath, newSoPath, 0);
995 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
996 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ApplyDiffPatch_0100 end";
997 }
998
999 /**
1000 * @tc.number: BmsInstalldClientTest_ApplyDiffPatch_0200
1001 * @tc.name: ApplyDiffPatch
1002 * @tc.desc: Test whether ApplyDiffPatch is called normally.(diffFilePath is empty)
1003 */
1004 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ApplyDiffPatch_0200, TestSize.Level1)
1005 {
1006 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ApplyDiffPatch_0200 start";
1007 std::string oldSoPath = OLD_SO_PATH;
1008 std::string diffFilePath = EMPTY_STRING;
1009 std::string newSoPath = NEW_SO_PATH;
1010 ErrCode result = installClient_->ApplyDiffPatch(oldSoPath, diffFilePath, newSoPath, 0);
1011 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1012 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ApplyDiffPatch_0200 end";
1013 }
1014
1015 /**
1016 * @tc.number: BmsInstalldClientTest_ApplyDiffPatch_0300
1017 * @tc.name: ApplyDiffPatch
1018 * @tc.desc: Test whether ApplyDiffPatch is called normally.(newSoPath is empty)
1019 */
1020 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ApplyDiffPatch_0300, TestSize.Level1)
1021 {
1022 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ApplyDiffPatch_0300 start";
1023 std::string oldSoPath = OLD_SO_PATH;
1024 std::string diffFilePath = DIFF_FILE_PATH;
1025 std::string newSoPath = EMPTY_STRING;
1026 ErrCode result = installClient_->ApplyDiffPatch(oldSoPath, diffFilePath, newSoPath, 0);
1027 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1028 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ApplyDiffPatch_0300 end";
1029 }
1030
1031 /**
1032 * @tc.number: BmsInstalldClientTest_ApplyDiffPatch_0400
1033 * @tc.name: ApplyDiffPatch
1034 * @tc.desc: Test whether ApplyDiffPatch is called normally.
1035 */
1036 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ApplyDiffPatch_0400, TestSize.Level1)
1037 {
1038 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ApplyDiffPatch_0400 start";
1039 std::string oldSoPath = OLD_SO_PATH;
1040 std::string diffFilePath = DIFF_FILE_PATH;
1041 std::string newSoPath = NEW_SO_PATH;
1042 ErrCode result = installClient_->ApplyDiffPatch(oldSoPath, diffFilePath, newSoPath);
1043 EXPECT_EQ(result, installClient_->CallService(&IInstalld::ApplyDiffPatch, oldSoPath, diffFilePath, newSoPath, 0));
1044 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ApplyDiffPatch_0400 end";
1045 }
1046
1047 /**
1048 * @tc.number: BmsInstalldClientTest_IsExistDir_0100
1049 * @tc.name: IsExistDir
1050 * @tc.desc: Test whether IsExistDir is called normally.
1051 */
1052 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_IsExistDir_0100, TestSize.Level1)
1053 {
1054 GTEST_LOG_(INFO) << "BmsInstalldClientTest_IsExistDir_0100 start";
1055 std::string dir = DIR;
1056 bool isExist = true;
1057 ErrCode result = installClient_->IsExistDir(dir, isExist);
1058 EXPECT_EQ(result, installClient_->CallService(&IInstalld::IsExistDir, dir, isExist));
1059 GTEST_LOG_(INFO) << "BmsInstalldClientTest_IsExistDir_0100 end";
1060 }
1061
1062 /**
1063 * @tc.number: BmsInstalldClientTest_IsDirEmpty_0100
1064 * @tc.name: IsDirEmpty
1065 * @tc.desc: Test whether IsDirEmpty is called normally.
1066 */
1067 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_IsDirEmpty_0100, TestSize.Level1)
1068 {
1069 GTEST_LOG_(INFO) << "BmsInstalldClientTest_IsDirEmpty_0100 start";
1070 std::string dir = DIR;
1071 bool isDirEmpty = true;
1072 ErrCode result = installClient_->IsDirEmpty(dir, isDirEmpty);
1073 EXPECT_EQ(result, installClient_->CallService(&IInstalld::IsDirEmpty, dir, isDirEmpty));
1074 GTEST_LOG_(INFO) << "BmsInstalldClientTest_IsDirEmpty_0100 end";
1075 }
1076
1077 /**
1078 * @tc.number: BmsInstalldClientTest_ObtainQuickFixFileDir_0100
1079 * @tc.name: ObtainQuickFixFileDir
1080 * @tc.desc: Test whether ObtainQuickFixFileDir is called normally.
1081 */
1082 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ObtainQuickFixFileDir_0100, TestSize.Level1)
1083 {
1084 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ObtainQuickFixFileDir_0100 start";
1085 std::string dir = DIR;
1086 std::vector<std::string> dirVec ;
1087 ErrCode result = installClient_->ObtainQuickFixFileDir(dir, dirVec);
1088 EXPECT_EQ(result, installClient_->CallService(&IInstalld::ObtainQuickFixFileDir, dir, dirVec));
1089 GTEST_LOG_(INFO) << "BmsInstalldClientTest_ObtainQuickFixFileDir_0100 end";
1090 }
1091
1092 /**
1093 * @tc.number: BmsInstalldClientTest_CopyFiles_0100
1094 * @tc.name: CopyFiles
1095 * @tc.desc: Test whether CopyFiles is called normally.
1096 */
1097 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CopyFiles_0100, TestSize.Level1)
1098 {
1099 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CopyFiles_0100 start";
1100 std::string sourceDir = SOURCE_DIR;
1101 std::string destinationDir = DESTINATION_DIR;
1102 ErrCode result = installClient_->CopyFiles(sourceDir, destinationDir);
1103 EXPECT_EQ(result, installClient_->CallService(&IInstalld::CopyFiles, sourceDir, destinationDir));
1104 GTEST_LOG_(INFO) << "BmsInstalldClientTest_CopyFiles_0100 end";
1105 }
1106
1107 /**
1108 * @tc.number: BmsInstalldClientTest_SetEncryptionPolicy_0100
1109 * @tc.name: SetEncryptionPolicy
1110 * @tc.desc: call SetEncryptionPolicy.
1111 */
1112 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_SetEncryptionPolicy_0100, TestSize.Level1)
1113 {
1114 std::string keyId = "";
1115 ErrCode result = installClient_->SetEncryptionPolicy(0, "", 100, keyId);
1116 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1117 }
1118
1119 /**
1120 * @tc.number: BmsInstalldClientTest_DeleteEncryptionKeyId_0100
1121 * @tc.name: DeleteEncryptionKeyId
1122 * @tc.desc: call DeleteEncryptionKeyId.
1123 */
1124 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_DeleteEncryptionKeyId_0100, TestSize.Level1)
1125 {
1126 ErrCode result = installClient_->DeleteEncryptionKeyId("", 100);
1127 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1128 }
1129
1130 /**
1131 * @tc.number: BmsInstalldClientTest_ExecuteAOTd_0100
1132 * @tc.name: ExecuteAOT
1133 * @tc.desc: call ExecuteAOT.
1134 */
1135 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExecuteAOTd_0100, TestSize.Level1)
1136 {
1137 AOTArgs aotArgs;
1138 std::vector<uint8_t> pendSignData;
1139 ErrCode result = installClient_->ExecuteAOT(aotArgs, pendSignData);
1140 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1141 }
1142
1143 /**
1144 * @tc.number: BmsInstalldClientTest_PendSignAOT_0100
1145 * @tc.name: PendSignAOT
1146 * @tc.desc: call PendSignAOT.
1147 */
1148 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_PendSignAOT_0100, TestSize.Level1)
1149 {
1150 std::string anFileName;
1151 std::vector<uint8_t> signData;
1152 ErrCode result = installClient_->PendSignAOT(anFileName, signData);
1153 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1154 }
1155
1156 /**
1157 * @tc.number: BmsInstalldClientTest_StopAOT_0100
1158 * @tc.name: StopAOT
1159 * @tc.desc: call StopAOT.
1160 */
1161 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_StopAOT_0100, TestSize.Level1)
1162 {
1163 ErrCode result = installClient_->StopAOT();
1164 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1165 }
1166
1167 /**
1168 * @tc.number: BmsInstalldClientTest_CreateBundleDataDirWithVector_0100
1169 * @tc.name: CreateBundleDataDirWithVector
1170 * @tc.desc: call CreateBundleDataDirWithVector.
1171 */
1172 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CreateBundleDataDirWithVector_0100, TestSize.Level1)
1173 {
1174 std::vector<CreateDirParam> createDirParams;
1175 ErrCode result = installClient_->CreateBundleDataDirWithVector(createDirParams);
1176 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1177 }
1178
1179 /**
1180 * @tc.number: BmsInstalldClientTest_GetDiskUsage_0100
1181 * @tc.name: GetDiskUsage
1182 * @tc.desc: call GetDiskUsage.
1183 */
1184 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_GetDiskUsage_0100, TestSize.Level1)
1185 {
1186 std::string dir;
1187 bool isRealPath = true;
1188 ErrCode result = installClient_->GetDiskUsage(dir, isRealPath);
1189 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1190 }
1191
1192 /**
1193 * @tc.number: BmsInstalldClientTest_GetDiskUsage_0200
1194 * @tc.name: GetDiskUsage
1195 * @tc.desc: call GetDiskUsage.
1196 */
1197 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_GetDiskUsage_0200, TestSize.Level1)
1198 {
1199 std::string dir = "disk.path";
1200 bool isRealPath = true;
1201 ErrCode result = installClient_->GetDiskUsage(dir, isRealPath);
1202 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1203 }
1204
1205 /**
1206 * @tc.number: BmsInstalldClientTest_IsExistFile_0100
1207 * @tc.name: IsExistFile
1208 * @tc.desc: call IsExistFile.
1209 */
1210 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_IsExistFile_0100, TestSize.Level1)
1211 {
1212 std::string path = "path.test";
1213 bool isExist = true;
1214 ErrCode result = installClient_->IsExistFile(path, isExist);
1215 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1216 }
1217
1218 /**
1219 * @tc.number: BmsInstalldClientTest_IsExistApFile_0100
1220 * @tc.name: IsExistApFile
1221 * @tc.desc: call IsExistApFile.
1222 */
1223 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_IsExistApFile_0100, TestSize.Level1)
1224 {
1225 std::string path = "path.test";
1226 bool isExist = true;
1227 ErrCode result = installClient_->IsExistApFile(path, isExist);
1228 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1229 }
1230
1231 /**
1232 * @tc.number: BmsInstalldClientTest_VerifyCodeSignature_0100
1233 * @tc.name: VerifyCodeSignature
1234 * @tc.desc: call VerifyCodeSignature.
1235 */
1236 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_VerifyCodeSignature_0100, TestSize.Level1)
1237 {
1238 CodeSignatureParam codeSignatureParam;
1239 codeSignatureParam.modulePath = "";
1240 ErrCode result = installClient_->VerifyCodeSignature(codeSignatureParam);
1241 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1242 }
1243
1244 /**
1245 * @tc.number: BmsInstalldClientTest_VerifyCodeSignature_0200
1246 * @tc.name: VerifyCodeSignature
1247 * @tc.desc: call VerifyCodeSignature.
1248 */
1249 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_VerifyCodeSignature_0200, TestSize.Level1)
1250 {
1251 CodeSignatureParam codeSignatureParam;
1252 codeSignatureParam.modulePath = "module.path";
1253 ErrCode result = installClient_->VerifyCodeSignature(codeSignatureParam);
1254 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1255 }
1256
1257 /**
1258 * @tc.number: BmsInstalldClientTest_CheckEncryption_0100
1259 * @tc.name: CheckEncryption
1260 * @tc.desc: call CheckEncryption.
1261 */
1262 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CheckEncryption_0100, TestSize.Level1)
1263 {
1264 CheckEncryptionParam checkEncryptionParam;
1265 checkEncryptionParam.modulePath = "";
1266 bool isEncryption = true;
1267 ErrCode result = installClient_->CheckEncryption(checkEncryptionParam, isEncryption);
1268 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1269 }
1270
1271 /**
1272 * @tc.number: BmsInstalldClientTest_CheckEncryption_0200
1273 * @tc.name: CheckEncryption
1274 * @tc.desc: call CheckEncryption.
1275 */
1276 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CheckEncryption_0200, TestSize.Level1)
1277 {
1278 CheckEncryptionParam checkEncryptionParam;
1279 checkEncryptionParam.modulePath = "module.path";
1280 bool isEncryption = true;
1281 ErrCode result = installClient_->CheckEncryption(checkEncryptionParam, isEncryption);
1282 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1283 }
1284
1285 /**
1286 * @tc.number: BmsInstalldClientTest_MoveFiles_0100
1287 * @tc.name: MoveFiles
1288 * @tc.desc: call MoveFiles.
1289 */
1290 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_MoveFiles_0100, TestSize.Level1)
1291 {
1292 CheckEncryptionParam checkEncryptionParam;
1293 bool isEncryption;
1294 ErrCode result = installClient_->CheckEncryption(checkEncryptionParam, isEncryption);
1295 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1296 }
1297
1298 /**
1299 * @tc.number: BmsInstalldClientTest_MoveFiles_0200
1300 * @tc.name: MoveFiles
1301 * @tc.desc: call MoveFiles.
1302 */
1303 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_MoveFiles_0200, TestSize.Level1)
1304 {
1305 CheckEncryptionParam checkEncryptionParam;
1306 checkEncryptionParam.modulePath = "module.path";
1307 bool isEncryption = true;
1308 ErrCode result = installClient_->CheckEncryption(checkEncryptionParam, isEncryption);
1309 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1310 }
1311
1312 /**
1313 * @tc.number: BmsInstalldClientTest_ExtractDriverSoFiles_0100
1314 * @tc.name: ExtractDriverSoFiles
1315 * @tc.desc: call ExtractDriverSoFiles.
1316 */
1317 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractDriverSoFiles_0100, TestSize.Level1)
1318 {
1319 std::string srcPath;
1320 std::unordered_multimap<std::string, std::string> dirMap;
1321 ErrCode result = installClient_->ExtractDriverSoFiles(srcPath, dirMap);
1322 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1323 }
1324
1325 /**
1326 * @tc.number: BmsInstalldClientTest_ExtractDriverSoFiles_0200
1327 * @tc.name: ExtractDriverSoFiles
1328 * @tc.desc: call ExtractDriverSoFiles.
1329 */
1330 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractDriverSoFiles_0200, TestSize.Level1)
1331 {
1332 std::string srcPath = "src.path";
1333 std::unordered_multimap<std::string, std::string> dirMap;
1334 dirMap.insert(std::make_pair("key", "val1"));
1335 ErrCode result = installClient_->ExtractDriverSoFiles(srcPath, dirMap);
1336 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1337 }
1338
1339 /**
1340 * @tc.number: BmsInstalldClientTest_VerifyCodeSignatureForHap_0100
1341 * @tc.name: VerifyCodeSignatureForHap
1342 * @tc.desc: call VerifyCodeSignatureForHap.
1343 */
1344 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_VerifyCodeSignatureForHap_0100, TestSize.Level1)
1345 {
1346 CodeSignatureParam codeSignatureParam;
1347 ErrCode result = installClient_->VerifyCodeSignatureForHap(codeSignatureParam);
1348 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1349 }
1350
1351 /**
1352 * @tc.number: BmsInstalldClientTest_VerifyCodeSignatureForHap_0200
1353 * @tc.name: VerifyCodeSignatureForHap
1354 * @tc.desc: call VerifyCodeSignatureForHap.
1355 */
1356 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_VerifyCodeSignatureForHap_0200, TestSize.Level1)
1357 {
1358 CodeSignatureParam codeSignatureParam;
1359 codeSignatureParam.modulePath = "module.path";
1360 ErrCode result = installClient_->VerifyCodeSignatureForHap(codeSignatureParam);
1361 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1362 }
1363
1364 /**
1365 * @tc.number: BmsInstalldClientTest_DeliverySignProfile_0100
1366 * @tc.name: DeliverySignProfile
1367 * @tc.desc: call DeliverySignProfile.
1368 */
1369 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_DeliverySignProfile_0100, TestSize.Level1)
1370 {
1371 std::string bundleName;
1372 int32_t profileBlockLength = 0;
1373 unsigned char *profileBlock = new unsigned char[0];
1374 ErrCode result = installClient_->DeliverySignProfile(bundleName, profileBlockLength, profileBlock);
1375 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1376 }
1377
1378 /**
1379 * @tc.number: BmsInstalldClientTest_DeliverySignProfile_0200
1380 * @tc.name: DeliverySignProfile
1381 * @tc.desc: call DeliverySignProfile.
1382 */
1383 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_DeliverySignProfile_0200, TestSize.Level1)
1384 {
1385 std::string bundleName = "bundleName";
1386 int32_t profileBlockLength = 1;
1387 unsigned char *profileBlock = new unsigned char[1];
1388 ErrCode result = installClient_->DeliverySignProfile(bundleName, profileBlockLength, profileBlock);
1389 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1390 }
1391
1392 /**
1393 * @tc.number: BmsInstalldClientTest_StartInstalldService_0100
1394 * @tc.name: StartInstalldService
1395 * @tc.desc: call StartInstalldService.
1396 */
1397 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_StartInstalldService_0100, TestSize.Level1)
1398 {
1399 bool result = installClient_->StartInstalldService();
1400 EXPECT_FALSE(result);
1401 }
1402
1403 /**
1404 * @tc.number: BmsInstalldClientTest_ExtractEncryptedSoFiles_0100
1405 * @tc.name: ExtractEncryptedSoFiles
1406 * @tc.desc: call ExtractEncryptedSoFiles.
1407 */
1408 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractEncryptedSoFiles_0100, TestSize.Level1)
1409 {
1410 std::string hapPath;
1411 const std::string realSoFilesPath;
1412 const std::string cpuAbi;
1413 std::string tmpSoPath;
1414 int32_t uid = -1;
1415 ErrCode result = installClient_->ExtractEncryptedSoFiles(hapPath,
1416 realSoFilesPath, cpuAbi, tmpSoPath, uid);
1417 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1418 }
1419
1420 /**
1421 * @tc.number: BmsInstalldClientTest_ExtractEncryptedSoFiles_0200
1422 * @tc.name: ExtractEncryptedSoFiles
1423 * @tc.desc: call ExtractEncryptedSoFiles.
1424 */
1425 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_ExtractEncryptedSoFiles_0200, TestSize.Level1)
1426 {
1427 std::string hapPath = "hap.path";
1428 const std::string realSoFilesPath = "realSofiles.path";
1429 const std::string cpuAbi = "cpuabi";
1430 std::string tmpSoPath = "tmpso.path";
1431 int32_t uid = 100;
1432 ErrCode result = installClient_->ExtractEncryptedSoFiles(hapPath,
1433 realSoFilesPath, cpuAbi, tmpSoPath, uid);
1434 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1435 }
1436
1437 /**
1438 * @tc.number: BmsInstalldClientTest_RemoveExtensionDir_0100
1439 * @tc.name: RemoveExtensionDir
1440 * @tc.desc: call RemoveExtensionDir.
1441 */
1442 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_RemoveExtensionDir_0100, TestSize.Level1)
1443 {
1444 int32_t userId = -1;
1445 const std::vector<std::string> extensionBundleDirs;
1446 ErrCode result = installClient_->RemoveExtensionDir(userId, extensionBundleDirs);
1447 EXPECT_EQ(result, ERR_OK);
1448 }
1449
1450 /**
1451 * @tc.number: BmsInstalldClientTest_RemoveExtensionDir_0200
1452 * @tc.name: RemoveExtensionDir
1453 * @tc.desc: call RemoveExtensionDir.
1454 */
1455 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_RemoveExtensionDir_0200, TestSize.Level1)
1456 {
1457 int32_t userId = 100;
1458 std::vector<std::string> extensionBundleDirs;
1459 extensionBundleDirs.push_back("com.bundleName.extension");
1460 ErrCode result = installClient_->RemoveExtensionDir(userId, extensionBundleDirs);
1461 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1462 }
1463
1464 /**
1465 * @tc.number: BmsInstalldClientTest_IsExistExtensionDir_0100
1466 * @tc.name: IsExistExtensionDir
1467 * @tc.desc: call IsExistExtensionDir.
1468 */
1469 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_IsExistExtensionDir_0100, TestSize.Level1)
1470 {
1471 int32_t userId = -1;
1472 std::string extensionBundleDir;
1473 bool isExist;
1474 ErrCode result = installClient_->IsExistExtensionDir(userId, extensionBundleDir, isExist);
1475 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1476 }
1477
1478 /**
1479 * @tc.number: BmsInstalldClientTest_IsExistExtensionDir_0200
1480 * @tc.name: IsExistExtensionDir
1481 * @tc.desc: call IsExistExtensionDir.
1482 */
1483 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_IsExistExtensionDir_0200, TestSize.Level1)
1484 {
1485 int32_t userId = 100;
1486 std::string extensionBundleDir = "com.extension.bundle";
1487 bool isExist = true;
1488 ErrCode result = installClient_->IsExistExtensionDir(userId, extensionBundleDir, isExist);
1489 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1490 }
1491
1492 /**
1493 * @tc.number: BmsInstalldClientTest_CreateExtensionDataDir_0100
1494 * @tc.name: CreateExtensionDataDir
1495 * @tc.desc: call CreateExtensionDataDir.
1496 */
1497 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CreateExtensionDataDir_0100, TestSize.Level1)
1498 {
1499 CreateDirParam createDirParam;
1500 ErrCode result = installClient_->CreateExtensionDataDir(createDirParam);
1501 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1502 }
1503
1504 /**
1505 * @tc.number: BmsInstalldClientTest_CreateExtensionDataDir_0200
1506 * @tc.name: CreateExtensionDataDir
1507 * @tc.desc: call CreateExtensionDataDir.
1508 */
1509 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_CreateExtensionDataDir_0200, TestSize.Level1)
1510 {
1511 CreateDirParam createDirParam;
1512 createDirParam.bundleName = "bundleName";
1513 createDirParam.userId = 100;
1514 createDirParam.uid = 100;
1515 createDirParam.gid = 100;
1516 createDirParam.extensionDirs.push_back("com.acts.extension");
1517 ErrCode result = installClient_->CreateExtensionDataDir(createDirParam);
1518 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1519 }
1520
1521 /**
1522 * @tc.number: BmsInstalldClientTest_GetAllBundleStats_0100
1523 * @tc.name: GetAllBundleStats
1524 * @tc.desc: call GetAllBundleStats.
1525 */
1526 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_GetAllBundleStats_0100, TestSize.Level1)
1527 {
1528 int32_t userId = 100;
1529 std::vector<int64_t> bundleStats;
1530 std::vector<int32_t> uids;
1531 ErrCode result = installClient_->GetAllBundleStats(userId, bundleStats, uids);
1532 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1533 }
1534
1535 /**
1536 * @tc.number: BmsInstalldClientTest_GetAllBundleStats_0200
1537 * @tc.name: GetAllBundleStats
1538 * @tc.desc: call GetAllBundleStats.
1539 */
1540 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_GetAllBundleStats_0200, TestSize.Level1)
1541 {
1542 int32_t userId = 100;
1543 std::vector<int64_t> bundleStats;
1544 std::vector<int32_t> uids;
1545 ErrCode result = installClient_->GetAllBundleStats(userId, bundleStats, uids);
1546 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1547 }
1548
1549 /**
1550 * @tc.number: BmsInstalldClientTest_GetAllBundleStats_0300
1551 * @tc.name: GetAllBundleStats
1552 * @tc.desc: call GetAllBundleStats.
1553 */
1554 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_GetAllBundleStats_0300, TestSize.Level1)
1555 {
1556 int32_t userId = 100;
1557 std::vector<int64_t> bundleStats;
1558 std::vector<int32_t> uids;
1559 uids.push_back(100);
1560 uids.push_back(101);
1561 ErrCode result = installClient_->GetAllBundleStats(userId, bundleStats, uids);
1562 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1563 }
1564
1565 /**
1566 * @tc.number: BmsInstalldClientTest_RemoveSignProfile_0100
1567 * @tc.name: RemoveSignProfile
1568 * @tc.desc: call RemoveSignProfile.
1569 */
1570 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_RemoveSignProfile_0100, TestSize.Level1)
1571 {
1572 std::string bundleName;
1573 ErrCode result = installClient_->RemoveSignProfile(bundleName);
1574 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_PARAM_ERROR);
1575 }
1576
1577 /**
1578 * @tc.number: BmsInstalldClientTest_RemoveSignProfile_0200
1579 * @tc.name: RemoveSignProfile
1580 * @tc.desc: call RemoveSignProfile.
1581 */
1582 HWTEST_F(BmsInstalldClientTest, BmsInstalldClientTest_RemoveSignProfile_0200, TestSize.Level1)
1583 {
1584 std::string bundleName = "com.acts.settings";
1585 ErrCode result = installClient_->RemoveSignProfile(bundleName);
1586 EXPECT_EQ(result, ERR_APPEXECFWK_INSTALLD_GET_PROXY_ERROR);
1587 }
1588 } // namespace AppExecFwk
1589 } // namespace OHOS
1590