• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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 #define private public
17 #define protected public
18 
19 #include <fstream>
20 #include <gtest/gtest.h>
21 #include <sstream>
22 #include <string>
23 
24 #include "appexecfwk_errors.h"
25 #include "bundle_info.h"
26 #include "bundle_mgr_service.h"
27 #include "directory_ex.h"
28 #include "file_ex.h"
29 #include "if_system_ability_manager.h"
30 #include "inner_app_quick_fix.h"
31 #include "inner_bundle_info.h"
32 #include "installd/installd_service.h"
33 #include "installd_client.h"
34 #include "iservice_registry.h"
35 #include "mock_quick_fix_callback.h"
36 #include "mock_status_receiver.h"
37 #include "quick_fix_data_mgr.h"
38 #include "quick_fix_deleter.h"
39 #include "quick_fix_deployer.h"
40 #include "quick_fix_manager_proxy.h"
41 #include "quick_fix_switcher.h"
42 #include "quick_fix_checker.h"
43 #include "quick_fix_status_callback_proxy.h"
44 #include "quick_fix/patch_parser.h"
45 #include "quick_fix/patch_profile.h"
46 #include "quick_fix/quick_fix_boot_scanner.h"
47 #include "quick_fix/quick_fix_manager_rdb.h"
48 #include "quick_fix/quick_fix_mgr.h"
49 #include "quick_fix/quick_fixer.h"
50 #include "system_ability_definition.h"
51 
52 using namespace testing::ext;
53 using namespace std::chrono_literals;
54 using namespace OHOS;
55 using namespace OHOS::AppExecFwk;
56 using namespace OHOS::Security;
57 
58 namespace OHOS {
59 namespace {
60 const std::string BUNDLE_NAME = "com.example.bmsaccesstoken1";
61 const std::string BUNDLE_NAME_DEMO = "com.example.demo.bmsaccesstoken1";
62 const std::string HAP_FILE_PATH1 = "/data/test/resource/bms/quick_fix/bmsAccessTokentest1.hap";
63 const std::string HAP_FILE_PATH2 = "/data/test/resource/bms/quick_fix/bmsAccessTokentest3.hap";
64 const std::string HQF_FILE_PATH1 = "/data/test/resource/bms/quick_fix/bmsAccessTokentest1.hqf";
65 const std::string HAP_PATH_TEST_RAW_FILE = "/data/test/resource/bms/quick_fix/driver_feature_hap.hap";
66 const int32_t USERID = 100;
67 const int32_t WAIT_TIME = 5; // init mocked bms
68 const std::string QUICK_FIX_ABI = "arms";
69 const std::string QUICK_FIX_SO_PATH = "libs/arms";
70 const uint32_t QUICK_FIX_VERSION_CODE = 1;
71 const uint32_t BUNDLE_VERSION_CODE = 1;
72 const std::string QUICK_FIX_VERSION_NAME = "1.0";
73 const std::string BUNDLE_VERSION_NAME = "1.0";
74 const std::string PROVISION_TYPE_DEBUG = "debug";
75 const std::string PROVISION_TYPE_RELEASE = "release";
76 const std::string RESULT_CODE = "resultCode";
77 const std::string PATCH_PATH = "patch_1";
78 const std::string MODULE_NAME = "entry";
79 const std::string FILE1_PATH = "/data/test/hello.hqf";
80 const std::string FILE2_PATH = "/data/test/world.hqf";
81 const std::string FILE3_PATH = "/data/test/world.hap";
82 const std::string INVALID_FILE_SUFFIX_PATH = "/data/test/invalidSuffix.txt";
83 const std::string INVALID_FILE_PATH_1 = "/data/service/el1/public/bms/bundle_manager_service/hello.hqf";
84 const std::string INVALID_FILE_PATH_2 = "/data/service/el1/public/bms/bundle_manager_service/quick_fix/../hello.hqf";
85 const std::string VALID_FILE_PATH_3 = "/data/service/el1/public/bms/bundle_manager_service/quick_fix/hello.hqf";
86 const std::string VALID_FILE_PATH_4 = "../";
87 const std::string INVALID_FILE_NAME = "..hello.hqf";
88 const std::string VALID_FILE_NAME = "hello.hqf";
89 const int32_t ERR_CODE = 8388613;
90 }  // namespace
91 
92 class BmsBundleQuickFixTest : public testing::Test {
93 public:
94     BmsBundleQuickFixTest();
95     ~BmsBundleQuickFixTest();
96     static void SetUpTestCase();
97     static void TearDownTestCase();
98     void SetUp();
99     void TearDown();
100     ErrCode InstallBundle(const std::string &bundlePath) const;
101     ErrCode UpdateBundle(const std::string &bundlePath) const;
102     ErrCode UnInstallBundle(const std::string &bundleName) const;
103     void AddInnerBundleInfo(const std::string bundleName, const std::string provisionType = PROVISION_TYPE_RELEASE,
104         QuickFixType type = QuickFixType::PATCH);
105     void UninstallBundleInfo(const std::string bundleName);
106     const std::shared_ptr<BundleDataMgr> GetBundleDataMgr() const;
107     const std::shared_ptr<QuickFixDeployer> GetQuickFixDeployer(bool isDebug = false);
108     const std::shared_ptr<QuickFixDeleter> GetQuickFixDeleter();
109     const std::shared_ptr<QuickFixSwitcher> GetQuickFixSwitcher();
110     const std::shared_ptr<QuickFixDataMgr> GetQuickFixDataMgr() const;
111     AppQuickFix CreateAppQuickFix();
112     void StartInstalldService() const;
113     void StartBundleService();
114     sptr<IQuickFixManager> GetQuickFixManagerProxy();
115     void CreateFiles(const std::vector<std::string>& sourceFiles);
116     void DeleteFiles(const std::vector<std::string>& destFiles);
117     void ClearDataMgr();
118     void ResetDataMgr();
119 
120 private:
121     static std::shared_ptr<InstalldService> installdService_;
122     static std::shared_ptr<BundleMgrService> bundleMgrService_;
123     std::shared_ptr<QuickFixDeployer> deployer_ = nullptr;
124     std::shared_ptr<QuickFixDeleter> deleter_ = nullptr;
125     std::shared_ptr<QuickFixSwitcher> switcher_ = nullptr;
126     static std::shared_ptr<QuickFixDataMgr> quickFixDataMgr_;
127 };
128 
129 std::shared_ptr<BundleMgrService> BmsBundleQuickFixTest::bundleMgrService_ =
130     DelayedSingleton<BundleMgrService>::GetInstance();
131 
132 std::shared_ptr<InstalldService> BmsBundleQuickFixTest::installdService_ =
133     std::make_shared<InstalldService>();
134 
135 std::shared_ptr<QuickFixDataMgr> BmsBundleQuickFixTest::quickFixDataMgr_ =
136     DelayedSingleton<QuickFixDataMgr>::GetInstance();
137 
BmsBundleQuickFixTest()138 BmsBundleQuickFixTest::BmsBundleQuickFixTest()
139 {}
140 
~BmsBundleQuickFixTest()141 BmsBundleQuickFixTest::~BmsBundleQuickFixTest()
142 {}
143 
SetUpTestCase()144 void BmsBundleQuickFixTest::SetUpTestCase()
145 {}
146 
TearDownTestCase()147 void BmsBundleQuickFixTest::TearDownTestCase()
148 {
149     bundleMgrService_->OnStop();
150 }
151 
SetUp()152 void BmsBundleQuickFixTest::SetUp()
153 {
154     StartInstalldService();
155     StartBundleService();
156     auto dataMgr = GetBundleDataMgr();
157     if (dataMgr != nullptr) {
158         dataMgr->AddUserId(USERID);
159     }
160 }
161 
TearDown()162 void BmsBundleQuickFixTest::TearDown()
163 {}
164 
ClearDataMgr()165 void BmsBundleQuickFixTest::ClearDataMgr()
166 {
167     bundleMgrService_->dataMgr_ = nullptr;
168 }
169 
ResetDataMgr()170 void BmsBundleQuickFixTest::ResetDataMgr()
171 {
172     bundleMgrService_->dataMgr_ = std::make_shared<BundleDataMgr>();
173     EXPECT_NE(bundleMgrService_->dataMgr_, nullptr);
174 }
175 
InstallBundle(const std::string & bundlePath) const176 ErrCode BmsBundleQuickFixTest::InstallBundle(const std::string &bundlePath) const
177 {
178     if (!bundleMgrService_) {
179         return ERR_APPEXECFWK_INSTALL_INTERNAL_ERROR;
180     }
181     auto installer = bundleMgrService_->GetBundleInstaller();
182     if (!installer) {
183         EXPECT_FALSE(true) << "the installer is nullptr";
184         return ERR_APPEXECFWK_INSTALL_INTERNAL_ERROR;
185     }
186     sptr<MockStatusReceiver> receiver = new (std::nothrow) MockStatusReceiver();
187     if (!receiver) {
188         EXPECT_FALSE(true) << "the receiver is nullptr";
189         return ERR_APPEXECFWK_INSTALL_INTERNAL_ERROR;
190     }
191     InstallParam installParam;
192     installParam.installFlag = InstallFlag::NORMAL;
193     installParam.userId = USERID;
194     installParam.withCopyHaps = true;
195     bool result = installer->Install(bundlePath, installParam, receiver);
196     EXPECT_TRUE(result);
197     return receiver->GetResultCode();
198 }
199 
UpdateBundle(const std::string & bundlePath) const200 ErrCode BmsBundleQuickFixTest::UpdateBundle(const std::string &bundlePath) const
201 {
202     if (!bundleMgrService_) {
203         return ERR_APPEXECFWK_INSTALL_INTERNAL_ERROR;
204     }
205     auto installer = bundleMgrService_->GetBundleInstaller();
206     if (!installer) {
207         EXPECT_FALSE(true) << "the installer is nullptr";
208         return ERR_APPEXECFWK_INSTALL_INTERNAL_ERROR;
209     }
210     sptr<MockStatusReceiver> receiver = new (std::nothrow) MockStatusReceiver();
211     if (!receiver) {
212         EXPECT_FALSE(true) << "the receiver is nullptr";
213         return ERR_APPEXECFWK_INSTALL_INTERNAL_ERROR;
214     }
215     InstallParam installParam;
216     installParam.installFlag = InstallFlag::REPLACE_EXISTING;
217     installParam.userId = USERID;
218     installParam.withCopyHaps = true;
219     bool result = installer->Install(bundlePath, installParam, receiver);
220     EXPECT_TRUE(result);
221     return receiver->GetResultCode();
222 }
223 
UnInstallBundle(const std::string & bundleName) const224 ErrCode BmsBundleQuickFixTest::UnInstallBundle(const std::string &bundleName) const
225 {
226     if (!bundleMgrService_) {
227         return ERR_APPEXECFWK_UNINSTALL_BUNDLE_MGR_SERVICE_ERROR;
228     }
229     auto installer = bundleMgrService_->GetBundleInstaller();
230     if (!installer) {
231         EXPECT_FALSE(true) << "the installer is nullptr";
232         return ERR_APPEXECFWK_INSTALL_INTERNAL_ERROR;
233     }
234     sptr<MockStatusReceiver> receiver = new (std::nothrow) MockStatusReceiver();
235     if (!receiver) {
236         EXPECT_FALSE(true) << "the receiver is nullptr";
237         return ERR_APPEXECFWK_INSTALL_INTERNAL_ERROR;
238     }
239     InstallParam installParam;
240     installParam.installFlag = InstallFlag::NORMAL;
241     installParam.userId = USERID;
242     bool result = installer->Uninstall(bundleName, installParam, receiver);
243     EXPECT_TRUE(result);
244     return receiver->GetResultCode();
245 }
246 
AddInnerBundleInfo(const std::string bundleName,const std::string provisionType,QuickFixType type)247 void BmsBundleQuickFixTest::AddInnerBundleInfo(const std::string bundleName,
248     const std::string provisionType,
249     QuickFixType type)
250 {
251     BundleInfo bundleInfo;
252     bundleInfo.name = bundleName;
253     AppqfInfo deployedAppqfInfo;
254     deployedAppqfInfo.versionCode = QUICK_FIX_VERSION_CODE;
255     deployedAppqfInfo.versionName =  QUICK_FIX_VERSION_NAME;
256     deployedAppqfInfo.cpuAbi = QUICK_FIX_ABI;
257     deployedAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
258     deployedAppqfInfo.type = type;
259     bundleInfo.versionCode = BUNDLE_VERSION_CODE;
260     bundleInfo.versionName = BUNDLE_VERSION_NAME;
261 
262     ApplicationInfo applicationInfo;
263     applicationInfo.name = bundleName;
264     if (provisionType == PROVISION_TYPE_DEBUG) {
265         applicationInfo.debug = true;
266         applicationInfo.appProvisionType = PROVISION_TYPE_DEBUG;
267         deployedAppqfInfo.hqfInfos.push_back(HqfInfo());
268     }
269     applicationInfo.appQuickFix.deployedAppqfInfo = deployedAppqfInfo;
270     applicationInfo.appQuickFix.deployingAppqfInfo = deployedAppqfInfo;
271     applicationInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
272     InnerBundleUserInfo userInfo;
273     userInfo.bundleName = bundleName;
274     userInfo.bundleUserInfo.userId = USERID;
275 
276     InnerModuleInfo moduleInfo;
277     moduleInfo.moduleName = bundleName;
278     moduleInfo.name = bundleName;
279     moduleInfo.modulePackage = bundleName;
280 
281     InnerBundleInfo innerBundleInfo;
282     innerBundleInfo.SetBaseBundleInfo(bundleInfo);
283     innerBundleInfo.SetBaseApplicationInfo(applicationInfo);
284     innerBundleInfo.AddInnerBundleUserInfo(userInfo);
285     innerBundleInfo.InsertInnerModuleInfo(bundleName, moduleInfo);
286 
287     auto dataMgr = GetBundleDataMgr();
288     EXPECT_NE(dataMgr, nullptr);
289 
290     bool startRet = dataMgr->UpdateBundleInstallState(bundleName, InstallState::INSTALL_START);
291     bool addRet = dataMgr->AddInnerBundleInfo(bundleName, innerBundleInfo);
292     bool endRet = dataMgr->UpdateBundleInstallState(bundleName, InstallState::INSTALL_SUCCESS);
293 
294     EXPECT_TRUE(startRet);
295     EXPECT_TRUE(addRet);
296     EXPECT_TRUE(endRet);
297 }
298 
UninstallBundleInfo(const std::string bundleName)299 void BmsBundleQuickFixTest::UninstallBundleInfo(const std::string bundleName)
300 {
301     auto dataMgr = GetBundleDataMgr();
302     EXPECT_NE(dataMgr, nullptr);
303     bool startRet = dataMgr->UpdateBundleInstallState(bundleName, InstallState::UNINSTALL_START);
304     bool finishRet = dataMgr->UpdateBundleInstallState(bundleName, InstallState::UNINSTALL_SUCCESS);
305 
306     EXPECT_TRUE(startRet);
307     EXPECT_TRUE(finishRet);
308 }
309 
StartInstalldService() const310 void BmsBundleQuickFixTest::StartInstalldService() const
311 {
312     if (!installdService_->IsServiceReady()) {
313         installdService_->Start();
314     }
315 }
316 
StartBundleService()317 void BmsBundleQuickFixTest::StartBundleService()
318 {
319     if (!bundleMgrService_->IsServiceReady()) {
320         bundleMgrService_->OnStart();
321         bundleMgrService_->GetDataMgr()->AddUserId(USERID);
322         std::this_thread::sleep_for(std::chrono::seconds(WAIT_TIME));
323     }
324 }
325 
GetBundleDataMgr() const326 const std::shared_ptr<BundleDataMgr> BmsBundleQuickFixTest::GetBundleDataMgr() const
327 {
328     return bundleMgrService_->GetDataMgr();
329 }
330 
GetQuickFixDeployer(bool isDebug)331 const std::shared_ptr<QuickFixDeployer> BmsBundleQuickFixTest::GetQuickFixDeployer(bool isDebug)
332 {
333     if (deployer_ == nullptr) {
334         std::vector<std::string> path;
335         deployer_ = std::make_shared<QuickFixDeployer>(path, isDebug);
336     }
337     return deployer_;
338 }
339 
GetQuickFixDeleter()340 const std::shared_ptr<QuickFixDeleter> BmsBundleQuickFixTest::GetQuickFixDeleter()
341 {
342     if (deleter_ == nullptr) {
343         deleter_ = std::make_shared<QuickFixDeleter>(BUNDLE_NAME);
344     }
345     return deleter_;
346 }
347 
GetQuickFixSwitcher()348 const std::shared_ptr<QuickFixSwitcher> BmsBundleQuickFixTest::GetQuickFixSwitcher()
349 {
350     if (switcher_ == nullptr) {
351         switcher_ = std::make_shared<QuickFixSwitcher>(BUNDLE_NAME, true);
352     }
353     return switcher_;
354 }
355 
GetQuickFixDataMgr() const356 const std::shared_ptr<QuickFixDataMgr> BmsBundleQuickFixTest::GetQuickFixDataMgr() const
357 {
358     return quickFixDataMgr_;
359 }
360 
CreateAppQuickFix()361 AppQuickFix BmsBundleQuickFixTest::CreateAppQuickFix()
362 {
363     AppqfInfo appInfo;
364     appInfo.versionCode = QUICK_FIX_VERSION_CODE;
365     appInfo.versionName = QUICK_FIX_VERSION_NAME;
366     appInfo.type = QuickFixType::PATCH;
367     HqfInfo hqfInfo;
368     hqfInfo.moduleName = "entry";
369     hqfInfo.type = QuickFixType::PATCH;
370     appInfo.hqfInfos.push_back(hqfInfo);
371     AppQuickFix appQuickFix;
372     appQuickFix.bundleName = BUNDLE_NAME;
373     appQuickFix.versionCode = BUNDLE_VERSION_CODE;
374     appQuickFix.versionName = BUNDLE_VERSION_NAME;
375     appQuickFix.deployingAppqfInfo = appInfo;
376     return appQuickFix;
377 }
378 
GetQuickFixManagerProxy()379 sptr<IQuickFixManager> BmsBundleQuickFixTest::GetQuickFixManagerProxy()
380 {
381     return bundleMgrService_->GetQuickFixManagerProxy();
382 }
383 
CreateFiles(const std::vector<std::string> & sourceFiles)384 void BmsBundleQuickFixTest::CreateFiles(const std::vector<std::string>& sourceFiles)
385 {
386     for (const auto& path : sourceFiles) {
387         SaveStringToFile(path, path);
388     }
389 }
390 
DeleteFiles(const std::vector<std::string> & destFiles)391 void BmsBundleQuickFixTest::DeleteFiles(const std::vector<std::string>& destFiles)
392 {
393     for (const auto& path : destFiles) {
394         RemoveFile(path);
395     }
396 }
397 
398 /**
399  * @tc.number: BmsBundleQuickFixTest_0001
400  * Function: CheckAppQuickFixInfos
401  * @tc.name: test QuickFixChecker
402  * @tc.require: issueI5N7AD
403  * @tc.desc: 1. check bundle name not same
404  */
405 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0001, Function | SmallTest | Level0)
406 {
407     std::unordered_map<std::string, AppQuickFix> infos;
408     AppQuickFix appQuickFix = CreateAppQuickFix();
409     infos.emplace("appQuickFix_1", appQuickFix);
410 
411     appQuickFix.bundleName = "wrong_name";
412     infos.emplace("appQuickFix_2", appQuickFix);
413 
414     QuickFixChecker checker;
415     ErrCode ret = checker.CheckAppQuickFixInfos(infos);
416     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_BUNDLE_NAME_NOT_SAME);
417 }
418 
419 /**
420  * @tc.number: BmsBundleQuickFixTest_0002
421  * Function: CheckAppQuickFixInfos
422  * @tc.name: test QuickFixChecker
423  * @tc.require: issueI5N7AD
424  * @tc.desc: 1. check bundle version code not same
425  */
426 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0002, Function | SmallTest | Level0)
427 {
428     std::unordered_map<std::string, AppQuickFix> infos;
429     AppQuickFix appQuickFix = CreateAppQuickFix();
430     infos.emplace("appQuickFix_1", appQuickFix);
431 
432     appQuickFix.deployingAppqfInfo.hqfInfos[0].moduleName = "feature";
433     appQuickFix.versionCode = 20000;
434     infos.emplace("appQuickFix_2", appQuickFix);
435 
436     QuickFixChecker checker;
437     ErrCode ret = checker.CheckAppQuickFixInfos(infos);
438     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_VERSION_CODE_NOT_SAME);
439 }
440 
441 /**
442  * @tc.number: BmsBundleQuickFixTest_0004
443  * Function: CheckAppQuickFixInfos
444  * @tc.name: test QuickFixChecker
445  * @tc.require: issueI5N7AD
446  * @tc.desc: 1. check patch version code not same
447  */
448 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0004, Function | SmallTest | Level0)
449 {
450     std::unordered_map<std::string, AppQuickFix> infos;
451     AppQuickFix appQuickFix = CreateAppQuickFix();
452     infos.emplace("appQuickFix_1", appQuickFix);
453 
454     appQuickFix.deployingAppqfInfo.versionCode = 20000;
455     appQuickFix.deployingAppqfInfo.hqfInfos[0].moduleName = "feature";
456     infos.emplace("appQuickFix_2", appQuickFix);
457 
458     QuickFixChecker checker;
459     ErrCode ret = checker.CheckAppQuickFixInfos(infos);
460     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PATCH_VERSION_CODE_NOT_SAME);
461 }
462 
463 /**
464  * @tc.number: BmsBundleQuickFixTest_0006
465  * Function: CheckAppQuickFixInfos
466  * @tc.name: test QuickFixChecker
467  * @tc.require: issueI5N7AD
468  * @tc.desc: 1. check patch version code not same
469  */
470 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0006, Function | SmallTest | Level0)
471 {
472     std::unordered_map<std::string, AppQuickFix> infos;
473     AppQuickFix appQuickFix = CreateAppQuickFix();
474     infos.emplace("appQuickFix_1", appQuickFix);
475 
476     appQuickFix.deployingAppqfInfo.type = QuickFixType::HOT_RELOAD;
477     appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::HOT_RELOAD;
478     appQuickFix.deployingAppqfInfo.hqfInfos[0].moduleName = "feature";
479     infos.emplace("appQuickFix_2", appQuickFix);
480 
481     QuickFixChecker checker;
482     ErrCode ret = checker.CheckAppQuickFixInfos(infos);
483     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PATCH_TYPE_NOT_SAME);
484 }
485 
486 /**
487  * @tc.number: BmsBundleQuickFixTest_0005
488  * Function: CheckAppQuickFixInfos
489  * @tc.name: test QuickFixChecker
490  * @tc.require: issueI5N7AD
491  * @tc.desc: 1. check patch version code not same
492  */
493 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0005, Function | SmallTest | Level0)
494 {
495     std::unordered_map<std::string, AppQuickFix> infos;
496     AppQuickFix appQuickFix = CreateAppQuickFix();
497     infos.emplace("appQuickFix_1", appQuickFix);
498 
499     appQuickFix.deployingAppqfInfo.type = QuickFixType::PATCH;
500     appQuickFix.deployingAppqfInfo.hqfInfos.clear();
501     infos.emplace("appQuickFix_2", appQuickFix);
502 
503     QuickFixChecker checker;
504     ErrCode ret = checker.CheckAppQuickFixInfos(infos);
505     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PROFILE_PARSE_FAILED);
506 }
507 
508 
509 /**
510  * @tc.number: BmsBundleQuickFixTest_0007
511  * Function: CheckAppQuickFixInfos
512  * @tc.name: test QuickFixChecker
513  * @tc.require: issueI5N7AD
514  * @tc.desc: 1. check module not same
515  */
516 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0007, Function | SmallTest | Level0)
517 {
518     std::unordered_map<std::string, AppQuickFix> infos;
519     AppQuickFix appQuickFix = CreateAppQuickFix();
520     infos.emplace("appQuickFix_1", appQuickFix);
521     infos.emplace("appQuickFix_2", appQuickFix);
522 
523     QuickFixChecker checker;
524     ErrCode ret = checker.CheckAppQuickFixInfos(infos);
525     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_MODULE_NAME_SAME);
526 }
527 
528 /**
529  * @tc.number: BmsBundleQuickFixTest_0008
530  * Function: CheckAppQuickFixInfos
531  * @tc.name: test QuickFixChecker
532  * @tc.require: issueI5N7AD
533  * @tc.desc: 1. check module not same
534  */
535 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0008, Function | SmallTest | Level0)
536 {
537     std::unordered_map<std::string, AppQuickFix> infos;
538     AppQuickFix appQuickFix = CreateAppQuickFix();
539     infos.emplace("appQuickFix_1", appQuickFix);
540 
541     appQuickFix.deployingAppqfInfo.hqfInfos[0].moduleName = "feature";
542     infos.emplace("appQuickFix_2", appQuickFix);
543 
544     QuickFixChecker checker;
545     ErrCode ret = checker.CheckAppQuickFixInfos(infos);
546     EXPECT_EQ(ret, ERR_OK);
547 }
548 
549 /**
550  * @tc.number: BmsBundleQuickFixTest_0009
551  * Function: Query inner app quick fix
552  * @tc.name: test QuickFixDataMgr
553  * @tc.require: issueI5N7AD
554  * @tc.desc: 1. check module not same
555  */
556 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0009, Function | SmallTest | Level0)
557 {
558     AppQuickFix appQuickFix = CreateAppQuickFix();
559     QuickFixMark mark;
560     mark.bundleName = appQuickFix.bundleName;
561     mark.status = QuickFixStatus::DEPLOY_START;
562     InnerAppQuickFix innerAppQuickFix(appQuickFix, mark);
563 
564     auto deployer = GetQuickFixDeployer();
565     EXPECT_FALSE(deployer == nullptr);
566     ErrCode ret = ERR_OK;
567     if (deployer != nullptr) {
568         ret = deployer->SaveAppQuickFix(innerAppQuickFix);
569         EXPECT_EQ(ret, ERR_OK);
570         auto quickFixMgr = GetQuickFixDataMgr();
571         EXPECT_FALSE(quickFixMgr == nullptr);
572         InnerAppQuickFix tempInnerAppQuickFix;
573         bool query = quickFixMgr->QueryInnerAppQuickFix(appQuickFix.bundleName, tempInnerAppQuickFix);
574         EXPECT_EQ(query, true);
575         EXPECT_EQ(tempInnerAppQuickFix.GetAppQuickFix().bundleName, appQuickFix.bundleName);
576         EXPECT_EQ(tempInnerAppQuickFix.GetAppQuickFix().versionCode, appQuickFix.versionCode);
577         query = quickFixMgr->DeleteInnerAppQuickFix(appQuickFix.bundleName);
578         EXPECT_EQ(query, true);
579     }
580 }
581 
582 /**
583  * @tc.number: BmsBundleQuickFixTest_0010
584  * Function: Query DeployQuickFixResult
585  * @tc.name: test ToDeployQuickFixResult
586  * @tc.require: issueI5N7AD
587  * @tc.desc: parse and check ToDeployQuickFixResult
588  */
589 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0010, Function | SmallTest | Level0)
590 {
591     auto deployer = GetQuickFixDeployer();
592     EXPECT_FALSE(deployer == nullptr);
593     if (deployer != nullptr) {
594         AppQuickFix appQuickFix = CreateAppQuickFix();
595         deployer->ToDeployQuickFixResult(appQuickFix);
596         DeployQuickFixResult result = deployer->GetDeployQuickFixResult();
597         EXPECT_EQ(result.bundleName, appQuickFix.bundleName);
598         EXPECT_EQ(result.bundleVersionCode, appQuickFix.versionCode);
599         EXPECT_EQ(result.patchVersionCode, appQuickFix.deployingAppqfInfo.versionCode);
600         EXPECT_EQ(result.type, appQuickFix.deployingAppqfInfo.type);
601     }
602 }
603 
604 /**
605  * @tc.number: BmsBundleQuickFixTest_0011
606  * Function: GetBundleInfo
607  * @tc.name: test GetBundleInfo
608  * @tc.require: issueI5N7AD
609  * @tc.desc: GetBundleInfo
610  */
611 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0011, Function | SmallTest | Level0)
612 {
613     auto deployer = GetQuickFixDeployer();
614     EXPECT_FALSE(deployer == nullptr);
615     if (deployer != nullptr) {
616         AppQuickFix appQuickFix = CreateAppQuickFix();
617         BundleInfo bundleInfo;
618         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
619         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_BUNDLE_NAME_NOT_EXIST);
620     }
621 }
622 
623 /**
624  * @tc.number: BmsBundleQuickFixTest_0012
625  * Function: GetBundleInfo
626  * @tc.name: test GetBundleInfo
627  * @tc.require: issueI5N7AD
628  * @tc.desc: GetBundleInfo
629  */
630 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0012, Function | SmallTest | Level0)
631 {
632     ErrCode installResult = InstallBundle(HAP_FILE_PATH1);
633     EXPECT_EQ(installResult, ERR_OK);
634 
635     auto deployer = GetQuickFixDeployer();
636     EXPECT_FALSE(deployer == nullptr);
637     if (deployer != nullptr) {
638         AppQuickFix appQuickFix = CreateAppQuickFix();
639         BundleInfo bundleInfo;
640         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
641         EXPECT_EQ(ret, ERR_OK);
642     }
643 
644     ErrCode unInstallResult = UnInstallBundle(BUNDLE_NAME);
645     EXPECT_EQ(unInstallResult, ERR_OK);
646 }
647 
648 /**
649  * @tc.number: BmsBundleQuickFixTest_0013
650  * Function: GetBundleInfo
651  * @tc.name: test GetBundleInfo
652  * @tc.require: issueI5N7AD
653  * @tc.desc: GetBundleInfo
654  */
655 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0013, Function | SmallTest | Level0)
656 {
657     ErrCode installResult = InstallBundle(HAP_FILE_PATH1);
658     EXPECT_EQ(installResult, ERR_OK);
659 
660     auto deployer = GetQuickFixDeployer();
661     EXPECT_FALSE(deployer == nullptr);
662     if (deployer != nullptr) {
663         AppQuickFix appQuickFix = CreateAppQuickFix();
664         BundleInfo bundleInfo;
665         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
666         EXPECT_EQ(ret, ERR_OK);
667     }
668 
669     ErrCode unInstallResult = UnInstallBundle(BUNDLE_NAME);
670     EXPECT_EQ(unInstallResult, ERR_OK);
671 }
672 
673 /**
674  * @tc.number: BmsBundleQuickFixTest_0014
675  * Function: CheckCommonWithInstalledBundle
676  * @tc.name: test CheckCommonWithInstalledBundle
677  * @tc.require: issueI5MZ5L
678  * @tc.desc: CheckCommonWithInstalledBundle
679  */
680 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0014, Function | SmallTest | Level0)
681 {
682     ErrCode installResult = InstallBundle(HAP_FILE_PATH1);
683     EXPECT_EQ(installResult, ERR_OK);
684 
685     auto deployer = GetQuickFixDeployer();
686     EXPECT_FALSE(deployer == nullptr);
687     if (deployer != nullptr) {
688         AppQuickFix appQuickFix = CreateAppQuickFix();
689         BundleInfo bundleInfo;
690         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
691         EXPECT_EQ(ret, ERR_OK);
692         QuickFixChecker checker;
693         ret = checker.CheckCommonWithInstalledBundle(appQuickFix, bundleInfo);
694         EXPECT_EQ(ret, ERR_OK);
695     }
696 
697     ErrCode unInstallResult = UnInstallBundle(BUNDLE_NAME);
698     EXPECT_EQ(unInstallResult, ERR_OK);
699 }
700 
701 /**
702  * @tc.number: BmsBundleQuickFixTest_0015
703  * Function: CheckCommonWithInstalledBundle
704  * @tc.name: test CheckCommonWithInstalledBundle
705  * @tc.require: issueI5MZ5L
706  * @tc.desc: CheckCommonWithInstalledBundle
707  */
708 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0015, Function | SmallTest | Level0)
709 {
710     ErrCode installResult = InstallBundle(HAP_FILE_PATH1);
711     EXPECT_EQ(installResult, ERR_OK);
712 
713     auto deployer = GetQuickFixDeployer();
714     EXPECT_FALSE(deployer == nullptr);
715     if (deployer != nullptr) {
716         AppQuickFix appQuickFix = CreateAppQuickFix();
717         appQuickFix.versionCode = 200005;
718         BundleInfo bundleInfo;
719         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
720         EXPECT_EQ(ret, ERR_OK);
721         QuickFixChecker checker;
722         ret = checker.CheckCommonWithInstalledBundle(appQuickFix, bundleInfo);
723         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_VERSION_CODE_NOT_SAME);
724     }
725 
726     ErrCode unInstallResult = UnInstallBundle(BUNDLE_NAME);
727     EXPECT_EQ(unInstallResult, ERR_OK);
728 }
729 
730 /**
731  * @tc.number: BmsBundleQuickFixTest_0016
732  * Function: CheckCommonWithInstalledBundle
733  * @tc.name: test CheckCommonWithInstalledBundle
734  * @tc.require: issueI5MZ5D
735  * @tc.desc: CheckCommonWithInstalledBundle
736  */
737 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0016, Function | SmallTest | Level0)
738 {
739     ErrCode installResult = InstallBundle(HAP_FILE_PATH1);
740     EXPECT_EQ(installResult, ERR_OK);
741 
742     auto deployer = GetQuickFixDeployer();
743     EXPECT_FALSE(deployer == nullptr);
744     if (deployer != nullptr) {
745         AppQuickFix appQuickFix = CreateAppQuickFix();
746         BundleInfo bundleInfo;
747         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
748         EXPECT_EQ(ret, ERR_OK);
749         bundleInfo.applicationInfo.appQuickFix.deployedAppqfInfo.versionCode = 2;
750         bundleInfo.applicationInfo.appQuickFix.deployedAppqfInfo.hqfInfos.emplace_back(HqfInfo());
751         QuickFixChecker checker;
752         ret = checker.CheckCommonWithInstalledBundle(appQuickFix, bundleInfo);
753         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_VERSION_CODE_ERROR);
754     }
755 
756     ErrCode unInstallResult = UnInstallBundle(BUNDLE_NAME);
757     EXPECT_EQ(unInstallResult, ERR_OK);
758 }
759 
760 /**
761  * @tc.number: BmsBundleQuickFixTest_0017
762  * Function: CheckCommonWithInstalledBundle
763  * @tc.name: test CheckHotReloadWithInstalledBundle
764  * @tc.require: issueI5MZ5D
765  * @tc.desc: CheckCommonWithInstalledBundle
766  */
767 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0017, Function | SmallTest | Level0)
768 {
769     AddInnerBundleInfo(BUNDLE_NAME);
770 
771     auto deployer = GetQuickFixDeployer();
772     EXPECT_FALSE(deployer == nullptr);
773     if (deployer != nullptr) {
774         AppQuickFix appQuickFix = CreateAppQuickFix();
775         appQuickFix.deployingAppqfInfo.versionCode = 2;
776         appQuickFix.deployingAppqfInfo.type = QuickFixType::HOT_RELOAD;
777         appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::HOT_RELOAD;
778         BundleInfo bundleInfo;
779         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
780         EXPECT_EQ(ret, ERR_OK);
781         QuickFixChecker checker;
782         ret = checker.CheckHotReloadWithInstalledBundle(appQuickFix, bundleInfo);
783         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_HOT_RELOAD_NOT_SUPPORT_RELEASE_BUNDLE);
784     }
785 
786     UninstallBundleInfo(BUNDLE_NAME);
787 }
788 
789 /**
790  * @tc.number: BmsBundleQuickFixTest_0018
791  * Function: CheckCommonWithInstalledBundle
792  * @tc.name: test CheckHotReloadWithInstalledBundle
793  * @tc.require: issueI5MZ7R
794  * @tc.desc: CheckCommonWithInstalledBundle
795  */
796 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0018, Function | SmallTest | Level0)
797 {
798     AddInnerBundleInfo(BUNDLE_NAME, PROVISION_TYPE_DEBUG);
799 
800     auto deployer = GetQuickFixDeployer();
801     EXPECT_FALSE(deployer == nullptr);
802     if (deployer != nullptr) {
803         AppQuickFix appQuickFix = CreateAppQuickFix();
804         appQuickFix.deployingAppqfInfo.versionCode = 2;
805         appQuickFix.deployingAppqfInfo.type = QuickFixType::HOT_RELOAD;
806         appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::HOT_RELOAD;
807         BundleInfo bundleInfo;
808         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
809         EXPECT_EQ(ret, ERR_OK);
810         QuickFixChecker checker;
811         ret = checker.CheckHotReloadWithInstalledBundle(appQuickFix, bundleInfo);
812         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PATCH_ALREADY_EXISTED);
813     }
814 
815     UninstallBundleInfo(BUNDLE_NAME);
816 }
817 
818 /**
819  * @tc.number: BmsBundleQuickFixTest_0019
820  * Function: CheckCommonWithInstalledBundle
821  * @tc.name: test CheckHotReloadWithInstalledBundle
822  * @tc.require: issueI5MZ7R
823  * @tc.desc: CheckCommonWithInstalledBundle
824  */
825 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0019, Function | SmallTest | Level0)
826 {
827     AddInnerBundleInfo(BUNDLE_NAME, PROVISION_TYPE_DEBUG, QuickFixType::HOT_RELOAD);
828 
829     auto deployer = GetQuickFixDeployer();
830     EXPECT_FALSE(deployer == nullptr);
831     if (deployer != nullptr) {
832         AppQuickFix appQuickFix = CreateAppQuickFix();
833         appQuickFix.deployingAppqfInfo.versionCode = 2;
834         appQuickFix.deployingAppqfInfo.type = QuickFixType::HOT_RELOAD;
835         appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::HOT_RELOAD;
836         BundleInfo bundleInfo;
837         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
838         EXPECT_EQ(ret, ERR_OK);
839         QuickFixChecker checker;
840         ret = checker.CheckHotReloadWithInstalledBundle(appQuickFix, bundleInfo);
841         EXPECT_EQ(ret, ERR_OK);
842     }
843 
844     UninstallBundleInfo(BUNDLE_NAME);
845 }
846 
847 /**
848  * @tc.number: BmsBundleQuickFixTest_0020
849  * Function: CheckCommonWithInstalledBundle
850  * @tc.name: test CheckPatchWithInstalledBundle
851  * @tc.require: issueI5N7AD
852  * @tc.desc: CheckCommonWithInstalledBundle
853  */
854 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0020, Function | SmallTest | Level0)
855 {
856     AddInnerBundleInfo(BUNDLE_NAME, PROVISION_TYPE_DEBUG, QuickFixType::HOT_RELOAD);
857 
858     auto deployer = GetQuickFixDeployer();
859     EXPECT_FALSE(deployer == nullptr);
860     if (deployer != nullptr) {
861         AppQuickFix appQuickFix = CreateAppQuickFix();
862         appQuickFix.deployingAppqfInfo.versionCode = 2;
863         BundleInfo bundleInfo;
864         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
865         EXPECT_EQ(ret, ERR_OK);
866         Security::Verify::ProvisionInfo provisionInfo;
867         QuickFixChecker checker;
868         ret = checker.CheckPatchWithInstalledBundle(appQuickFix, bundleInfo, provisionInfo);
869         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_HOT_RELOAD_ALREADY_EXISTED);
870     }
871 
872     UninstallBundleInfo(BUNDLE_NAME);
873 }
874 
875 /**
876  * @tc.number: BmsBundleQuickFixTest_0021
877  * Function: CheckCommonWithInstalledBundle
878  * @tc.name: test CheckPatchWithInstalledBundle
879  * @tc.require: issueI5N7AD
880  * @tc.desc: CheckCommonWithInstalledBundle
881  */
882 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0021, Function | SmallTest | Level0)
883 {
884     AddInnerBundleInfo(BUNDLE_NAME);
885 
886     auto deployer = GetQuickFixDeployer();
887     EXPECT_FALSE(deployer == nullptr);
888     if (deployer != nullptr) {
889         AppQuickFix appQuickFix = CreateAppQuickFix();
890         appQuickFix.deployingAppqfInfo.versionCode = 2;
891         appQuickFix.deployingAppqfInfo.nativeLibraryPath = "libs/armeabi-v7a";
892         BundleInfo bundleInfo;
893         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
894         EXPECT_EQ(ret, ERR_OK);
895         Security::Verify::ProvisionInfo provisionInfo;
896         QuickFixChecker checker;
897         ret = checker.CheckPatchWithInstalledBundle(appQuickFix, bundleInfo, provisionInfo);
898         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SO_INCOMPATIBLE);
899     }
900 
901     UninstallBundleInfo(BUNDLE_NAME);
902 }
903 
904 /**
905  * @tc.number: BmsBundleQuickFixTest_0022
906  * Function: CheckCommonWithInstalledBundle
907  * @tc.name: test CheckPatchWithInstalledBundle
908  * @tc.require: issueI5N7AD
909  * @tc.desc: CheckPatchWithInstalledBundle, signature info not same
910  */
911 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0022, Function | SmallTest | Level0)
912 {
913     AddInnerBundleInfo(BUNDLE_NAME);
914 
915     auto deployer = GetQuickFixDeployer();
916     EXPECT_FALSE(deployer == nullptr);
917     if (deployer != nullptr) {
918         AppQuickFix appQuickFix = CreateAppQuickFix();
919         appQuickFix.deployingAppqfInfo.versionCode = 2;
920         BundleInfo bundleInfo;
921         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
922         EXPECT_EQ(ret, ERR_OK);
923         Security::Verify::ProvisionInfo provisionInfo;
924         QuickFixChecker checker;
925         ret = checker.CheckPatchWithInstalledBundle(appQuickFix, bundleInfo, provisionInfo);
926         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SIGNATURE_INFO_NOT_SAME);
927     }
928 
929     UninstallBundleInfo(BUNDLE_NAME);
930 }
931 
932 /**
933  * @tc.number: BmsBundleQuickFixTest_0023
934  * Function: SaveInnerAppQuickFix
935  * @tc.name: test update
936  * @tc.require: issueI5N7AD
937  * @tc.desc: update hap, app quick fix info will be deleted
938  */
939 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0023, Function | SmallTest | Level0)
940 {
941     ErrCode installResult = InstallBundle(HAP_FILE_PATH1);
942     EXPECT_EQ(installResult, ERR_OK);
943 
944     auto quickFixMgr = GetQuickFixDataMgr();
945     EXPECT_FALSE(quickFixMgr == nullptr);
946     if (quickFixMgr != nullptr) {
947         AppQuickFix appQuickFix = CreateAppQuickFix();
948         QuickFixMark mark;
949         mark.bundleName = appQuickFix.bundleName;
950         mark.status = QuickFixStatus::DEPLOY_END;
951         InnerAppQuickFix innerAppQuickFix(appQuickFix, mark);
952         bool ret = quickFixMgr->SaveInnerAppQuickFix(innerAppQuickFix);
953         EXPECT_TRUE(ret);
954         ErrCode updateResult = UpdateBundle(HAP_FILE_PATH1);
955         EXPECT_EQ(updateResult, ERR_OK);
956         ret = quickFixMgr->QueryInnerAppQuickFix(appQuickFix.bundleName, innerAppQuickFix);
957         EXPECT_FALSE(ret);
958     }
959 
960     ErrCode unInstallResult = UnInstallBundle(BUNDLE_NAME);
961     EXPECT_EQ(unInstallResult, ERR_OK);
962 }
963 
964 /**
965  * @tc.number: BmsBundleQuickFixTest_0024
966  * Function: SaveInnerAppQuickFix
967  * @tc.name: test add new module
968  * @tc.require: issueI5N7AD
969  * @tc.desc: update hap, app quick fix info will not be deleted
970  */
971 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0024, Function | SmallTest | Level0)
972 {
973     ErrCode installResult = InstallBundle(HAP_FILE_PATH1);
974     EXPECT_EQ(installResult, ERR_OK);
975 
976     auto quickFixMgr = GetQuickFixDataMgr();
977     EXPECT_FALSE(quickFixMgr == nullptr);
978     if (quickFixMgr != nullptr) {
979         AppQuickFix appQuickFix = CreateAppQuickFix();
980         QuickFixMark mark;
981         mark.bundleName = appQuickFix.bundleName;
982         mark.status = QuickFixStatus::DEPLOY_END;
983         InnerAppQuickFix innerAppQuickFix(appQuickFix, mark);
984         bool ret = quickFixMgr->SaveInnerAppQuickFix(innerAppQuickFix);
985         EXPECT_TRUE(ret);
986         ErrCode installResult = InstallBundle(HAP_FILE_PATH2);
987         EXPECT_EQ(installResult, ERR_OK);
988         ret = quickFixMgr->QueryInnerAppQuickFix(appQuickFix.bundleName, innerAppQuickFix);
989         EXPECT_TRUE(ret);
990     }
991 
992     ErrCode unInstallResult = UnInstallBundle(BUNDLE_NAME);
993     EXPECT_EQ(unInstallResult, ERR_OK);
994 }
995 
996 /**
997  * @tc.number: BmsBundleQuickFixTest_0025
998  * Function: SaveInnerAppQuickFix
999  * @tc.name: test uninstall
1000  * @tc.require: issueI5N7AD
1001  * @tc.desc: uninstall hap, app quick fix info will be deleted
1002  */
1003 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0025, Function | SmallTest | Level0)
1004 {
1005     ErrCode installResult = InstallBundle(HAP_FILE_PATH1);
1006     EXPECT_EQ(installResult, ERR_OK);
1007 
1008     auto quickFixMgr = GetQuickFixDataMgr();
1009     EXPECT_FALSE(quickFixMgr == nullptr);
1010     if (quickFixMgr != nullptr) {
1011         AppQuickFix appQuickFix = CreateAppQuickFix();
1012         QuickFixMark mark;
1013         mark.bundleName = appQuickFix.bundleName;
1014         mark.status = QuickFixStatus::DEPLOY_END;
1015         InnerAppQuickFix innerAppQuickFix(appQuickFix, mark);
1016         bool ret = quickFixMgr->SaveInnerAppQuickFix(innerAppQuickFix);
1017         EXPECT_TRUE(ret);
1018     }
1019     ErrCode unInstallResult = UnInstallBundle(BUNDLE_NAME);
1020     EXPECT_EQ(unInstallResult, ERR_OK);
1021     if (quickFixMgr != nullptr) {
1022         InnerAppQuickFix innerAppQuickFix;
1023         bool ret = quickFixMgr->QueryInnerAppQuickFix(BUNDLE_NAME, innerAppQuickFix);
1024         EXPECT_FALSE(ret);
1025     }
1026 }
1027 
1028 /**
1029  * @tc.number: BmsBundleQuickFixTest_0026
1030  * Function: GetDeployQuickFixResult
1031  * @tc.name: test GetDeployQuickFixResult
1032  * @tc.require: issueI5N7AD
1033  * @tc.desc: deploy hqf, GetDeployQuickFixResult.
1034  */
1035 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0026, Function | SmallTest | Level0)
1036 {
1037     AddInnerBundleInfo(BUNDLE_NAME);
1038 
1039     auto deployer = GetQuickFixDeployer();
1040     EXPECT_FALSE(deployer == nullptr);
1041     if (deployer != nullptr) {
1042         AppQuickFix appQuickFix = CreateAppQuickFix();
1043         deployer->ToDeployQuickFixResult(appQuickFix);
1044         DeployQuickFixResult result = deployer->GetDeployQuickFixResult();
1045         EXPECT_EQ(result.bundleName, appQuickFix.bundleName);
1046         EXPECT_EQ(result.bundleVersionCode, appQuickFix.versionCode);
1047         EXPECT_EQ(result.patchVersionCode, appQuickFix.deployingAppqfInfo.versionCode);
1048     }
1049 
1050     UninstallBundleInfo(BUNDLE_NAME);
1051 }
1052 
1053 /**
1054  * @tc.number: BmsBundleQuickFixTest_0027
1055  * Function: DeployQuickFix
1056  * @tc.name: test DeployQuickFix
1057  * @tc.require: issueI5N7AD
1058  * @tc.desc: empty path, DeployQuickFix.
1059  */
1060 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0027, Function | SmallTest | Level0)
1061 {
1062     auto quickFixProxy = GetQuickFixManagerProxy();
1063     EXPECT_NE(quickFixProxy, nullptr) << "the quickFixProxy is nullptr";
1064     sptr<MockQuickFixCallback> callback = new (std::nothrow) MockQuickFixCallback();
1065     EXPECT_NE(callback, nullptr) << "the callback is nullptr";
1066     std::vector<std::string> path;
1067     ErrCode ret = quickFixProxy->DeployQuickFix(path, callback);
1068     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
1069     callback = nullptr;
1070     ret = quickFixProxy->DeployQuickFix(path, callback);
1071     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
1072 }
1073 
1074 /**
1075  * @tc.number: BmsBundleQuickFixTest_0028
1076  * Function: DeployQuickFix
1077  * @tc.name: test DeployQuickFix
1078  * @tc.require: issueI5N7AD
1079  * @tc.desc: not hqf file, DeployQuickFix.
1080  */
1081 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0028, Function | SmallTest | Level0)
1082 {
1083     auto quickFixProxy= GetQuickFixManagerProxy();
1084     EXPECT_NE(quickFixProxy, nullptr) << "the quickFixProxy is nullptr";
1085     sptr<MockQuickFixCallback> callback = new (std::nothrow) MockQuickFixCallback();
1086     EXPECT_NE(callback, nullptr) << "the callback is nullptr";
1087     std::vector<std::string> path {HAP_FILE_PATH1};
1088     ErrCode ret = quickFixProxy->DeployQuickFix(path, callback);
1089     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_INVALID_PATH);
1090 }
1091 
1092 /**
1093  * @tc.number: BmsBundleQuickFixTest_0029
1094  * Function: DeployQuickFix
1095  * @tc.name: test DeployQuickFix
1096  * @tc.require: issueI5N7AD
1097  * @tc.desc: not exist hqf file, DeployQuickFix.
1098  */
1099 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0029, Function | SmallTest | Level0)
1100 {
1101     auto quickFixProxy= GetQuickFixManagerProxy();
1102     EXPECT_NE(quickFixProxy, nullptr) << "the quickFixProxy is nullptr";
1103     sptr<MockQuickFixCallback> callback = new (std::nothrow) MockQuickFixCallback();
1104     EXPECT_NE(callback, nullptr) << "the callback is nullptr";
1105     std::vector<std::string> path {HQF_FILE_PATH1};
1106     ErrCode ret = quickFixProxy->DeployQuickFix(path, callback);
1107     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_INVALID_PATH);
1108 }
1109 
1110 /**
1111  * @tc.number: BmsBundleQuickFixTest_0030
1112  * Function: CheckCommonWithInstalledBundle
1113  * @tc.name: test CheckCommonWithInstalledBundle
1114  * @tc.require: issueI5N7AD
1115  * @tc.desc: CheckCommonWithInstalledBundle, bundleInfo has no patch info
1116  */
1117 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0030, Function | SmallTest | Level0)
1118 {
1119     AddInnerBundleInfo(BUNDLE_NAME);
1120 
1121     auto deployer = GetQuickFixDeployer();
1122     EXPECT_FALSE(deployer == nullptr);
1123     if (deployer != nullptr) {
1124         AppQuickFix appQuickFix = CreateAppQuickFix();
1125         BundleInfo bundleInfo;
1126         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
1127         EXPECT_EQ(ret, ERR_OK);
1128         QuickFixChecker checker;
1129         ret = checker.CheckCommonWithInstalledBundle(appQuickFix, bundleInfo);
1130         EXPECT_EQ(ret, ERR_OK);
1131     }
1132 
1133     UninstallBundleInfo(BUNDLE_NAME);
1134 }
1135 
1136 /**
1137  * @tc.number: BmsBundleQuickFixTest_0031
1138  * Function: CheckCommonWithInstalledBundle
1139  * @tc.name: test CheckCommonWithInstalledBundle
1140  * @tc.require: issueI5N7AD
1141  * @tc.desc: CheckCommonWithInstalledBundle, bundleInfo patchVersionCode is
1142  *           equal to new patchVersionCode
1143  */
1144 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0031, Function | SmallTest | Level0)
1145 {
1146     AddInnerBundleInfo(BUNDLE_NAME);
1147 
1148     auto deployer = GetQuickFixDeployer();
1149     EXPECT_FALSE(deployer == nullptr);
1150     if (deployer != nullptr) {
1151         AppQuickFix appQuickFix = CreateAppQuickFix();
1152         BundleInfo bundleInfo;
1153         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
1154         bundleInfo.applicationInfo.appQuickFix.deployedAppqfInfo.versionCode = 1;
1155         bundleInfo.applicationInfo.appQuickFix.deployedAppqfInfo.hqfInfos.push_back(HqfInfo());
1156         EXPECT_EQ(ret, ERR_OK);
1157         QuickFixChecker checker;
1158         ret = checker.CheckCommonWithInstalledBundle(appQuickFix, bundleInfo);
1159         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_VERSION_CODE_ERROR);
1160     }
1161 
1162     UninstallBundleInfo(BUNDLE_NAME);
1163 }
1164 
1165 /**
1166  * @tc.number: BmsBundleQuickFixTest_0032
1167  * Function: CheckCommonWithInstalledBundle
1168  * @tc.name: test CheckCommonWithInstalledBundle
1169  * @tc.require: issueI5N7AD
1170  * @tc.desc: CheckCommonWithInstalledBundle
1171  */
1172 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0032, Function | SmallTest | Level0)
1173 {
1174     AddInnerBundleInfo(BUNDLE_NAME);
1175 
1176     auto deployer = GetQuickFixDeployer();
1177     EXPECT_FALSE(deployer == nullptr);
1178     if (deployer != nullptr) {
1179         AppQuickFix appQuickFix = CreateAppQuickFix();
1180         BundleInfo bundleInfo;
1181         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
1182         bundleInfo.applicationInfo.appQuickFix.deployedAppqfInfo.versionCode = 0;
1183         bundleInfo.applicationInfo.appQuickFix.deployedAppqfInfo.hqfInfos.push_back(HqfInfo());
1184         EXPECT_EQ(ret, ERR_OK);
1185         QuickFixChecker checker;
1186         ret = checker.CheckCommonWithInstalledBundle(appQuickFix, bundleInfo);
1187         EXPECT_EQ(ret, ERR_OK);
1188     }
1189 
1190     UninstallBundleInfo(BUNDLE_NAME);
1191 }
1192 
1193 /**
1194  * @tc.number: BmsBundleQuickFixTest_0033
1195  * Function: ProcessNativeLibraryPath
1196  * @tc.name: test ProcessNativeLibraryPath
1197  * @tc.require: issueI5N7AD
1198  * @tc.desc: ProcessNativeLibraryPath, bundleInfo
1199  */
1200 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0033, Function | SmallTest | Level0)
1201 {
1202     auto deployer = GetQuickFixDeployer();
1203     EXPECT_FALSE(deployer == nullptr);
1204     if (deployer != nullptr) {
1205         AppQuickFix appQuickFix = CreateAppQuickFix();
1206         appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
1207         InnerAppQuickFix innerAppQuickFix;
1208         innerAppQuickFix.SetAppQuickFix(appQuickFix);
1209         deployer->ProcessNativeLibraryPath(PATCH_PATH, innerAppQuickFix);
1210 
1211         appQuickFix = innerAppQuickFix.GetAppQuickFix();
1212         deployer->ToDeployQuickFixResult(appQuickFix);
1213         DeployQuickFixResult result = deployer->GetDeployQuickFixResult();
1214         EXPECT_EQ(result.bundleName, appQuickFix.bundleName);
1215         EXPECT_FALSE(result.isSoContained);
1216     }
1217 }
1218 
1219 /**
1220  * @tc.number: BmsBundleQuickFixTest_0034
1221  * Function: ProcessNativeLibraryPath
1222  * @tc.name: test ProcessNativeLibraryPath
1223  * @tc.require: issueI5N7AD
1224  * @tc.desc: ProcessNativeLibraryPath, bundleInfo
1225  */
1226 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0034, Function | SmallTest | Level0)
1227 {
1228     auto deployer = GetQuickFixDeployer();
1229     EXPECT_FALSE(deployer == nullptr);
1230     if (deployer != nullptr) {
1231         AppQuickFix appQuickFix = CreateAppQuickFix();
1232         appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
1233         appQuickFix.deployingAppqfInfo.hqfInfos[0].nativeLibraryPath = QUICK_FIX_SO_PATH;
1234         InnerAppQuickFix innerAppQuickFix;
1235         innerAppQuickFix.SetAppQuickFix(appQuickFix);
1236         deployer->ProcessNativeLibraryPath(PATCH_PATH, innerAppQuickFix);
1237 
1238         appQuickFix = innerAppQuickFix.GetAppQuickFix();
1239         deployer->ToDeployQuickFixResult(appQuickFix);
1240         DeployQuickFixResult result = deployer->GetDeployQuickFixResult();
1241         EXPECT_EQ(result.bundleName, appQuickFix.bundleName);
1242         EXPECT_FALSE(result.isSoContained);
1243     }
1244 }
1245 
1246 /**
1247  * @tc.number: BmsBundleQuickFixTest_0035
1248  * Function: ProcessNativeLibraryPath
1249  * @tc.name: test ProcessNativeLibraryPath
1250  * @tc.require: issueI5N7AD
1251  * @tc.desc: ProcessNativeLibraryPath, both empty
1252  */
1253 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0035, Function | SmallTest | Level0)
1254 {
1255     auto deployer = GetQuickFixDeployer();
1256     EXPECT_FALSE(deployer == nullptr);
1257     if (deployer != nullptr) {
1258         AppQuickFix appQuickFix = CreateAppQuickFix();
1259         InnerAppQuickFix innerAppQuickFix;
1260         innerAppQuickFix.SetAppQuickFix(appQuickFix);
1261         deployer->ProcessNativeLibraryPath(PATCH_PATH, innerAppQuickFix);
1262 
1263         appQuickFix = innerAppQuickFix.GetAppQuickFix();
1264         deployer->ToDeployQuickFixResult(appQuickFix);
1265         DeployQuickFixResult result = deployer->GetDeployQuickFixResult();
1266         EXPECT_EQ(result.bundleName, appQuickFix.bundleName);
1267         EXPECT_FALSE(result.isSoContained);
1268     }
1269 }
1270 
1271 /**
1272  * @tc.number: BmsBundleQuickFixTest_0036
1273  * Function: SaveToInnerBundleInfo
1274  * @tc.name: test SaveToInnerBundleInfo
1275  * @tc.require: issueI5N7AD
1276  * @tc.desc: SaveToInnerBundleInfo, bundleName is not exist in bundleInfo
1277  */
1278 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0036, Function | SmallTest | Level0)
1279 {
1280     auto deployer = GetQuickFixDeployer();
1281     EXPECT_FALSE(deployer == nullptr);
1282     if (deployer != nullptr) {
1283         AppQuickFix appQuickFix = CreateAppQuickFix();
1284         InnerAppQuickFix innerAppQuickFix;
1285         innerAppQuickFix.SetAppQuickFix(appQuickFix);
1286         ErrCode ret = deployer->SaveToInnerBundleInfo(innerAppQuickFix);
1287         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_NOT_EXISTED_BUNDLE_INFO);
1288     }
1289 }
1290 
1291 /**
1292  * @tc.number: BmsBundleQuickFixTest_0037
1293  * Function: SaveToInnerBundleInfo
1294  * @tc.name: test SaveToInnerBundleInfo
1295  * @tc.require: issueI5N7AD
1296  * @tc.desc: SaveToInnerBundleInfo, bundleName exists in bundleInfo
1297  */
1298 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0037, Function | SmallTest | Level0)
1299 {
1300     AddInnerBundleInfo(BUNDLE_NAME);
1301 
1302     auto deployer = GetQuickFixDeployer();
1303     EXPECT_FALSE(deployer == nullptr);
1304     if (deployer != nullptr) {
1305         AppQuickFix appQuickFix = CreateAppQuickFix();
1306         InnerAppQuickFix innerAppQuickFix;
1307         innerAppQuickFix.SetAppQuickFix(appQuickFix);
1308         ErrCode ret = deployer->SaveToInnerBundleInfo(innerAppQuickFix);
1309         EXPECT_EQ(ret, ERR_OK);
1310     }
1311 
1312     UninstallBundleInfo(BUNDLE_NAME);
1313 }
1314 
1315 /**
1316  * @tc.number: BmsBundleQuickFixTest_0038
1317  * Function: ProcessBundleFilePaths
1318  * @tc.name: test ProcessBundleFilePaths
1319  * @tc.require: issueI5N7AD
1320  * @tc.desc: ProcessBundleFilePaths, .hap
1321  */
1322 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0038, Function | SmallTest | Level0)
1323 {
1324     auto deployer = GetQuickFixDeployer();
1325     EXPECT_FALSE(deployer == nullptr);
1326     if (deployer != nullptr) {
1327         std::vector<std::string> paths {HAP_FILE_PATH1};
1328         std::vector<std::string> realPaths;
1329         ErrCode ret = deployer->ProcessBundleFilePaths(paths, realPaths);
1330         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
1331     }
1332 }
1333 
1334 /**
1335  * @tc.number: BmsBundleQuickFixTest_0039
1336  * Function: ProcessBundleFilePaths
1337  * @tc.name: test ProcessBundleFilePaths
1338  * @tc.require: issueI5N7AD
1339  * @tc.desc: ProcessBundleFilePaths, empty
1340  */
1341 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0039, Function | SmallTest | Level0)
1342 {
1343     auto deployer = GetQuickFixDeployer();
1344     EXPECT_FALSE(deployer == nullptr);
1345     if (deployer != nullptr) {
1346         std::vector<std::string> paths;
1347         std::vector<std::string> realPaths;
1348         ErrCode ret = deployer->ProcessBundleFilePaths(paths, realPaths);
1349         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
1350     }
1351 }
1352 
1353 /**
1354  * @tc.number: BmsBundleQuickFixTest_0040
1355  * Function: ProcessBundleFilePaths
1356  * @tc.name: test ProcessBundleFilePaths
1357  * @tc.require: issueI5N7AD
1358  * @tc.desc: ProcessBundleFilePaths, path not exit
1359  */
1360 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0040, Function | SmallTest | Level0)
1361 {
1362     auto deployer = GetQuickFixDeployer();
1363     EXPECT_FALSE(deployer == nullptr);
1364     if (deployer != nullptr) {
1365         std::vector<std::string> paths {HQF_FILE_PATH1};
1366         std::vector<std::string> realPaths;
1367         ErrCode ret = deployer->ProcessBundleFilePaths(paths, realPaths);
1368         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
1369     }
1370 }
1371 
1372 /**
1373  * @tc.number: BmsBundleQuickFixTest_0041
1374  * Function: RemoveDeployingInfo
1375  * @tc.name: test RemoveDeployingInfo
1376  * @tc.require: issueI5N7AD
1377  * @tc.desc: RemoveDeployingInfo, bundleName is not existed
1378  */
1379 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0041, Function | SmallTest | Level0)
1380 {
1381     auto deleter = GetQuickFixDeleter();
1382     EXPECT_FALSE(deleter == nullptr);
1383     if (deleter != nullptr) {
1384         ErrCode ret = deleter->RemoveDeployingInfo(BUNDLE_NAME);
1385         EXPECT_EQ(ret, ERR_OK);
1386     }
1387 }
1388 
1389 /**
1390  * @tc.number: BmsBundleQuickFixTest_0042
1391  * Function: RemoveDeployingInfo
1392  * @tc.name: test RemoveDeployingInfo
1393  * @tc.require: issueI5N7AD
1394  * @tc.desc: RemoveDeployingInfo, bundleName exists, hqfInfos empty
1395  */
1396 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0042, Function | SmallTest | Level0)
1397 {
1398     AddInnerBundleInfo(BUNDLE_NAME);
1399     auto deleter = GetQuickFixDeleter();
1400     EXPECT_FALSE(deleter == nullptr);
1401     if (deleter != nullptr) {
1402         ErrCode ret = deleter->RemoveDeployingInfo(BUNDLE_NAME);
1403         EXPECT_EQ(ret, ERR_OK);
1404     }
1405 
1406     UninstallBundleInfo(BUNDLE_NAME);
1407 }
1408 
1409 /**
1410  * @tc.number: BmsBundleQuickFixTest_0043
1411  * Function: RemoveDeployingInfo
1412  * @tc.name: test RemoveDeployingInfo
1413  * @tc.require: issueI5N7AD
1414  * @tc.desc: RemoveDeployingInfo, bundleName exists, hqfInfos not empty
1415  */
1416 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0043, Function | SmallTest | Level0)
1417 {
1418     AddInnerBundleInfo(BUNDLE_NAME, PROVISION_TYPE_DEBUG);
1419     auto deleter = GetQuickFixDeleter();
1420     EXPECT_FALSE(deleter == nullptr);
1421     if (deleter != nullptr) {
1422         ErrCode ret = deleter->RemoveDeployingInfo(BUNDLE_NAME);
1423         EXPECT_EQ(ret, ERR_OK);
1424     }
1425 
1426     UninstallBundleInfo(BUNDLE_NAME);
1427 }
1428 
1429 /**
1430  * @tc.number: BmsBundleQuickFixTest_0044
1431  * Function: InnerSwitchQuickFix
1432  * @tc.name: test InnerSwitchQuickFix
1433  * @tc.require: issueI5N7AD
1434  * @tc.desc: InnerSwitchQuickFix, bundleName not exists
1435  */
1436 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0044, Function | SmallTest | Level0)
1437 {
1438     auto switcher = GetQuickFixSwitcher();
1439     EXPECT_FALSE(switcher == nullptr);
1440     if (switcher != nullptr) {
1441         InnerAppQuickFix innerAppQuickFix;
1442         ErrCode ret = switcher->InnerSwitchQuickFix(BUNDLE_NAME, innerAppQuickFix, true);
1443         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_NOT_EXISTED_BUNDLE_INFO);
1444     }
1445 }
1446 
1447 /**
1448  * @tc.number: BmsBundleQuickFixTest_0045
1449  * Function: InnerSwitchQuickFix
1450  * @tc.name: test InnerSwitchQuickFix
1451  * @tc.require: issueI5N7AD
1452  * @tc.desc: InnerSwitchQuickFix, bundleName exists, hqfInfos empty
1453  */
1454 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0045, Function | SmallTest | Level0)
1455 {
1456     AddInnerBundleInfo(BUNDLE_NAME);
1457 
1458     auto switcher = GetQuickFixSwitcher();
1459     EXPECT_FALSE(switcher == nullptr);
1460     if (switcher != nullptr) {
1461         InnerAppQuickFix innerAppQuickFix;
1462         ErrCode ret = switcher->InnerSwitchQuickFix(BUNDLE_NAME, innerAppQuickFix, false);
1463         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_NO_PATCH_INFO_IN_BUNDLE_INFO);
1464     }
1465 
1466     UninstallBundleInfo(BUNDLE_NAME);
1467 }
1468 
1469 /**
1470  * @tc.number: BmsBundleQuickFixTest_0046
1471  * Function: ToDeployEndStatus
1472  * @tc.name: test ToDeployEndStatus
1473  * @tc.require: issueI5N7AD
1474  * @tc.desc: ToDeployEndStatus nativeLibraryPath empty
1475  */
1476 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0046, Function | SmallTest | Level0)
1477 {
1478     auto deployer = GetQuickFixDeployer();
1479     EXPECT_FALSE(deployer == nullptr);
1480     if (deployer != nullptr) {
1481         AppQuickFix appQuickFix = CreateAppQuickFix();
1482         appQuickFix.deployingAppqfInfo.type = QuickFixType::HOT_RELOAD;
1483         appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::HOT_RELOAD;
1484         appQuickFix.deployingAppqfInfo.nativeLibraryPath = "";
1485         InnerAppQuickFix newInnerAppQuickFix;
1486         newInnerAppQuickFix.SetAppQuickFix(appQuickFix);
1487         InnerAppQuickFix oldInnerAppQuickFix;
1488         ErrCode ret = deployer->ToDeployEndStatus(newInnerAppQuickFix, oldInnerAppQuickFix);
1489         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
1490     }
1491 }
1492 
1493 /**
1494  * @tc.number: BmsBundleQuickFixTest_0047
1495  * Function: ToDeployEndStatus
1496  * @tc.name: test ToDeployEndStatus
1497  * @tc.require: issueI5N7AD
1498  * @tc.desc: ToDeployEndStatus nativeLibraryPath not empty
1499  */
1500 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0047, Function | SmallTest | Level0)
1501 {
1502     auto deployer = GetQuickFixDeployer();
1503     EXPECT_FALSE(deployer == nullptr);
1504     if (deployer != nullptr) {
1505         AppQuickFix appQuickFix = CreateAppQuickFix();
1506         appQuickFix.deployingAppqfInfo.type = QuickFixType::HOT_RELOAD;
1507         appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::HOT_RELOAD;
1508         appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
1509         InnerAppQuickFix newInnerAppQuickFix;
1510         newInnerAppQuickFix.SetAppQuickFix(appQuickFix);
1511         InnerAppQuickFix oldInnerAppQuickFix;
1512         ErrCode ret = deployer->ToDeployEndStatus(newInnerAppQuickFix, oldInnerAppQuickFix);
1513         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
1514     }
1515 }
1516 
1517 /**
1518  * @tc.number: BmsBundleQuickFixTest_0048
1519  * Function: ToDeployEndStatus
1520  * @tc.name: test ToDeployEndStatus
1521  * @tc.require: issueI5N7AD
1522  * @tc.desc: ToDeployEndStatus nativeLibraryPath not empty
1523  */
1524 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0048, Function | SmallTest | Level0)
1525 {
1526     auto deployer = GetQuickFixDeployer();
1527     EXPECT_FALSE(deployer == nullptr);
1528     if (deployer != nullptr) {
1529         AppQuickFix appQuickFix = CreateAppQuickFix();
1530         appQuickFix.deployingAppqfInfo.type = QuickFixType::HOT_RELOAD;
1531         appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::HOT_RELOAD;
1532         appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
1533         InnerAppQuickFix newInnerAppQuickFix;
1534         newInnerAppQuickFix.SetAppQuickFix(appQuickFix);
1535         InnerAppQuickFix oldInnerAppQuickFix;
1536         ErrCode ret = deployer->ToDeployEndStatus(newInnerAppQuickFix, oldInnerAppQuickFix);
1537         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
1538     }
1539 }
1540 
1541 /**
1542  * @tc.number: BmsBundleQuickFixTest_0049
1543  * Function: ProcessBundleFilePaths
1544  * @tc.name: test ProcessBundleFilePaths
1545  * @tc.require: issueI5N7AD
1546  * @tc.desc: ProcessBundleFilePaths
1547  */
1548 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0049, Function | SmallTest | Level0)
1549 {
1550     auto deployer = GetQuickFixDeployer();
1551     EXPECT_FALSE(deployer == nullptr);
1552     if (deployer != nullptr) {
1553         QuickFixManagerHostImpl quickFixManagerHostImpl;
1554         std::string fileName = "test.hqf";
1555         int32_t fd = -1;
1556         std::string path = "";
1557         auto res = quickFixManagerHostImpl.CreateFd(fileName, fd, path);
1558         EXPECT_EQ(res, ERR_OK);
1559         const std::vector<std::string> sourceFiles {path};
1560         std::vector<std::string> secureDirs;
1561         res = quickFixManagerHostImpl.CopyHqfToSecurityDir(sourceFiles, secureDirs);
1562         EXPECT_EQ(res, ERR_OK);
1563         std::vector<std::string> realFilePaths;
1564         auto ret = deployer->ProcessBundleFilePaths(secureDirs, realFilePaths);
1565         EXPECT_EQ(ret, ERR_OK);
1566         DeleteFiles(sourceFiles);
1567         DeleteFiles(secureDirs);
1568     }
1569 }
1570 
1571 /**
1572  * @tc.number: BmsBundleQuickFixTest_0050
1573  * Function: ProcessBundleFilePaths
1574  * @tc.name: test ProcessBundleFilePaths
1575  * @tc.require: issueI5N7AD
1576  * @tc.desc: ProcessBundleFilePaths
1577  */
1578 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0050, Function | SmallTest | Level0)
1579 {
1580     auto deployer = GetQuickFixDeployer();
1581     EXPECT_FALSE(deployer == nullptr);
1582     if (deployer != nullptr) {
1583         std::vector<std::string> sourceFiles {FILE1_PATH, FILE2_PATH, INVALID_FILE_SUFFIX_PATH};
1584         CreateFiles(sourceFiles);
1585         std::vector<std::string> realFilePaths;
1586         ErrCode ret = deployer->ProcessBundleFilePaths(sourceFiles, realFilePaths);
1587         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
1588         DeleteFiles(sourceFiles);
1589     }
1590 }
1591 
1592 /**
1593  * @tc.number: BmsBundleQuickFixTest_0051
1594  * Function: ProcessBundleFilePaths
1595  * @tc.name: test ProcessBundleFilePaths
1596  * @tc.require: issueI5N7AD
1597  * @tc.desc: ProcessBundleFilePaths
1598  */
1599 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0051, Function | SmallTest | Level0)
1600 {
1601     auto deployer = GetQuickFixDeployer();
1602     EXPECT_FALSE(deployer == nullptr);
1603     if (deployer != nullptr) {
1604         std::vector<std::string> sourceFiles {FILE1_PATH, FILE2_PATH, FILE3_PATH};
1605         CreateFiles(sourceFiles);
1606         std::vector<std::string> realFilePaths;
1607         ErrCode ret = deployer->ProcessBundleFilePaths(sourceFiles, realFilePaths);
1608         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
1609         DeleteFiles(sourceFiles);
1610     }
1611 }
1612 
1613 /**
1614  * @tc.number: BmsBundleQuickFixTest_0052
1615  * Function: CheckCommonWithInstalledBundle
1616  * @tc.name: test CheckPatchWithInstalledBundle
1617  * @tc.require: issueI5N7AD
1618  * @tc.desc: CheckPatchWithInstalledBundle, signature info not same
1619  */
1620 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0052, Function | SmallTest | Level0)
1621 {
1622     AddInnerBundleInfo(BUNDLE_NAME, PROVISION_TYPE_DEBUG);
1623 
1624     auto deployer = GetQuickFixDeployer();
1625     EXPECT_FALSE(deployer == nullptr);
1626     if (deployer != nullptr) {
1627         AppQuickFix appQuickFix = CreateAppQuickFix();
1628         appQuickFix.deployingAppqfInfo.versionCode = 2;
1629         BundleInfo bundleInfo;
1630         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
1631         EXPECT_EQ(ret, ERR_OK);
1632         Security::Verify::ProvisionInfo provisionInfo;
1633         QuickFixChecker checker;
1634         ret = checker.CheckPatchWithInstalledBundle(appQuickFix, bundleInfo, provisionInfo);
1635         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SIGNATURE_INFO_NOT_SAME);
1636     }
1637 
1638     UninstallBundleInfo(BUNDLE_NAME);
1639 }
1640 
1641 /**
1642  * @tc.number: BmsBundleQuickFixTest_0053
1643  * Function: ToDeployEndStatus
1644  * @tc.name: test ToDeployEndStatus
1645  * @tc.require: issueI5N7AD
1646  * @tc.desc: ToDeployEndStatus
1647  */
1648 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0053, Function | SmallTest | Level0)
1649 {
1650     auto deployer = GetQuickFixDeployer();
1651     EXPECT_FALSE(deployer == nullptr);
1652     if (deployer != nullptr) {
1653         std::vector<std::string> sourcePath {FILE1_PATH};
1654         CreateFiles(sourcePath);
1655         AppQuickFix appQuickFix = CreateAppQuickFix();
1656         appQuickFix.deployingAppqfInfo.type = QuickFixType::HOT_RELOAD;
1657         std::vector<HqfInfo> hqfInfo;
1658         appQuickFix.deployingAppqfInfo.nativeLibraryPath = "";
1659         appQuickFix.deployingAppqfInfo.hqfInfos= hqfInfo;
1660         InnerAppQuickFix newInnerAppQuickFix;
1661         newInnerAppQuickFix.SetAppQuickFix(appQuickFix);
1662         InnerAppQuickFix oldInnerAppQuickFix;
1663         ErrCode ret = deployer->ToDeployEndStatus(newInnerAppQuickFix, oldInnerAppQuickFix);
1664         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_NOT_EXISTED_BUNDLE_INFO);
1665         DeleteFiles(sourcePath);
1666     }
1667 }
1668 
1669 /**
1670  * @tc.number: BmsBundleQuickFixTest_0054
1671  * Function: ToDeployEndStatus
1672  * @tc.name: test ToDeployEndStatus
1673  * @tc.require: issueI5N7AD
1674  * @tc.desc: ToDeployEndStatus
1675  */
1676 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0054, Function | SmallTest | Level0)
1677 {
1678     AddInnerBundleInfo(BUNDLE_NAME, PROVISION_TYPE_DEBUG, QuickFixType::HOT_RELOAD);
1679 
1680     auto deployer = GetQuickFixDeployer();
1681     EXPECT_FALSE(deployer == nullptr);
1682     if (deployer != nullptr) {
1683         std::vector<std::string> sourcePath {FILE1_PATH};
1684         CreateFiles(sourcePath);
1685         AppQuickFix appQuickFix = CreateAppQuickFix();
1686         appQuickFix.deployingAppqfInfo.type = QuickFixType::HOT_RELOAD;
1687         appQuickFix.deployingAppqfInfo.versionCode = 2;
1688         std::vector<HqfInfo> hqfInfo;
1689         HqfInfo info;
1690         info.hqfFilePath = "/data/test/hello.hqf";
1691         hqfInfo.emplace_back(info);
1692         appQuickFix.deployingAppqfInfo.hqfInfos= hqfInfo;
1693         InnerAppQuickFix newInnerAppQuickFix;
1694         newInnerAppQuickFix.SetAppQuickFix(appQuickFix);
1695         InnerAppQuickFix oldInnerAppQuickFix;
1696         ErrCode ret = deployer->ToDeployEndStatus(newInnerAppQuickFix, oldInnerAppQuickFix);
1697         EXPECT_EQ(ret, ERR_OK);
1698         DeleteFiles(sourcePath);
1699     }
1700 
1701     UninstallBundleInfo(BUNDLE_NAME);
1702 }
1703 
1704 /**
1705  * @tc.number: BmsBundleQuickFixTest_0055
1706  * Function: RemoveDeployingInfo
1707  * @tc.name: test RemoveDeployingInfo
1708  * @tc.require: issueI5N7AD
1709  * @tc.desc: RemoveDeployingInfo, bundleName exists, hqfInfos not empty
1710  */
1711 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0055, Function | SmallTest | Level0)
1712 {
1713     AddInnerBundleInfo(BUNDLE_NAME, PROVISION_TYPE_DEBUG);
1714     auto deleter = GetQuickFixDeleter();
1715     EXPECT_FALSE(deleter == nullptr);
1716     if (deleter != nullptr) {
1717         ErrCode ret = deleter->RemoveDeployingInfo(BUNDLE_NAME);
1718         EXPECT_EQ(ret, ERR_OK);
1719     }
1720 
1721     UninstallBundleInfo(BUNDLE_NAME);
1722 }
1723 
1724 /**
1725  * @tc.number: BmsBundleQuickFixTest_0056
1726  * Function: GetAppProvisionType
1727  * @tc.name: test GetAppProvisionType
1728  * @tc.require: issueI5N7AD
1729  * @tc.desc: GetAppProvisionType, debug
1730  */
1731 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0056, Function | SmallTest | Level0)
1732 {
1733     QuickFixChecker checker;
1734     std::string type = checker.GetAppProvisionType(Security::Verify::ProvisionType::DEBUG);
1735     EXPECT_EQ(type, PROVISION_TYPE_DEBUG);
1736 }
1737 
1738 /**
1739  * @tc.number: BmsBundleQuickFixTest_0057
1740  * Function: GetAppProvisionType
1741  * @tc.name: test GetAppProvisionType
1742  * @tc.require: issueI5N7AD
1743  * @tc.desc: GetAppProvisionType release
1744  */
1745 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0057, Function | SmallTest | Level0)
1746 {
1747     QuickFixChecker checker;
1748     std::string type = checker.GetAppProvisionType(Security::Verify::ProvisionType::RELEASE);
1749     EXPECT_EQ(type, PROVISION_TYPE_RELEASE);
1750 }
1751 
1752 /**
1753  * @tc.number: BmsBundleQuickFixTest_0058
1754  * Function: GetAppDistributionType
1755  * @tc.name: test GetAppDistributionType
1756  * @tc.require: issueI5N7AD
1757  * @tc.desc: GetAppDistributionType app_gallery
1758  */
1759 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0058, Function | SmallTest | Level0)
1760 {
1761     QuickFixChecker checker;
1762     std::string type = checker.GetAppDistributionType(Security::Verify::AppDistType::APP_GALLERY);
1763     EXPECT_EQ(type, "app_gallery");
1764 }
1765 
1766 /**
1767  * @tc.number: BmsBundleQuickFixTest_0059
1768  * Function: GetAppDistributionType
1769  * @tc.name: test GetAppDistributionType
1770  * @tc.require: issueI5N7AD
1771  * @tc.desc: GetAppDistributionType internaltesting
1772  */
1773 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0059, Function | SmallTest | Level0)
1774 {
1775     QuickFixChecker checker;
1776     std::string type = checker.GetAppDistributionType(static_cast<Security::Verify::AppDistType>(7));
1777     EXPECT_EQ(type, "internaltesting");
1778 }
1779 
1780 /**
1781  * @tc.number: BmsBundleQuickFixTest_0060
1782  * Function: CheckMultiNativeSo
1783  * @tc.name: test CheckMultiNativeSo
1784  * @tc.require: issueI5N7AD
1785  * @tc.desc: CheckMultiNativeSo empty
1786  */
1787 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0060, Function | SmallTest | Level0)
1788 {
1789     std::unordered_map<std::string, AppQuickFix> infos;
1790     QuickFixChecker checker;
1791     auto ret = checker.CheckMultiNativeSo(infos);
1792     EXPECT_EQ(ret, ERR_OK);
1793 }
1794 
1795 /**
1796  * @tc.number: BmsBundleQuickFixTest_0061
1797  * Function: CheckMultiNativeSo
1798  * @tc.name: test CheckMultiNativeSo
1799  * @tc.require: issueI5N7AD
1800  * @tc.desc: nativeLibraryPath empty
1801  */
1802 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0061, Function | SmallTest | Level0)
1803 {
1804     std::unordered_map<std::string, AppQuickFix> infos;
1805     AppQuickFix appQuickFix = CreateAppQuickFix();
1806     infos.emplace("appQuickFix_1", appQuickFix);
1807 
1808     QuickFixChecker checker;
1809     auto ret = checker.CheckMultiNativeSo(infos);
1810     EXPECT_EQ(ret, ERR_OK);
1811 }
1812 
1813 /**
1814  * @tc.number: BmsBundleQuickFixTest_0062
1815  * Function: CheckMultiNativeSo
1816  * @tc.name: test CheckMultiNativeSo
1817  * @tc.require: issueI5N7AD
1818  * @tc.desc: nativeLibraryPath
1819  */
1820 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0062, Function | SmallTest | Level0)
1821 {
1822     std::unordered_map<std::string, AppQuickFix> infos;
1823     AppQuickFix appQuickFix = CreateAppQuickFix();
1824     infos.emplace("appQuickFix_1", appQuickFix);
1825 
1826     appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
1827     infos.emplace("appQuickFix_2", appQuickFix);
1828     infos.emplace("appQuickFix_3", appQuickFix);
1829 
1830     QuickFixChecker checker;
1831     auto ret = checker.CheckMultiNativeSo(infos);
1832     EXPECT_EQ(ret, ERR_OK);
1833 }
1834 
1835 /**
1836  * @tc.number: BmsBundleQuickFixTest_0063
1837  * Function: CheckMultiNativeSo
1838  * @tc.name: test CheckMultiNativeSo
1839  * @tc.require: issueI5N7AD
1840  * @tc.desc: nativeLibraryPath
1841  */
1842 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0063, Function | SmallTest | Level0)
1843 {
1844     std::unordered_map<std::string, AppQuickFix> infos;
1845     AppQuickFix appQuickFix = CreateAppQuickFix();
1846     appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
1847     infos.emplace("appQuickFix_1", appQuickFix);
1848     appQuickFix.deployingAppqfInfo.nativeLibraryPath = "wrong";
1849     infos.emplace("appQuickFix_2", appQuickFix);
1850 
1851     QuickFixChecker checker;
1852     auto ret = checker.CheckMultiNativeSo(infos);
1853     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SO_INCOMPATIBLE);
1854 }
1855 
1856 /**
1857  * @tc.number: BmsBundleQuickFixTest_0064
1858  * Function: CheckMultiNativeSo
1859  * @tc.name: test CheckMultiNativeSo
1860  * @tc.require: issueI5N7AD
1861  * @tc.desc: nativeLibraryPath
1862  */
1863 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0064, Function | SmallTest | Level0)
1864 {
1865     std::unordered_map<std::string, AppQuickFix> infos;
1866     AppQuickFix appQuickFix = CreateAppQuickFix();
1867     appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
1868     infos.emplace("appQuickFix_1", appQuickFix);
1869     appQuickFix.deployingAppqfInfo.nativeLibraryPath = "wrong";
1870     infos.emplace("appQuickFix_2", appQuickFix);
1871 
1872     QuickFixChecker checker;
1873     auto ret = checker.CheckMultiNativeSo(infos);
1874     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SO_INCOMPATIBLE);
1875 }
1876 
1877 /**
1878  * @tc.number: BmsBundleQuickFixTest_0065
1879  * Function: CheckMultiNativeSo
1880  * @tc.name: test CheckMultiNativeSo
1881  * @tc.require: issueI5N7AD
1882  * @tc.desc: nativeLibraryPath
1883  */
1884 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0065, Function | SmallTest | Level0)
1885 {
1886     std::unordered_map<std::string, AppQuickFix> infos;
1887     AppQuickFix appQuickFix = CreateAppQuickFix();
1888     appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
1889     infos.emplace("appQuickFix_1", appQuickFix);
1890     appQuickFix.deployingAppqfInfo.cpuAbi = "wrong";
1891     infos.emplace("appQuickFix_2", appQuickFix);
1892 
1893     QuickFixChecker checker;
1894     auto ret = checker.CheckMultiNativeSo(infos);
1895     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SO_INCOMPATIBLE);
1896 }
1897 
1898 /**
1899  * @tc.number: BmsBundleQuickFixTest_0066
1900  * Function: CheckSignatureInfo
1901  * @tc.name: test CheckSignatureInfo
1902  * @tc.require: issueI5N7AD
1903  * @tc.desc: CheckSignatureInfo
1904  */
1905 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0066, Function | SmallTest | Level0)
1906 {
1907     BundleInfo bundleInfo;
1908     Security::Verify::ProvisionInfo provisionInfo;
1909     QuickFixChecker checker;
1910     auto ret = checker.CheckSignatureInfo(bundleInfo, provisionInfo);
1911     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SIGNATURE_INFO_NOT_SAME);
1912 }
1913 
1914 /**
1915  * @tc.number: BmsBundleQuickFixTest_0067
1916  * Function: CheckSignatureInfo
1917  * @tc.name: test CheckSignatureInfo
1918  * @tc.require: issueI5N7AD
1919  * @tc.desc: CheckSignatureInfo
1920  */
1921 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0067, Function | SmallTest | Level0)
1922 {
1923     BundleInfo bundleInfo;
1924     bundleInfo.name = "bundleName";
1925     Security::Verify::ProvisionInfo provisionInfo;
1926     provisionInfo.appId = "1";
1927     QuickFixChecker checker;
1928     auto ret = checker.CheckSignatureInfo(bundleInfo, provisionInfo);
1929     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SIGNATURE_INFO_NOT_SAME);
1930 }
1931 
1932 /**
1933  * @tc.number: BmsBundleQuickFixTest_0068
1934  * Function: CheckSignatureInfo
1935  * @tc.name: test CheckSignatureInfo
1936  * @tc.require: issueI5N7AD
1937  * @tc.desc: CheckSignatureInfo
1938  */
1939 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0068, Function | SmallTest | Level0)
1940 {
1941     BundleInfo bundleInfo;
1942     bundleInfo.appId = "_";
1943     bundleInfo.applicationInfo.appPrivilegeLevel = "normal";
1944     Security::Verify::ProvisionInfo provisionInfo;
1945     provisionInfo.bundleInfo.apl = "system_basic";
1946     QuickFixChecker checker;
1947     auto ret = checker.CheckSignatureInfo(bundleInfo, provisionInfo);
1948     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SIGNATURE_INFO_NOT_SAME);
1949 }
1950 
1951 /**
1952  * @tc.number: BmsBundleQuickFixTest_0069
1953  * Function: CheckModuleNameExist
1954  * @tc.name: test CheckModuleNameExist
1955  * @tc.require: issueI5N7AD
1956  * @tc.desc: CheckModuleNameExist
1957  */
1958 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0069, Function | SmallTest | Level0)
1959 {
1960     std::unordered_map<std::string, AppQuickFix> infos;
1961     AppQuickFix appQuickFix;
1962     infos.emplace("appQuickFix_1", appQuickFix);
1963 
1964     BundleInfo bundleInfo;
1965     QuickFixChecker checker;
1966     auto ret = checker.CheckModuleNameExist(bundleInfo, infos);
1967     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_MODULE_NAME_NOT_EXIST);
1968 }
1969 
1970 /**
1971  * @tc.number: BmsBundleQuickFixTest_0070
1972  * Function: CheckModuleNameExist
1973  * @tc.name: test CheckModuleNameExist
1974  * @tc.require: issueI5N7AD
1975  * @tc.desc: CheckModuleNameExist
1976  */
1977 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0070, Function | SmallTest | Level0)
1978 {
1979     std::unordered_map<std::string, AppQuickFix> infos;
1980     AppQuickFix appQuickFix = CreateAppQuickFix();
1981     infos.emplace("appQuickFix_1", appQuickFix);
1982 
1983     BundleInfo bundleInfo;
1984     QuickFixChecker checker;
1985     auto ret = checker.CheckModuleNameExist(bundleInfo, infos);
1986     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_MODULE_NAME_NOT_EXIST);
1987 }
1988 
1989 /**
1990  * @tc.number: BmsBundleQuickFixTest_0071
1991  * Function: CheckModuleNameExist
1992  * @tc.name: test CheckModuleNameExist
1993  * @tc.require: issueI5N7AD
1994  * @tc.desc: CheckModuleNameExist
1995  */
1996 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0071, Function | SmallTest | Level0)
1997 {
1998     std::unordered_map<std::string, AppQuickFix> infos;
1999     AppQuickFix appQuickFix = CreateAppQuickFix();
2000     infos.emplace("appQuickFix_1", appQuickFix);
2001 
2002     BundleInfo bundleInfo;
2003     bundleInfo.moduleNames.emplace_back("entry");
2004     QuickFixChecker checker;
2005     auto ret = checker.CheckModuleNameExist(bundleInfo, infos);
2006     EXPECT_EQ(ret, ERR_OK);
2007 }
2008 
2009 /**
2010  * @tc.number: BmsBundleQuickFixTest_0072
2011  * Function: CheckCommonWithInstalledBundle
2012  * @tc.name: test CheckCommonWithInstalledBundle
2013  * @tc.require: issueI5N7AD
2014  * @tc.desc: CheckCommonWithInstalledBundle
2015  */
2016 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0072, Function | SmallTest | Level0)
2017 {
2018     AppQuickFix appQuickFix = CreateAppQuickFix();
2019     BundleInfo bundleInfo;
2020     QuickFixChecker checker;
2021     auto ret = checker.CheckCommonWithInstalledBundle(appQuickFix, bundleInfo);
2022     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_BUNDLE_NAME_NOT_EXIST);
2023 }
2024 
2025 /**
2026  * @tc.number: BmsBundleQuickFixTest_0073
2027  * Function: CheckCommonWithInstalledBundle
2028  * @tc.name: test CheckCommonWithInstalledBundle
2029  * @tc.require: issueI5N7AD
2030  * @tc.desc: CheckCommonWithInstalledBundle
2031  */
2032 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0073, Function | SmallTest | Level0)
2033 {
2034     std::unordered_map<std::string, AppQuickFix> infos;
2035     AppqfInfo appInfo;
2036     appInfo.versionCode = QUICK_FIX_VERSION_CODE;
2037     appInfo.versionName = QUICK_FIX_VERSION_NAME;
2038     appInfo.type = QuickFixType::PATCH;
2039     AppQuickFix appQuickFix;
2040     appQuickFix.bundleName = BUNDLE_NAME;
2041     appQuickFix.versionCode = BUNDLE_VERSION_CODE;
2042     appQuickFix.versionName = BUNDLE_VERSION_NAME;
2043     appQuickFix.deployingAppqfInfo = appInfo;
2044     infos.emplace("appQuickFix_1", appQuickFix);
2045     infos.emplace("appQuickFix_2", appQuickFix);
2046 
2047     QuickFixChecker checker;
2048     ErrCode ret = checker.CheckAppQuickFixInfos(infos);
2049     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PROFILE_PARSE_FAILED);
2050 }
2051 
2052 /**
2053  * @tc.number: BmsBundleQuickFixTest_0074
2054  * Function: CheckHotReloadWithInstalledBundle
2055  * @tc.name: test CheckHotReloadWithInstalledBundle
2056  * @tc.require: issueI5N7AD
2057  * @tc.desc: CheckHotReloadWithInstalledBundle
2058  */
2059 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0074, Function | SmallTest | Level0)
2060 {
2061     AppQuickFix appQuickFix = CreateAppQuickFix();
2062     BundleInfo bundleInfo;
2063     QuickFixChecker checker;
2064     auto ret = checker.CheckHotReloadWithInstalledBundle(appQuickFix, bundleInfo);
2065     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_BUNDLE_NAME_NOT_EXIST);
2066 }
2067 
2068 /**
2069  * @tc.number: BmsBundleQuickFixTest_0075
2070  * Function: CheckPatchWithInstalledBundle
2071  * @tc.name: test CheckPatchWithInstalledBundle
2072  * @tc.require: issueI5N7AD
2073  * @tc.desc: CheckPatchWithInstalledBundle
2074  */
2075 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0075, Function | SmallTest | Level0)
2076 {
2077     AppQuickFix appQuickFix = CreateAppQuickFix();
2078     BundleInfo bundleInfo;
2079     Security::Verify::ProvisionInfo provisionInfo;
2080     QuickFixChecker checker;
2081     auto ret = checker.CheckPatchWithInstalledBundle(appQuickFix, bundleInfo, provisionInfo);
2082     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_BUNDLE_NAME_NOT_EXIST);
2083 }
2084 
2085 /**
2086  * @tc.number: BmsBundleQuickFixTest_0077
2087  * Function: CheckAppQuickFixInfos
2088  * @tc.name: test CheckAppQuickFixInfos
2089  * @tc.require: issueI5N7AD
2090  * @tc.desc: CheckAppQuickFixInfos
2091  */
2092 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0077, Function | SmallTest | Level0)
2093 {
2094     std::unordered_map<std::string, AppQuickFix> infos;
2095 
2096     QuickFixChecker checker;
2097     ErrCode ret = checker.CheckAppQuickFixInfos(infos);
2098     EXPECT_EQ(ret, ERR_OK);
2099 }
2100 
2101 /**
2102  * @tc.number: BmsBundleQuickFixTest_0078
2103  * Function: CheckAppQuickFixInfos
2104  * @tc.name: test CheckAppQuickFixInfos
2105  * @tc.require: issueI5N7AD
2106  * @tc.desc: CheckAppQuickFixInfos
2107  */
2108 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0078, Function | SmallTest | Level0)
2109 {
2110     std::unordered_map<std::string, AppQuickFix> infos;
2111     AppQuickFix appQuickFix = CreateAppQuickFix();
2112     std::vector<HqfInfo> hqfInfo;
2113     appQuickFix.deployingAppqfInfo.hqfInfos = hqfInfo;
2114     infos.emplace("appQuickFix_1", appQuickFix);
2115 
2116     QuickFixChecker checker;
2117     ErrCode ret = checker.CheckAppQuickFixInfos(infos);
2118     EXPECT_EQ(ret, ERR_OK);
2119 }
2120 
2121 /**
2122  * @tc.number: BmsBundleQuickFixTest_0079
2123  * Function: CheckMultipleHqfsSignInfo
2124  * @tc.name: test CheckMultipleHqfsSignInfo
2125  * @tc.require: issueI5N7AD
2126  * @tc.desc: CheckMultipleHqfsSignInfo
2127  */
2128 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0079, Function | SmallTest | Level0)
2129 {
2130     std::vector<std::string> bundlePaths;
2131     std::vector<Security::Verify::HapVerifyResult> hapVerifyRes;
2132     QuickFixChecker checker;
2133     ErrCode ret = checker.CheckMultipleHqfsSignInfo(bundlePaths, hapVerifyRes);
2134     EXPECT_EQ(ret, ERR_APPEXECFWK_INSTALL_PARAM_ERROR);
2135 }
2136 
2137 /**
2138  * @tc.number: BmsBundleQuickFixTest_0080
2139  * Function: ParseAndCheckAppQuickFixInfos
2140  * @tc.name: test ParseAndCheckAppQuickFixInfos
2141  * @tc.require: issueI5N7AD
2142  * @tc.desc: ParseAndCheckAppQuickFixInfos
2143  */
2144 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0080, Function | SmallTest | Level0)
2145 {
2146     auto deployer = GetQuickFixDeployer();
2147     EXPECT_FALSE(deployer == nullptr);
2148     if (deployer != nullptr) {
2149         std::vector<std::string> bundleFilePaths;
2150         std::unordered_map<std::string, AppQuickFix> infos;
2151         ErrCode ret = deployer->ParseAndCheckAppQuickFixInfos(bundleFilePaths, infos);
2152         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PROFILE_PARSE_FAILED);
2153     }
2154 }
2155 
2156 /**
2157  * @tc.number: BmsBundleQuickFixTest_0081
2158  * Function: AddHqfInfo
2159  * @tc.name: test AddHqfInfo
2160  * @tc.require: issueI5N7AD
2161  * @tc.desc: AddHqfInfo
2162  */
2163 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0081, Function | SmallTest | Level0)
2164 {
2165     InnerAppQuickFix innerAppQuickFix;
2166     AppQuickFix appQuickFix;
2167     auto ret = innerAppQuickFix.AddHqfInfo(appQuickFix);
2168     EXPECT_FALSE(ret);
2169 }
2170 
2171 /**
2172  * @tc.number: BmsBundleQuickFixTest_0082
2173  * Function: AddHqfInfo
2174  * @tc.name: test AddHqfInfo
2175  * @tc.require: issueI5N7AD
2176  * @tc.desc: AddHqfInfo
2177  */
2178 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0082, Function | SmallTest | Level0)
2179 {
2180     InnerAppQuickFix innerAppQuickFix;
2181     AppQuickFix appQuickFix = CreateAppQuickFix();
2182     auto ret = innerAppQuickFix.AddHqfInfo(appQuickFix);
2183     EXPECT_TRUE(ret);
2184     ret = innerAppQuickFix.AddHqfInfo(appQuickFix);
2185     EXPECT_TRUE(ret);
2186 }
2187 
2188 /**
2189  * @tc.number: BmsBundleQuickFixTest_0083
2190  * Function: AddHqfInfo
2191  * @tc.name: test AddHqfInfo
2192  * @tc.require: issueI5N7AD
2193  * @tc.desc: AddHqfInfo
2194  */
2195 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0083, Function | SmallTest | Level0)
2196 {
2197     InnerAppQuickFix innerAppQuickFix;
2198     AppQuickFix appQuickFix = CreateAppQuickFix();
2199     auto ret = innerAppQuickFix.AddHqfInfo(appQuickFix);
2200     EXPECT_TRUE(ret);
2201 }
2202 
2203 /**
2204  * @tc.number: BmsBundleQuickFixTest_0084
2205  * Function: ProcessPatchDeployStart
2206  * @tc.name: test ProcessPatchDeployStart
2207  * @tc.require: issueI5MZ5D
2208  * @tc.desc: ProcessPatchDeployStart
2209  */
2210 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0084, Function | SmallTest | Level0)
2211 {
2212     auto deployer = GetQuickFixDeployer();
2213     EXPECT_FALSE(deployer == nullptr);
2214     if (deployer != nullptr) {
2215         std::vector<std::string> bundleFilePaths;
2216         BundleInfo bundleInfo;
2217         std::unordered_map<std::string, AppQuickFix> infos;
2218         ErrCode ret = deployer->ProcessPatchDeployStart(bundleFilePaths, bundleInfo, infos);
2219         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PROFILE_PARSE_FAILED);
2220     }
2221 }
2222 
2223 /**
2224  * @tc.number: BmsBundleQuickFixTest_0085
2225  * Function: ProcessPatchDeployStart
2226  * @tc.name: test ProcessPatchDeployStart
2227  * @tc.require: issueI5MZ5D
2228  * @tc.desc: ProcessPatchDeployStart
2229  */
2230 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0085, Function | SmallTest | Level0)
2231 {
2232     auto deployer = GetQuickFixDeployer();
2233     EXPECT_FALSE(deployer == nullptr);
2234     if (deployer != nullptr) {
2235         std::vector<std::string> bundleFilePaths;
2236         BundleInfo bundleInfo;
2237         std::unordered_map<std::string, AppQuickFix> infos;
2238         AppQuickFix appQuickFix;
2239         infos.emplace("appQuickFix_1", appQuickFix);
2240         ErrCode ret = deployer->ProcessPatchDeployStart(bundleFilePaths, bundleInfo, infos);
2241         EXPECT_EQ(ret, ERR_APPEXECFWK_INSTALL_PARAM_ERROR);
2242     }
2243 }
2244 
2245 /**
2246  * @tc.number: BmsBundleQuickFixTest_0086
2247  * Function: ProcessPatchDeployStart
2248  * @tc.name: test ProcessPatchDeployStart
2249  * @tc.require: issueI5MZ5D
2250  * @tc.desc: ProcessPatchDeployStart
2251  */
2252 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0086, Function | SmallTest | Level0)
2253 {
2254     auto deployer = GetQuickFixDeployer();
2255     EXPECT_FALSE(deployer == nullptr);
2256     if (deployer != nullptr) {
2257         std::vector<std::string> bundleFilePaths;
2258         BundleInfo bundleInfo;
2259         std::unordered_map<std::string, AppQuickFix> infos;
2260         AppQuickFix appQuickFix = CreateAppQuickFix();
2261         appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
2262         infos.emplace("appQuickFix_1", appQuickFix);
2263         appQuickFix.deployingAppqfInfo.nativeLibraryPath = "wrong";
2264         infos.emplace("appQuickFix_2", appQuickFix);
2265         ErrCode ret = deployer->ProcessPatchDeployStart(bundleFilePaths, bundleInfo, infos);
2266         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SO_INCOMPATIBLE);
2267     }
2268 }
2269 
2270 /**
2271  * @tc.number: BmsBundleQuickFixTest_0087
2272  * Function: ProcessPatchDeployStart
2273  * @tc.name: test ProcessPatchDeployStart
2274  * @tc.require: issueI5MZ5D
2275  * @tc.desc: ProcessPatchDeployStart
2276  */
2277 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0087, Function | SmallTest | Level0)
2278 {
2279     AddInnerBundleInfo(BUNDLE_NAME, PROVISION_TYPE_DEBUG, QuickFixType::HOT_RELOAD);
2280     auto deployer = GetQuickFixDeployer();
2281     EXPECT_FALSE(deployer == nullptr);
2282     if (deployer != nullptr) {
2283         AppQuickFix appQuickFix = CreateAppQuickFix();
2284         appQuickFix.deployingAppqfInfo.versionCode = 2;
2285         appQuickFix.deployingAppqfInfo.type = QuickFixType::HOT_RELOAD;
2286         appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::HOT_RELOAD;
2287         BundleInfo bundleInfo;
2288         ErrCode ret = deployer->GetBundleInfo(appQuickFix.bundleName, bundleInfo);
2289         EXPECT_EQ(ret, ERR_OK);
2290         ret = deployer->ProcessHotReloadDeployStart(bundleInfo, appQuickFix);
2291         EXPECT_EQ(ret, ERR_OK);
2292     }
2293 
2294     UninstallBundleInfo(BUNDLE_NAME);
2295 }
2296 
2297 /**
2298  * @tc.number: BmsBundleQuickFixTest_0088
2299  * Function: ProcessPatchDeployStart
2300  * @tc.name: test ProcessPatchDeployStart
2301  * @tc.require: issueI5MZ5D
2302  * @tc.desc: ProcessPatchDeployStart
2303  */
2304 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0088, Function | SmallTest | Level0)
2305 {
2306     auto deployer = GetQuickFixDeployer();
2307     EXPECT_FALSE(deployer == nullptr);
2308     if (deployer != nullptr) {
2309         AppQuickFix appQuickFix = CreateAppQuickFix();
2310         BundleInfo bundleInfo;
2311         auto ret = deployer->ProcessHotReloadDeployStart(bundleInfo, appQuickFix);
2312         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_BUNDLE_NAME_NOT_EXIST);
2313     }
2314 }
2315 
2316 /**
2317  * @tc.number: BmsBundleQuickFixTest_0089
2318  * Function: ProcessPatchDeployStart
2319  * @tc.name: test ProcessPatchDeployStart
2320  * @tc.require: issueI5MZ5D
2321  * @tc.desc: ProcessPatchDeployStart
2322  */
2323 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0089, Function | SmallTest | Level0)
2324 {
2325     auto deployer = GetQuickFixDeployer();
2326     EXPECT_FALSE(deployer == nullptr);
2327     if (deployer != nullptr) {
2328         AppQuickFix appQuickFix = CreateAppQuickFix();
2329         BundleInfo bundleInfo;
2330         auto ret = deployer->ProcessHotReloadDeployStart(bundleInfo, appQuickFix);
2331         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_BUNDLE_NAME_NOT_EXIST);
2332         std::unordered_map<std::string, AppQuickFix> infos;
2333         deployer->ResetNativeSoAttrs(infos);
2334         std::vector<HqfInfo> hqfInfo;
2335         appQuickFix.deployingAppqfInfo.hqfInfos = hqfInfo;
2336         deployer->ResetNativeSoAttrs(appQuickFix);
2337         appQuickFix.deployingAppqfInfo.hqfInfos.emplace_back(HqfInfo());
2338         deployer->ResetNativeSoAttrs(appQuickFix);
2339     }
2340 }
2341 
2342 /**
2343  * @tc.number: BmsBundleQuickFixTest_0090
2344  * Function: FetchPatchNativeSoAttrs
2345  * @tc.name: test FetchPatchNativeSoAttrs
2346  * @tc.require: issueI5MZ5D
2347  * @tc.desc: FetchPatchNativeSoAttrs
2348  */
2349 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0090, Function | SmallTest | Level0)
2350 {
2351     auto deployer = GetQuickFixDeployer();
2352     EXPECT_FALSE(deployer == nullptr);
2353     if (deployer != nullptr) {
2354         AppqfInfo appqfInfo;
2355         HqfInfo hqfInfo;
2356         bool isLibIsolated = false;
2357         std::string nativeLibraryPath;
2358         std::string cpuAbi;
2359         auto ret = deployer->FetchPatchNativeSoAttrs(appqfInfo, hqfInfo, isLibIsolated,
2360             nativeLibraryPath, cpuAbi);
2361         EXPECT_FALSE(ret);
2362 
2363         isLibIsolated = true;
2364         ret = deployer->FetchPatchNativeSoAttrs(appqfInfo, hqfInfo, isLibIsolated,
2365             nativeLibraryPath, cpuAbi);
2366         EXPECT_FALSE(ret);
2367 
2368         AppQuickFix appQuickFix;
2369         ret = deployer->HasNativeSoInBundle(appQuickFix);
2370         EXPECT_FALSE(ret);
2371 
2372         appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
2373         hqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
2374         appQuickFix.deployingAppqfInfo.hqfInfos.emplace_back(hqfInfo);
2375         ret = deployer->HasNativeSoInBundle(appQuickFix);
2376         EXPECT_TRUE(ret);
2377     }
2378 }
2379 
2380 /**
2381  * @tc.number: BmsBundleQuickFixTest_0091
2382  * Function: ToInnerAppQuickFix
2383  * @tc.name: test ToInnerAppQuickFix
2384  * @tc.require: issueI5MZ5D
2385  * @tc.desc: ToInnerAppQuickFix
2386  */
2387 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0091, Function | SmallTest | Level0)
2388 {
2389     auto deployer = GetQuickFixDeployer();
2390     EXPECT_FALSE(deployer == nullptr);
2391     if (deployer != nullptr) {
2392         std::unordered_map<std::string, AppQuickFix> infos;
2393         InnerAppQuickFix oldInnerAppQuickFix;
2394         InnerAppQuickFix newInnerAppQuickFix;
2395         auto ret = deployer->ToInnerAppQuickFix(infos, oldInnerAppQuickFix, newInnerAppQuickFix);
2396         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_INTERNAL_ERROR);
2397 
2398         AppQuickFix appQuickFix = CreateAppQuickFix();
2399         infos.emplace("aaaa", appQuickFix);
2400         ret = deployer->ToInnerAppQuickFix(infos, oldInnerAppQuickFix, newInnerAppQuickFix);
2401         EXPECT_EQ(ret, ERR_OK);
2402     }
2403 }
2404 
2405 /**
2406  * @tc.number: BmsBundleQuickFixTest_0092
2407  * Function: CheckPatchVersionCode
2408  * @tc.name: test CheckPatchVersionCode
2409  * @tc.require: issueI5MZ5D
2410  * @tc.desc: CheckPatchVersionCode
2411  */
2412 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0092, Function | SmallTest | Level0)
2413 {
2414     auto deployer = GetQuickFixDeployer();
2415     EXPECT_FALSE(deployer == nullptr);
2416     if (deployer != nullptr) {
2417         AppQuickFix newAppQuickFix;
2418         AppQuickFix oldAppQuickFix;
2419         auto ret = deployer->CheckPatchVersionCode(newAppQuickFix, oldAppQuickFix);
2420         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_VERSION_CODE_ERROR);
2421 
2422         newAppQuickFix.deployingAppqfInfo.versionCode = 1;
2423         ret = deployer->CheckPatchVersionCode(newAppQuickFix, oldAppQuickFix);
2424         EXPECT_EQ(ret, ERR_OK);
2425 
2426         oldAppQuickFix.deployingAppqfInfo.versionCode = 2;
2427         ret = deployer->CheckPatchVersionCode(newAppQuickFix, oldAppQuickFix);
2428         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_VERSION_CODE_ERROR);
2429 
2430         oldAppQuickFix.deployedAppqfInfo.versionCode = 2;
2431         ret = deployer->CheckPatchVersionCode(newAppQuickFix, oldAppQuickFix);
2432         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_VERSION_CODE_ERROR);
2433 
2434         InnerAppQuickFix innerAppQuickFix;
2435         std::string targetPath;
2436         ret = deployer->MoveHqfFiles(innerAppQuickFix, targetPath);
2437         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
2438     }
2439 }
2440 
2441 /**
2442  * @tc.number: BmsBundleQuickFixTest_0093
2443  * Function: MoveHqfFiles
2444  * @tc.name: test MoveHqfFiles
2445  * @tc.require: issueI5MZ5D
2446  * @tc.desc: MoveHqfFiles
2447  */
2448 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0093, Function | SmallTest | Level0)
2449 {
2450     auto deployer = GetQuickFixDeployer();
2451     EXPECT_FALSE(deployer == nullptr);
2452     if (deployer != nullptr) {
2453         InnerAppQuickFix innerAppQuickFix;
2454         std::string targetPath;
2455         auto ret = deployer->MoveHqfFiles(innerAppQuickFix, targetPath);
2456         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
2457     }
2458 }
2459 
2460 /**
2461  * @tc.number: BmsBundleQuickFixTest_0094
2462  * Function: ToDeployEndStatus
2463  * @tc.name: test ToDeployEndStatus
2464  * @tc.require: issueI5N7AD
2465  * @tc.desc: ToDeployEndStatus nativeLibraryPath empty
2466  */
2467 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0094, Function | SmallTest | Level0)
2468 {
2469     AddInnerBundleInfo(BUNDLE_NAME);
2470     auto deployer = GetQuickFixDeployer();
2471     EXPECT_FALSE(deployer == nullptr);
2472     if (deployer != nullptr) {
2473         AppQuickFix appQuickFix = CreateAppQuickFix();
2474         appQuickFix.deployingAppqfInfo.type = QuickFixType::PATCH;
2475         appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::PATCH;
2476         appQuickFix.deployingAppqfInfo.nativeLibraryPath = "";
2477         InnerAppQuickFix newInnerAppQuickFix;
2478         newInnerAppQuickFix.SetAppQuickFix(appQuickFix);
2479         InnerAppQuickFix oldInnerAppQuickFix;
2480         ErrCode ret = deployer->ToDeployEndStatus(newInnerAppQuickFix, oldInnerAppQuickFix);
2481         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
2482     }
2483     UninstallBundleInfo(BUNDLE_NAME);
2484 }
2485 
2486 /**
2487  * @tc.number: BmsBundleQuickFixTest_0095
2488  * Function: ProcessPatchDeployEnd
2489  * @tc.name: test ProcessPatchDeployEnd
2490  * @tc.require: issueI5N7AD
2491  * @tc.desc: ProcessPatchDeployEnd nativeLibraryPath empty
2492  */
2493 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0095, Function | SmallTest | Level0)
2494 {
2495     AddInnerBundleInfo(BUNDLE_NAME);
2496     auto deployer = GetQuickFixDeployer();
2497     EXPECT_FALSE(deployer == nullptr);
2498     if (deployer != nullptr) {
2499         AppQuickFix appQuickFix = CreateAppQuickFix();
2500         appQuickFix.deployingAppqfInfo.type = QuickFixType::PATCH;
2501         appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::PATCH;
2502         appQuickFix.deployingAppqfInfo.nativeLibraryPath = "";
2503         std::string patchPath = "data/test";
2504         ErrCode ret = deployer->ProcessPatchDeployEnd(appQuickFix, patchPath);
2505         EXPECT_EQ(ret, ERR_OK);
2506         appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
2507         ret = deployer->ProcessPatchDeployEnd(appQuickFix, patchPath); // hap has no so file
2508         EXPECT_EQ(ret, ERR_OK);
2509     }
2510     UninstallBundleInfo(BUNDLE_NAME);
2511 }
2512 
2513 /**
2514  * @tc.number: BmsBundleQuickFixTest_0097
2515  * Function: DeployQuickFix
2516  * @tc.name: test DeployQuickFix
2517  * @tc.require: issueI5MZ5D
2518  * @tc.desc: DeployQuickFix
2519  */
2520 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0097, Function | SmallTest | Level0)
2521 {
2522     QuickFixManagerHostImpl quickFixManagerHostImpl;
2523     std::vector<std::string> path;
2524     sptr<MockQuickFixCallback> callback = nullptr;
2525     auto res = quickFixManagerHostImpl.DeployQuickFix(path, callback);
2526     EXPECT_EQ(res, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
2527     callback = new (std::nothrow) MockQuickFixCallback();
2528     res = quickFixManagerHostImpl.DeployQuickFix(path, callback);
2529     EXPECT_EQ(res, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
2530     callback = nullptr;
2531     path.push_back("data/test");
2532     res = quickFixManagerHostImpl.DeployQuickFix(path, callback);
2533     EXPECT_EQ(res, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
2534 }
2535 
2536 /**
2537  * @tc.number: BmsBundleQuickFixTest_0098
2538  * Function: CreateFd
2539  * @tc.name: test CreateFd
2540  * @tc.require: issueI5MZ5D
2541  * @tc.desc: CreateFd
2542  */
2543 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0098, Function | SmallTest | Level0)
2544 {
2545     QuickFixManagerHostImpl quickFixManagerHostImpl;
2546     std::string fileName = "test.hqf";
2547     int32_t fd = -1;
2548     std::string path = "";
2549     auto res = quickFixManagerHostImpl.CreateFd(fileName, fd, path);
2550     EXPECT_EQ(res, ERR_OK);
2551     fd = 8;
2552     res = quickFixManagerHostImpl.CreateFd(fileName, fd, path);
2553     EXPECT_EQ(res, ERR_OK);
2554     path = "data/test";
2555     res = quickFixManagerHostImpl.CreateFd(fileName, fd, path);
2556     EXPECT_EQ(res, ERR_OK);
2557     fileName = "";
2558     res = quickFixManagerHostImpl.CreateFd(fileName, fd, path);
2559     EXPECT_EQ(res, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
2560 
2561     fileName = "../test.hqf";
2562     res = quickFixManagerHostImpl.CreateFd(fileName, fd, path);
2563     EXPECT_EQ(res, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
2564 
2565     fileName = "/test.hqf";
2566     res = quickFixManagerHostImpl.CreateFd(fileName, fd, path);
2567     EXPECT_EQ(res, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
2568 
2569     fileName = "\\test.hqf";
2570     res = quickFixManagerHostImpl.CreateFd(fileName, fd, path);
2571     EXPECT_EQ(res, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
2572 
2573     fileName = "%test.hqf";
2574     res = quickFixManagerHostImpl.CreateFd(fileName, fd, path);
2575     EXPECT_EQ(res, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
2576 }
2577 
2578 /**
2579  * @tc.number: BmsBundleQuickFixTest_0099
2580  * Function: DefaultNativeSo
2581  * @tc.name: test DefaultNativeSo
2582  * @tc.require: issueI5MZ5D
2583  * @tc.desc: DefaultNativeSo
2584  */
2585 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0099, Function | SmallTest | Level0)
2586 {
2587     PatchProfile patchProfile;
2588     PatchExtractor patchExtractor(ServiceConstants::LIBS + ServiceConstants::ARM64_V8A);
2589     bool isSystemLib64Exist = true;
2590     AppqfInfo deployedAppqfInfo;
2591     deployedAppqfInfo.versionCode = QUICK_FIX_VERSION_CODE;
2592     deployedAppqfInfo.versionName =  QUICK_FIX_VERSION_NAME;
2593     deployedAppqfInfo.cpuAbi = QUICK_FIX_ABI;
2594     deployedAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
2595     deployedAppqfInfo.type = QuickFixType::HOT_RELOAD;
2596     bool res = patchProfile.DefaultNativeSo(patchExtractor, isSystemLib64Exist, deployedAppqfInfo);
2597     EXPECT_EQ(res, false);
2598 }
2599 
2600 /**
2601  * @tc.number: BmsBundleQuickFixTest_0100
2602  * Function: DefaultNativeSo
2603  * @tc.name: test DefaultNativeSo
2604  * @tc.require: issueI5MZ5D
2605  * @tc.desc: DefaultNativeSo
2606  */
2607 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0100, Function | SmallTest | Level0)
2608 {
2609     PatchProfile patchProfile;
2610     PatchExtractor patchExtractor("");
2611     bool isSystemLib64Exist = true;
2612     AppqfInfo deployedAppqfInfo;
2613     deployedAppqfInfo.versionCode = QUICK_FIX_VERSION_CODE;
2614     deployedAppqfInfo.versionName =  QUICK_FIX_VERSION_NAME;
2615     deployedAppqfInfo.cpuAbi = QUICK_FIX_ABI;
2616     deployedAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
2617     deployedAppqfInfo.type = QuickFixType::HOT_RELOAD;
2618     bool res = patchProfile.DefaultNativeSo(patchExtractor, isSystemLib64Exist, deployedAppqfInfo);
2619     EXPECT_EQ(res, false);
2620 }
2621 
2622 /**
2623  * @tc.number: BmsBundleQuickFixTest_0101
2624  * Function: ProcessPatchDeployEnd
2625  * @tc.name: test ProcessPatchDeployEnd
2626  * @tc.require: issueI5N7AD
2627  * @tc.desc: ProcessPatchDeployEnd isDebug is true, provisionType is release
2628  */
2629 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0101, Function | SmallTest | Level0)
2630 {
2631     AddInnerBundleInfo(BUNDLE_NAME);
2632     std::vector<std::string> bundleFilePaths;
2633     auto deployer = std::make_shared<QuickFixDeployer>(bundleFilePaths, true);
2634     EXPECT_FALSE(deployer == nullptr);
2635     if (deployer != nullptr) {
2636         AppQuickFix appQuickFix = CreateAppQuickFix();
2637         appQuickFix.deployingAppqfInfo.type = QuickFixType::PATCH;
2638         appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::PATCH;
2639         appQuickFix.deployingAppqfInfo.nativeLibraryPath = "";
2640         std::string patchPath = "data/test";
2641         ErrCode ret = deployer->ProcessPatchDeployEnd(appQuickFix, patchPath);
2642         EXPECT_EQ(ret, ERR_OK);
2643     }
2644     UninstallBundleInfo(BUNDLE_NAME);
2645 }
2646 
2647 /**
2648  * @tc.number: BmsBundleQuickFixTest_0102
2649  * Function: ProcessPatchDeployEnd
2650  * @tc.name: test ProcessPatchDeployEnd
2651  * @tc.require: issueI5N7AD
2652  * @tc.desc: ProcessPatchDeployEnd isDebug is true, provisionType is debug
2653  */
2654 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0102, Function | SmallTest | Level0)
2655 {
2656     AddInnerBundleInfo(BUNDLE_NAME, PROVISION_TYPE_DEBUG);
2657     std::vector<std::string> bundleFilePaths;
2658     auto deployer = std::make_shared<QuickFixDeployer>(bundleFilePaths, true);
2659     EXPECT_FALSE(deployer == nullptr);
2660     if (deployer != nullptr) {
2661         AppQuickFix appQuickFix = CreateAppQuickFix();
2662         appQuickFix.deployingAppqfInfo.type = QuickFixType::PATCH;
2663         appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::PATCH;
2664         appQuickFix.deployingAppqfInfo.nativeLibraryPath = "";
2665         std::string patchPath = "data/test";
2666         ErrCode ret = deployer->ProcessPatchDeployEnd(appQuickFix, patchPath);
2667         EXPECT_EQ(ret, ERR_OK);
2668     }
2669     UninstallBundleInfo(BUNDLE_NAME);
2670 }
2671 
2672 /**
2673  * @tc.number: BmsBundleQuickFixTest_0103
2674  * Function: ProcessPatchDeployEnd
2675  * @tc.name: test ProcessPatchDeployEnd
2676  * @tc.require: issueI5N7AD
2677  * @tc.desc: ProcessPatchDeployEnd isDebug is true, provisionType is release
2678  */
2679 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0103, Function | SmallTest | Level0)
2680 {
2681     AddInnerBundleInfo(BUNDLE_NAME);
2682     std::vector<std::string> bundleFilePaths;
2683     auto deployer = std::make_shared<QuickFixDeployer>(bundleFilePaths, true);
2684     EXPECT_FALSE(deployer == nullptr);
2685     if (deployer != nullptr) {
2686         AppQuickFix appQuickFix = CreateAppQuickFix();
2687         appQuickFix.deployingAppqfInfo.type = QuickFixType::PATCH;
2688         appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::PATCH;
2689         appQuickFix.deployingAppqfInfo.nativeLibraryPath = "";
2690         std::string patchPath = "data/test";
2691         ErrCode ret = deployer->ProcessPatchDeployEnd(appQuickFix, patchPath);
2692         EXPECT_EQ(ret, ERR_OK);
2693     }
2694     UninstallBundleInfo(BUNDLE_NAME);
2695 }
2696 
2697 /**
2698  * @tc.number: BmsBundleQuickFixTest_0104
2699  * Function: ExtractQuickFixSoFile
2700  * @tc.name: test ExtractQuickFixSoFile
2701  * @tc.require: issueI5N7AD
2702  * @tc.desc: ExtractQuickFixSoFile
2703  */
2704 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0104, Function | SmallTest | Level0)
2705 {
2706     AddInnerBundleInfo(BUNDLE_NAME);
2707     auto deployer = GetQuickFixDeployer();
2708     EXPECT_FALSE(deployer == nullptr);
2709     if (deployer != nullptr) {
2710         AppQuickFix appQuickFix;
2711         std::string patchPath = "data/test";
2712         BundleInfo bundleInfo;
2713         auto ret = deployer->ExtractQuickFixSoFile(appQuickFix, patchPath, bundleInfo);
2714         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PROFILE_PARSE_FAILED);
2715 
2716         appQuickFix = CreateAppQuickFix();
2717         // moduleName not exist
2718         ret = deployer->ExtractQuickFixSoFile(appQuickFix, patchPath, bundleInfo);
2719         EXPECT_EQ(ret, ERR_OK);
2720 
2721         HapModuleInfo info;
2722         info.moduleName = "entry";
2723         bundleInfo.hapModuleInfos.emplace_back(info);
2724         // moduleName exist, so not exist
2725         ret = deployer->ExtractQuickFixSoFile(appQuickFix, patchPath, bundleInfo);
2726         EXPECT_EQ(ret, ERR_OK);
2727         // so exist
2728         appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
2729         ret = deployer->ExtractQuickFixSoFile(appQuickFix, patchPath, bundleInfo);
2730         EXPECT_EQ(ret, ERR_OK);
2731     }
2732     UninstallBundleInfo(BUNDLE_NAME);
2733 }
2734 
2735 /**
2736  * @tc.number: BmsBundleQuickFixTest_0105
2737  * Function: ExtractQuickFixSoFile
2738  * @tc.name: test ExtractQuickFixSoFile
2739  * @tc.require: issueI5N7AD
2740  * @tc.desc: ExtractQuickFixSoFile
2741  */
2742 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0105, Function | SmallTest | Level0)
2743 {
2744     AddInnerBundleInfo(BUNDLE_NAME);
2745     auto deployer = GetQuickFixDeployer();
2746     EXPECT_FALSE(deployer == nullptr);
2747     if (deployer != nullptr) {
2748         AppQuickFix appQuickFix;
2749         std::string patchPath = "data/test";
2750         BundleInfo bundleInfo;
2751         auto ret = deployer->ExtractSoAndApplyDiff(appQuickFix, bundleInfo, patchPath);
2752         EXPECT_EQ(ret, ERR_OK);
2753 
2754         appQuickFix = CreateAppQuickFix();
2755         ret = deployer->ExtractSoAndApplyDiff(appQuickFix, bundleInfo, patchPath);
2756         EXPECT_EQ(ret, ERR_OK);
2757 
2758         HapModuleInfo info;
2759         info.moduleName = "entry";
2760         bundleInfo.hapModuleInfos.emplace_back(info);
2761 
2762         ret = deployer->ExtractSoAndApplyDiff(appQuickFix, bundleInfo, patchPath);
2763         EXPECT_EQ(ret, ERR_OK);
2764         // so exist
2765         appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
2766         ret = deployer->ExtractSoAndApplyDiff(appQuickFix, bundleInfo, patchPath);
2767         EXPECT_EQ(ret, ERR_OK);
2768     }
2769     UninstallBundleInfo(BUNDLE_NAME);
2770 }
2771 
2772 /**
2773  * @tc.number: BmsBundleQuickFixTest_0106
2774  * Function: ExtractQuickFixSoFile
2775  * @tc.name: test ExtractQuickFixSoFile
2776  * @tc.require: issueI5N7AD
2777  * @tc.desc: ExtractQuickFixSoFile
2778  */
2779 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0106, Function | SmallTest | Level0)
2780 {
2781     AddInnerBundleInfo(BUNDLE_NAME);
2782     auto deployer = GetQuickFixDeployer();
2783     EXPECT_FALSE(deployer == nullptr);
2784     if (deployer != nullptr) {
2785         AppQuickFix appQuickFix;
2786         std::string patchPath = "data/test";
2787         BundleInfo bundleInfo;
2788         appQuickFix = CreateAppQuickFix();
2789         appQuickFix.bundleName = "error";
2790         auto ret = deployer->ExtractSoAndApplyDiff(appQuickFix, bundleInfo, patchPath);
2791         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_BUNDLE_NAME_NOT_EXIST);
2792     }
2793     UninstallBundleInfo(BUNDLE_NAME);
2794 }
2795 
2796 /**
2797  * @tc.number: BmsBundleQuickFixTest_0107
2798  * Function: ExtractQuickFixSoFile
2799  * @tc.name: test ExtractQuickFixSoFile
2800  * @tc.require: issueI5N7AD
2801  * @tc.desc: ExtractQuickFixSoFile
2802  */
2803 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0107, Function | SmallTest | Level0)
2804 {
2805     AddInnerBundleInfo(BUNDLE_NAME);
2806     auto deployer = GetQuickFixDeployer();
2807     EXPECT_FALSE(deployer == nullptr);
2808     if (deployer != nullptr) {
2809         AppQuickFix appQuickFix;
2810         std::string patchPath = "data/test";
2811         BundleInfo bundleInfo;
2812         appQuickFix = CreateAppQuickFix();
2813         auto &appQfInfo = appQuickFix.deployingAppqfInfo;
2814         for (auto &hqf : appQfInfo.hqfInfos) {
2815             hqf.moduleName = "name";
2816         }
2817         auto ret = deployer->ExtractSoAndApplyDiff(appQuickFix, bundleInfo, patchPath);
2818         EXPECT_EQ(ret, ERR_OK);
2819     }
2820     UninstallBundleInfo(BUNDLE_NAME);
2821 }
2822 
2823 /**
2824  * @tc.number: BmsBundleQuickFixTest_0110
2825  * Function: DefaultNativeSo
2826  * @tc.name: test DefaultNativeSo
2827  * @tc.require: issueI5MZ5D
2828  * @tc.desc: DefaultNativeSo
2829  */
2830 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0110, Function | SmallTest | Level0)
2831 {
2832     PatchProfile patchProfile;
2833     PatchExtractor patchExtractor(ServiceConstants::LIBS + ServiceConstants::ARM_EABI_V7A);
2834     bool isSystemLib64Exist = false;
2835     AppqfInfo deployedAppqfInfo;
2836     deployedAppqfInfo.versionCode = QUICK_FIX_VERSION_CODE;
2837     deployedAppqfInfo.versionName =  QUICK_FIX_VERSION_NAME;
2838     deployedAppqfInfo.cpuAbi = QUICK_FIX_ABI;
2839     deployedAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
2840     deployedAppqfInfo.type = QuickFixType::HOT_RELOAD;
2841     bool res = patchProfile.DefaultNativeSo(patchExtractor, isSystemLib64Exist, deployedAppqfInfo);
2842     EXPECT_EQ(res, false);
2843 }
2844 
2845 /**
2846  * @tc.number: BmsBundleQuickFixTest_0120
2847  * Function: DefaultNativeSo
2848  * @tc.name: test DefaultNativeSo
2849  * @tc.require: issueI5MZ5D
2850  * @tc.desc: DefaultNativeSo
2851  */
2852 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0120, Function | SmallTest | Level0)
2853 {
2854     PatchProfile patchProfile;
2855     PatchExtractor patchExtractor(ServiceConstants::LIBS + ServiceConstants::ARM_EABI);
2856     bool isSystemLib64Exist = false;
2857     AppqfInfo deployedAppqfInfo;
2858     deployedAppqfInfo.versionCode = QUICK_FIX_VERSION_CODE;
2859     deployedAppqfInfo.versionName =  QUICK_FIX_VERSION_NAME;
2860     deployedAppqfInfo.cpuAbi = QUICK_FIX_ABI;
2861     deployedAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
2862     deployedAppqfInfo.type = QuickFixType::HOT_RELOAD;
2863     bool res = patchProfile.DefaultNativeSo(patchExtractor, isSystemLib64Exist, deployedAppqfInfo);
2864     EXPECT_EQ(res, false);
2865 }
2866 
2867 /**
2868  * @tc.number: BmsBundleQuickFixTest_0130
2869  * Function: DefaultNativeSo
2870  * @tc.name: test DefaultNativeSo
2871  * @tc.require: issueI5MZ5D
2872  * @tc.desc: DefaultNativeSo
2873  */
2874 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0130, Function | SmallTest | Level0)
2875 {
2876     PatchProfile patchProfile;
2877     PatchExtractor patchExtractor("");
2878     bool isSystemLib64Exist = false;
2879     AppqfInfo deployedAppqfInfo;
2880     bool res = patchProfile.DefaultNativeSo(patchExtractor, isSystemLib64Exist, deployedAppqfInfo);
2881     EXPECT_EQ(res, false);
2882 }
2883 
2884 /**
2885  * @tc.number: BmsBundleQuickFixTest_0140
2886  * Function: ParseNativeSo
2887  * @tc.name: test ParseNativeSo
2888  * @tc.require: issueI5MZ5D
2889  * @tc.desc: ParseNativeSo
2890  */
2891 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0140, Function | SmallTest | Level0)
2892 {
2893     PatchProfile patchProfile;
2894     PatchExtractor patchExtractor("");
2895     AppqfInfo deployedAppqfInfo;
2896     bool res = patchProfile.ParseNativeSo(patchExtractor, deployedAppqfInfo);
2897     EXPECT_EQ(res, true);
2898 }
2899 
2900 /**
2901  * @tc.number: BmsBundleQuickFixTest_0150
2902  * Function: ParseNativeSo
2903  * @tc.name: test ParseNativeSo
2904  * @tc.require: issueI5MZ5D
2905  * @tc.desc: ParseNativeSo
2906  */
2907 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0150, Function | SmallTest | Level0)
2908 {
2909     PatchProfile patchProfile;
2910     PatchExtractor patchExtractor("");
2911     AppqfInfo deployedAppqfInfo;
2912     deployedAppqfInfo.versionCode = QUICK_FIX_VERSION_CODE;
2913     deployedAppqfInfo.versionName =  QUICK_FIX_VERSION_NAME;
2914     deployedAppqfInfo.cpuAbi = QUICK_FIX_ABI;
2915     deployedAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
2916     deployedAppqfInfo.type = QuickFixType::HOT_RELOAD;
2917     bool res = patchProfile.ParseNativeSo(patchExtractor, deployedAppqfInfo);
2918     EXPECT_EQ(res, true);
2919 }
2920 
2921 /**
2922  * @tc.number: BmsBundleQuickFixTest_0160
2923  * Function: ParseNativeSo
2924  * @tc.name: test ParseNativeSo
2925  * @tc.require: issueI5MZ5D
2926  * @tc.desc: ParseNativeSo
2927  */
2928 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0160, Function | SmallTest | Level0)
2929 {
2930     PatchProfile patchProfile;
2931     PatchExtractor patchExtractor(ServiceConstants::LIBS);
2932     AppqfInfo deployedAppqfInfo;
2933     deployedAppqfInfo.versionCode = QUICK_FIX_VERSION_CODE;
2934     deployedAppqfInfo.versionName =  QUICK_FIX_VERSION_NAME;
2935     deployedAppqfInfo.cpuAbi = QUICK_FIX_ABI;
2936     deployedAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
2937     deployedAppqfInfo.type = QuickFixType::HOT_RELOAD;
2938     bool res = patchProfile.ParseNativeSo(patchExtractor, deployedAppqfInfo);
2939     EXPECT_EQ(res, true);
2940 }
2941 
2942 /**
2943  * @tc.number: BmsBundleQuickFixTest_0170
2944  * Function: ParseNativeSo
2945  * @tc.name: test ParseNativeSo
2946  * @tc.require: issueI5MZ5D
2947  * @tc.desc: ParseNativeSo
2948  */
2949 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0170, Function | SmallTest | Level0)
2950 {
2951     PatchProfile patchProfile;
2952     PatchExtractor patchExtractor(ServiceConstants::LIBS);
2953     AppqfInfo deployedAppqfInfo;
2954     deployedAppqfInfo.versionCode = QUICK_FIX_VERSION_CODE;
2955     deployedAppqfInfo.versionName =  QUICK_FIX_VERSION_NAME;
2956     deployedAppqfInfo.cpuAbi = "arm";
2957     deployedAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
2958     deployedAppqfInfo.type = QuickFixType::HOT_RELOAD;
2959     bool res = patchProfile.ParseNativeSo(patchExtractor, deployedAppqfInfo);
2960     EXPECT_EQ(res, true);
2961 }
2962 
2963 /**
2964  * @tc.number: BmsBundleQuickFixTest_0180
2965  * Function: ParsePatchInfo
2966  * @tc.name: test ParsePatchInfo
2967  * @tc.require: issueI5MZ5D
2968  * @tc.desc: ParsePatchInfo
2969  */
2970 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0180, Function | SmallTest | Level0)
2971 {
2972     PatchParser patchParser;
2973     const std::string pathName = "";
2974     AppQuickFix appQuickFix = CreateAppQuickFix();
2975     ErrCode res = patchParser.ParsePatchInfo(pathName, appQuickFix);
2976     EXPECT_EQ(res, ERR_APPEXECFWK_PARSE_NO_PROFILE);
2977 }
2978 
2979 /**
2980  * @tc.number: BmsBundleQuickFixTest_0190
2981  * Function: ParsePatchInfo
2982  * @tc.name: test ParsePatchInfo
2983  * @tc.require: issueI5MZ5D
2984  * @tc.desc: ParsePatchInfo
2985  */
2986 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0190, Function | SmallTest | Level0)
2987 {
2988     PatchParser patchParser;
2989     const std::string pathName = "wrong";
2990     AppQuickFix appQuickFix = CreateAppQuickFix();
2991     ErrCode res = patchParser.ParsePatchInfo(pathName, appQuickFix);
2992     EXPECT_EQ(res, ERR_APPEXECFWK_PARSE_UNEXPECTED);
2993 }
2994 
2995 /**
2996  * @tc.number: BmsBundleQuickFixTest_0200
2997  * Function: InnerDeletePatchDir
2998  * @tc.name: test InnerDeletePatchDir
2999  * @tc.require: issueI5N7AD
3000  * @tc.desc: InnerDeletePatchDir, bundleName is not existed
3001  */
3002 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0200, Function | SmallTest | Level0)
3003 {
3004     auto deleter = GetQuickFixDeleter();
3005     EXPECT_FALSE(deleter == nullptr);
3006     if (deleter != nullptr) {
3007         AppqfInfo deployedAppqfInfo;
3008         deployedAppqfInfo.type = QuickFixType::UNKNOWN;
3009         ErrCode ret = deleter->InnerDeletePatchDir(deployedAppqfInfo, BUNDLE_NAME);
3010         EXPECT_EQ(ret, ERR_OK);
3011     }
3012 }
3013 
3014 /**
3015  * @tc.number: BmsBundleQuickFixTest_0210
3016  * Function: InnerDeletePatchDir
3017  * @tc.name: test InnerDeletePatchDir
3018  * @tc.require: issueI5N7AD
3019  * @tc.desc: InnerDeletePatchDir, bundleName is not existed
3020  */
3021 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0210, Function | SmallTest | Level0)
3022 {
3023     auto deleter = GetQuickFixDeleter();
3024     EXPECT_FALSE(deleter == nullptr);
3025     if (deleter != nullptr) {
3026         AppqfInfo deployedAppqfInfo;
3027         deployedAppqfInfo.versionCode = QUICK_FIX_VERSION_CODE;
3028         deployedAppqfInfo.versionName =  QUICK_FIX_VERSION_NAME;
3029         deployedAppqfInfo.cpuAbi = "arm";
3030         deployedAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
3031         deployedAppqfInfo.type = QuickFixType::HOT_RELOAD;
3032         ErrCode ret = deleter->InnerDeletePatchDir(deployedAppqfInfo, BUNDLE_NAME);
3033         EXPECT_EQ(ret, ERR_OK);
3034     }
3035 }
3036 
3037 /**
3038  * @tc.number: BmsBundleQuickFixTest_0220
3039  * Function: QueryInnerAppQuickFix
3040  * @tc.name: test QueryInnerAppQuickFix
3041  * @tc.require: issueI5N7AD
3042  * @tc.desc: QueryInnerAppQuickFix
3043  */
3044 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0220, Function | SmallTest | Level0)
3045 {
3046     auto quickFixMgr = GetQuickFixDataMgr()->quickFixManagerDb_;
3047     if (quickFixMgr != nullptr) {
3048         InnerAppQuickFix innerAppQuickFix;
3049         bool ret = quickFixMgr->QueryInnerAppQuickFix("", innerAppQuickFix);
3050         EXPECT_FALSE(ret);
3051     }
3052 }
3053 
3054 /**
3055  * @tc.number: BmsBundleQuickFixTest_0230
3056  * Function: EnableQuickFix
3057  * @tc.name: test EnableQuickFix
3058  * @tc.require: issueI5N7AD
3059  * @tc.desc: EnableQuickFix, bundleName not exists
3060  */
3061 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0230, Function | SmallTest | Level0)
3062 {
3063     auto switcher = GetQuickFixSwitcher();
3064     EXPECT_FALSE(switcher == nullptr);
3065     if (switcher != nullptr) {
3066         ErrCode ret = switcher->EnableQuickFix("");
3067         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
3068     }
3069 }
3070 
3071 /**
3072  * @tc.number: BmsBundleQuickFixTest_0240
3073  * Function: DisableQuickFix
3074  * @tc.name: test DisableQuickFix
3075  * @tc.require: issueI5N7AD
3076  * @tc.desc: DisableQuickFix, bundleName not exists
3077  */
3078 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0240, Function | SmallTest | Level0)
3079 {
3080     auto switcher = GetQuickFixSwitcher();
3081     EXPECT_FALSE(switcher == nullptr);
3082     if (switcher != nullptr) {
3083         ErrCode ret = switcher->DisableQuickFix("");
3084         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
3085     }
3086 }
3087 
3088 /**
3089  * @tc.number: BmsBundleQuickFixTest_0250
3090  * Function: InnerSwitchQuickFix
3091  * @tc.name: test InnerSwitchQuickFix
3092  * @tc.require: issueI5N7AD
3093  * @tc.desc: InnerSwitchQuickFix
3094  */
3095 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0250, Function | SmallTest | Level0)
3096 {
3097     AddInnerBundleInfo(BUNDLE_NAME, PROVISION_TYPE_DEBUG, QuickFixType::HOT_RELOAD);
3098 
3099     auto switcher = GetQuickFixSwitcher();
3100     EXPECT_FALSE(switcher == nullptr);
3101     if (switcher != nullptr) {
3102         InnerAppQuickFix innerAppQuickFix;
3103         ErrCode ret = switcher->InnerSwitchQuickFix("", innerAppQuickFix, false);
3104         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
3105         AppQuickFix appQuickFix = CreateAppQuickFix();
3106         appQuickFix.deployingAppqfInfo.type = QuickFixType::HOT_RELOAD;
3107         appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::HOT_RELOAD;
3108         appQuickFix.deployingAppqfInfo.nativeLibraryPath = "";
3109         InnerAppQuickFix newInnerAppQuickFix;
3110         newInnerAppQuickFix.SetAppQuickFix(appQuickFix);
3111         ret = switcher->InnerSwitchQuickFix(BUNDLE_NAME, newInnerAppQuickFix, true);
3112         EXPECT_EQ(ret, ERR_OK);
3113     }
3114 
3115     UninstallBundleInfo(BUNDLE_NAME);
3116 }
3117 
3118 /**
3119  * @tc.number: BmsBundleQuickFixTest_0260
3120  * Function: InnerSwitchQuickFix
3121  * @tc.name: test InnerSwitchQuickFix
3122  * @tc.require: issueI5N7AD
3123  * @tc.desc: InnerSwitchQuickFix
3124  */
3125 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0260, Function | SmallTest | Level0)
3126 {
3127     AddInnerBundleInfo(BUNDLE_NAME, PROVISION_TYPE_DEBUG, QuickFixType::HOT_RELOAD);
3128 
3129     auto switcher = GetQuickFixSwitcher();
3130     EXPECT_FALSE(switcher == nullptr);
3131     if (switcher != nullptr) {
3132         AppQuickFix appQuickFix = CreateAppQuickFix();
3133         appQuickFix.deployingAppqfInfo.type = QuickFixType::HOT_RELOAD;
3134         appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::HOT_RELOAD;
3135         appQuickFix.deployingAppqfInfo.nativeLibraryPath = "";
3136         InnerAppQuickFix newInnerAppQuickFix;
3137         newInnerAppQuickFix.SetAppQuickFix(appQuickFix);
3138         InnerBundleInfo innerBundleInfo;
3139         ErrCode ret = switcher->CreateInnerAppqf(innerBundleInfo, true, newInnerAppQuickFix);
3140         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_OLD_PATCH_OR_HOT_RELOAD_IN_DB);
3141     }
3142 
3143     UninstallBundleInfo(BUNDLE_NAME);
3144 }
3145 
3146 /**
3147  * @tc.number: BmsBundleQuickFixTest_0270
3148  * Function: CheckPatchNativeSoWithInstalledBundle
3149  * @tc.name: test CheckPatchNativeSoWithInstalledBundle
3150  * @tc.require: issueI5N7AD
3151  * @tc.desc: CheckPatchNativeSoWithInstalledBundle
3152  */
3153 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0270, Function | SmallTest | Level0)
3154 {
3155     AddInnerBundleInfo(BUNDLE_NAME, PROVISION_TYPE_DEBUG);
3156 
3157     auto deployer = GetQuickFixDeployer();
3158     EXPECT_FALSE(deployer == nullptr);
3159     if (deployer != nullptr) {
3160         BundleInfo bundleInfo;
3161         ErrCode ret = deployer->GetBundleInfo(BUNDLE_NAME, bundleInfo);
3162         EXPECT_EQ(ret, ERR_OK);
3163         AppqfInfo deployedAppqfInfo;
3164         deployedAppqfInfo.cpuAbi = bundleInfo.applicationInfo.cpuAbi;
3165         QuickFixChecker checker;
3166         ret = checker.CheckPatchNativeSoWithInstalledBundle(bundleInfo, deployedAppqfInfo);
3167         EXPECT_EQ(ret, ERR_OK);
3168     }
3169 
3170     UninstallBundleInfo(BUNDLE_NAME);
3171 }
3172 
3173 /**
3174  * @tc.number: BmsBundleQuickFixTest_0280
3175  * Function: CheckMultiNativeSo
3176  * @tc.name: test CheckMultiNativeSo
3177  * @tc.require: issueI5N7AD
3178  * @tc.desc: CheckMultiNativeSo
3179  */
3180 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0280, Function | SmallTest | Level0)
3181 {
3182     std::unordered_map<std::string, AppQuickFix> infos;
3183     AppQuickFix appQuickFix = CreateAppQuickFix();
3184     infos.emplace("appQuickFix_1", appQuickFix);
3185     appQuickFix.deployingAppqfInfo.nativeLibraryPath = "";
3186 
3187     QuickFixChecker checker;
3188     auto ret = checker.CheckMultiNativeSo(infos);
3189     EXPECT_EQ(ret, ERR_OK);
3190 }
3191 
3192 /**
3193  * @tc.number: BmsBundleQuickFixTest_0500
3194  * Function: VerifyCodeSignatureForHqf
3195  * @tc.name: test VerifyCodeSignatureForHqf
3196  * @tc.require: issueI8ZR55
3197  * @tc.desc: VerifyCodeSignatureForHqf not existed bundleInfo
3198  */
3199 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0500, Function | SmallTest | Level0)
3200 {
3201     auto deployer = GetQuickFixDeployer(true);
3202     EXPECT_FALSE(deployer == nullptr);
3203     InnerAppQuickFix innerAppQuickFix;
3204     AppQuickFix appQuickFix = CreateAppQuickFix();
3205     appQuickFix.bundleName = BUNDLE_NAME;
3206     innerAppQuickFix.SetAppQuickFix(appQuickFix);
3207     std::string patchPath = "data/test";
3208     auto ret = deployer->VerifyCodeSignatureForHqf(innerAppQuickFix, patchPath);
3209     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_NOT_EXISTED_BUNDLE_INFO);
3210 }
3211 
3212 /**
3213  * @tc.number: BmsBundleQuickFixTest_0510
3214  * Function: VerifyCodeSignatureForHqf
3215  * @tc.name: test VerifyCodeSignatureForHqf
3216  * @tc.require: issueI8ZR55
3217  * @tc.desc: VerifyCodeSignatureForHqf ok
3218  */
3219 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0510, Function | SmallTest | Level0)
3220 {
3221     AddInnerBundleInfo(BUNDLE_NAME, PROVISION_TYPE_DEBUG);
3222     auto deployer = GetQuickFixDeployer(true);
3223     EXPECT_FALSE(deployer == nullptr);
3224     InnerAppQuickFix innerAppQuickFix;
3225     AppQuickFix appQuickFix = CreateAppQuickFix();
3226     appQuickFix.bundleName = BUNDLE_NAME;
3227     innerAppQuickFix.SetAppQuickFix(appQuickFix);
3228     std::string patchPath = "data/test";
3229     auto ret = deployer->VerifyCodeSignatureForHqf(innerAppQuickFix, patchPath);
3230     UninstallBundleInfo(BUNDLE_NAME);
3231     EXPECT_EQ(ret, ERR_OK);
3232 }
3233 
3234 /**
3235  * @tc.number: BmsBundleQuickFixTest_0520
3236  * Function: VerifyCodeSignatureForHqf
3237  * @tc.name: test VerifyCodeSignatureForHqf
3238  * @tc.require: issueI8ZR55
3239  * @tc.desc: VerifyCodeSignatureForHqf release hap
3240  */
3241 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0520, Function | SmallTest | Level0)
3242 {
3243     AddInnerBundleInfo(BUNDLE_NAME, PROVISION_TYPE_RELEASE);
3244     auto deployer = GetQuickFixDeployer(true);
3245     EXPECT_FALSE(deployer == nullptr);
3246     InnerAppQuickFix innerAppQuickFix;
3247     AppQuickFix appQuickFix = CreateAppQuickFix();
3248     appQuickFix.bundleName = BUNDLE_NAME;
3249     innerAppQuickFix.SetAppQuickFix(appQuickFix);
3250     std::string patchPath = "data/test";
3251     auto ret = deployer->VerifyCodeSignatureForHqf(innerAppQuickFix, patchPath);
3252     UninstallBundleInfo(BUNDLE_NAME);
3253     EXPECT_EQ(ret, ERR_OK);
3254 }
3255 
3256 /**
3257  * @tc.number: BmsBundleQuickFixTest_0530
3258  * Function: VerifyCodeSignatureForHqf
3259  * @tc.name: test VerifyCodeSignatureForHqf
3260  * @tc.require: issueI8ZR55
3261  * @tc.desc: VerifyCodeSignatureForHqf not debug hqf
3262  */
3263 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0530, Function | SmallTest | Level0)
3264 {
3265     AddInnerBundleInfo(BUNDLE_NAME, PROVISION_TYPE_DEBUG);
3266     auto deployer = GetQuickFixDeployer(false);
3267     EXPECT_FALSE(deployer == nullptr);
3268     InnerAppQuickFix innerAppQuickFix;
3269     AppQuickFix appQuickFix = CreateAppQuickFix();
3270     appQuickFix.bundleName = BUNDLE_NAME;
3271     innerAppQuickFix.SetAppQuickFix(appQuickFix);
3272     std::string patchPath = "data/test";
3273     auto ret = deployer->VerifyCodeSignatureForHqf(innerAppQuickFix, patchPath);
3274     UninstallBundleInfo(BUNDLE_NAME);
3275     EXPECT_EQ(ret, ERR_OK);
3276 }
3277 
3278 /**
3279  * @tc.number: BmsBundleQuickFixTest_0540
3280  * Function: ExtractQuickFixResFile
3281  * @tc.name: test ExtractQuickFixResFile
3282  * @tc.require: issueI9CPVJ
3283  * @tc.desc: ExtractQuickFixResFile empty hqfInfos
3284  */
3285 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0540, Function | SmallTest | Level0)
3286 {
3287     auto deployer = GetQuickFixDeployer();
3288     EXPECT_FALSE(deployer == nullptr);
3289     AppQuickFix appQuickFix = CreateAppQuickFix();
3290     std::vector<HqfInfo> hqfInfo;
3291     appQuickFix.deployingAppqfInfo.hqfInfos = hqfInfo;
3292     BundleInfo bundleInfo;
3293     auto ret = deployer->ExtractQuickFixResFile(appQuickFix, bundleInfo);
3294     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PROFILE_PARSE_FAILED);
3295 }
3296 
3297 /**
3298  * @tc.number: BmsBundleQuickFixTest_0550
3299  * Function: ExtractQuickFixResFile
3300  * @tc.name: test ExtractQuickFixResFile
3301  * @tc.require: issueI9CPVJ
3302  * @tc.desc: ExtractQuickFixResFile ok
3303  */
3304 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0550, Function | SmallTest | Level0)
3305 {
3306     AddInnerBundleInfo(BUNDLE_NAME);
3307     auto deployer = GetQuickFixDeployer();
3308     EXPECT_FALSE(deployer == nullptr);
3309     BundleInfo bundleInfo;
3310     ErrCode ret = deployer->GetBundleInfo(BUNDLE_NAME, bundleInfo);
3311     AppQuickFix appQuickFix = CreateAppQuickFix();
3312     ret = deployer->ExtractQuickFixResFile(appQuickFix, bundleInfo);
3313     UninstallBundleInfo(BUNDLE_NAME);
3314     EXPECT_EQ(ret, ERR_OK);
3315 }
3316 
3317 /**
3318  * @tc.number: BmsBundleQuickFixTest_0096
3319  * Function: ParseAndCheckAppQuickFixInfos
3320  * @tc.name: test ParseAndCheckAppQuickFixInfos
3321  * @tc.require: issueI5MZ5D
3322  * @tc.desc: ParseAndCheckAppQuickFixInfos
3323  */
3324 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0290, Function | SmallTest | Level0)
3325 {
3326     auto deployer = GetQuickFixDeployer();
3327     EXPECT_FALSE(deployer == nullptr);
3328     if (deployer != nullptr) {
3329         const std::vector<std::string> bundleFilePaths;
3330         std::unordered_map<std::string, AppQuickFix> infos;
3331         ErrCode ret = deployer->ParseAndCheckAppQuickFixInfos(bundleFilePaths, infos);
3332         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PROFILE_PARSE_FAILED);
3333     }
3334 }
3335 
3336 /**
3337  * @tc.number: BmsBundleQuickFixTest_0300
3338  * @tc.name: test CheckPatchNativeSoWithInstalledBundle
3339  * @tc.desc: test failed scene of CheckPatchNativeSoWithInstalledBundle
3340  */
3341 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0300, Function | SmallTest | Level0)
3342 {
3343     AddInnerBundleInfo(BUNDLE_NAME);
3344     BundleInfo bundleInfo;
3345     bundleInfo.applicationInfo.nativeLibraryPath = "libs/armeabi-v7a";
3346     bundleInfo.applicationInfo.cpuAbi = "x86";
3347     AppqfInfo qfInfo;
3348     qfInfo.cpuAbi = "arm";
3349     qfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
3350     QuickFixChecker checker;
3351     auto ret = checker.CheckPatchNativeSoWithInstalledBundle(bundleInfo, qfInfo);
3352     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SO_INCOMPATIBLE);
3353     UninstallBundleInfo(BUNDLE_NAME);
3354 }
3355 
3356 /**
3357  * @tc.number: BmsBundleQuickFixTest_0310
3358  * @tc.name: test CheckSignatureInfo
3359  * @tc.desc: test success scene of CheckSignatureInfo
3360  */
3361 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0310, Function | SmallTest | Level0)
3362 {
3363     AddInnerBundleInfo(BUNDLE_NAME);
3364     BundleInfo bundleInfo;
3365     bundleInfo.name = "Device";
3366     Security::Verify::ProvisionInfo provisionInfo;
3367     provisionInfo.appId = "001";
3368     bundleInfo.appId = "Device_001";
3369     bundleInfo.applicationInfo.appPrivilegeLevel = provisionInfo.bundleInfo.apl;
3370     provisionInfo.bundleInfo.bundleName = bundleInfo.name;
3371     QuickFixChecker checker;
3372     auto ret = checker.CheckSignatureInfo(bundleInfo, provisionInfo);
3373     EXPECT_EQ(ret, ERR_OK);
3374     UninstallBundleInfo(BUNDLE_NAME);
3375 }
3376 
3377 /**
3378  * @tc.number: BmsBundleQuickFixTest_0320
3379  * @tc.name: test CheckMultiNativeSo
3380  * @tc.desc: test failed scene of CheckMultiNativeSo
3381  */
3382 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0320, Function | SmallTest | Level0)
3383 {
3384     AddInnerBundleInfo(BUNDLE_NAME);
3385     std::unordered_map<std::string, AppQuickFix> infos;
3386     AppQuickFix info1;
3387     info1.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
3388     AppQuickFix info2;
3389     infos["path1"] = info1;
3390     infos["path2"] = info2;
3391     QuickFixChecker checker;
3392     auto ret = checker.CheckMultiNativeSo(infos);
3393     EXPECT_EQ(ret, ERR_OK);
3394     UninstallBundleInfo(BUNDLE_NAME);
3395 }
3396 
3397 /**
3398  * @tc.number: BmsBundleQuickFixTest_0330
3399  * Function: InnerDeletePatchDir
3400  * @tc.name: test InnerDeletePatchDir
3401  * @tc.desc: InnerDeletePatchDir with different typr
3402  */
3403 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0330, Function | SmallTest | Level0)
3404 {
3405     auto deleter = GetQuickFixDeleter();
3406     EXPECT_FALSE(deleter == nullptr);
3407     if (deleter != nullptr) {
3408         AppqfInfo appqfInfo;
3409         appqfInfo.type = QuickFixType::UNKNOWN;
3410         std::vector<HqfInfo> hqfInfos;
3411         HqfInfo info;
3412         hqfInfos.emplace_back(info);
3413         appqfInfo.hqfInfos = hqfInfos;
3414         ErrCode ret = deleter->InnerDeletePatchDir(appqfInfo, BUNDLE_NAME);
3415         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_UNKNOWN_QUICK_FIX_TYPE);
3416         appqfInfo.type = QuickFixType::HOT_RELOAD;
3417         ret = deleter->InnerDeletePatchDir(appqfInfo, BUNDLE_NAME);
3418         EXPECT_EQ(ret, ERR_OK);
3419     }
3420 }
3421 
3422 /**
3423  * @tc.number: BmsBundleQuickFixTest_0340
3424  * Function: Query inner app quick fix
3425  * @tc.name: test QuickFixDataMgr
3426  * @tc.require: issueI5N7AD
3427  * @tc.desc: 1. check module not same
3428  */
3429 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0340, Function | SmallTest | Level0)
3430 {
3431     AppQuickFix appQuickFix = CreateAppQuickFix();
3432     QuickFixMark mark;
3433     mark.bundleName = appQuickFix.bundleName;
3434     mark.status = QuickFixStatus::DEPLOY_START;
3435     InnerAppQuickFix innerAppQuickFix(appQuickFix, mark);
3436     auto quickFixMgr = GetQuickFixDataMgr();
3437     quickFixMgr->quickFixManagerDb_ = nullptr;
3438     auto deployer = GetQuickFixDeployer();
3439     EXPECT_FALSE(deployer == nullptr);
3440     ErrCode ret = ERR_OK;
3441     if (deployer != nullptr) {
3442         ret = deployer->SaveAppQuickFix(innerAppQuickFix);
3443         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SAVE_APP_QUICK_FIX_FAILED);
3444     }
3445     quickFixMgr->quickFixManagerDb_ = std::make_shared<QuickFixManagerRdb>();
3446 }
3447 
3448 /**
3449  * @tc.number: BmsBundleQuickFixTest_0350
3450  * @tc.name: test CheckSignatureInfo
3451  * @tc.desc: test success scene of CheckSignatureInfo
3452  */
3453 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0350, Function | SmallTest | Level0)
3454 {
3455     AddInnerBundleInfo(BUNDLE_NAME);
3456     BundleInfo bundleInfo;
3457     bundleInfo.name = "Device";
3458     Security::Verify::ProvisionInfo provisionInfo;
3459     provisionInfo.appId = "001";
3460     bundleInfo.appId = "Device_001";
3461     bundleInfo.applicationInfo.appPrivilegeLevel = provisionInfo.bundleInfo.apl;
3462     QuickFixChecker checker;
3463     auto ret = checker.CheckSignatureInfo(bundleInfo, provisionInfo);
3464     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SIGNATURE_INFO_NOT_SAME);
3465     UninstallBundleInfo(BUNDLE_NAME);
3466 }
3467 
3468 /**
3469  * @tc.number: PatchParser_0100
3470  * Function: ParsePatchInfo
3471  * @tc.name: test ParsePatchInfo
3472  */
3473 HWTEST_F(BmsBundleQuickFixTest, PatchParser_0100, Function | SmallTest | Level0)
3474 {
3475     PatchParser patchParser;
3476     std::vector<std::string> filePaths = {HAP_FILE_PATH1};
3477     std::unordered_map<std::string, AppQuickFix> appQuickFixes;
3478     ErrCode res = patchParser.ParsePatchInfo(filePaths, appQuickFixes);
3479     EXPECT_NE(res, ERR_OK);
3480 }
3481 
3482 /**
3483  * @tc.number: DefaultNativeSo_0100
3484  * Function: DefaultNativeSo
3485  * @tc.name: test DefaultNativeSo
3486  */
3487 HWTEST_F(BmsBundleQuickFixTest, DefaultNativeSo_0100, Function | SmallTest | Level0)
3488 {
3489     PatchProfile patchProfile;
3490     PatchExtractor patchExtractor(ServiceConstants::LIBS + ServiceConstants::ARM64_V8A);
3491     patchExtractor.Init();
3492     bool isSystemLib64Exist = true;
3493     AppqfInfo appqfInfo;
3494     bool res = patchProfile.DefaultNativeSo(patchExtractor, isSystemLib64Exist, appqfInfo);
3495     EXPECT_EQ(res, false);
3496 }
3497 
3498 /**
3499  * @tc.number: BmsBundleSwitchQuickFix_0001
3500  * Function: SwitchQuickFix
3501  * @tc.name: test SwitchQuickFix
3502  * @tc.require: issueI5N7AD
3503  * @tc.desc: SwitchQuickFix
3504  */
3505 HWTEST_F(BmsBundleQuickFixTest, BmsBundleSwitchQuickFix_0001, Function | SmallTest | Level0)
3506 {
3507     ErrCode installResult = InstallBundle(HAP_FILE_PATH1);
3508     EXPECT_EQ(installResult, ERR_OK);
3509 
3510     auto quickFixProxy = GetQuickFixManagerProxy();
3511     EXPECT_NE(quickFixProxy, nullptr) << "the quickFixProxy is nullptr";
3512     sptr<MockQuickFixCallback> callback = new (std::nothrow) MockQuickFixCallback();
3513     EXPECT_NE(callback, nullptr) << "the callback is nullptr";
3514     ErrCode ret = quickFixProxy->SwitchQuickFix(BUNDLE_NAME, true, callback);
3515     EXPECT_EQ(ret, ERR_OK);
3516 
3517     ErrCode unInstallResult = UnInstallBundle(BUNDLE_NAME);
3518     EXPECT_EQ(unInstallResult, ERR_OK);
3519 }
3520 
3521 /**
3522  * @tc.number: BmsBundleSwitchQuickFix_0002
3523  * Function: SwitchQuickFix
3524  * @tc.name: test SwitchQuickFix
3525  * @tc.require: issueI5N7AD
3526  * @tc.desc: SwitchQuickFix
3527  */
3528 HWTEST_F(BmsBundleQuickFixTest, BmsBundleSwitchQuickFix_0002, Function | SmallTest | Level0)
3529 {
3530     auto quickFixProxy = GetQuickFixManagerProxy();
3531     EXPECT_NE(quickFixProxy, nullptr) << "the quickFixProxy is nullptr";
3532     sptr<MockQuickFixCallback> callback = new (std::nothrow) MockQuickFixCallback();
3533     EXPECT_NE(callback, nullptr) << "the callback is nullptr";
3534     ErrCode ret = quickFixProxy->SwitchQuickFix("", true, callback);
3535     EXPECT_NE(ret, ERR_OK);
3536 }
3537 
3538 /**
3539  * @tc.number: BmsBundleDeleteQuickFix_0001
3540  * Function: DeleteQuickFix
3541  * @tc.name: test DeleteQuickFix
3542  * @tc.require: issueI5N7AD
3543  * @tc.desc: DeleteQuickFix
3544  */
3545 HWTEST_F(BmsBundleQuickFixTest, BmsBundleDeleteQuickFix_0001, Function | SmallTest | Level0)
3546 {
3547     ErrCode installResult = InstallBundle(HAP_FILE_PATH1);
3548     EXPECT_EQ(installResult, ERR_OK);
3549 
3550     auto quickFixProxy = GetQuickFixManagerProxy();
3551     EXPECT_NE(quickFixProxy, nullptr) << "the quickFixProxy is nullptr";
3552     sptr<MockQuickFixCallback> callback = new (std::nothrow) MockQuickFixCallback();
3553     EXPECT_NE(callback, nullptr) << "the callback is nullptr";
3554     ErrCode ret = quickFixProxy->DeleteQuickFix(BUNDLE_NAME, callback);
3555     EXPECT_EQ(ret, ERR_OK);
3556 
3557     ErrCode unInstallResult = UnInstallBundle(BUNDLE_NAME);
3558     EXPECT_EQ(unInstallResult, ERR_OK);
3559 }
3560 
3561 /**
3562  * @tc.number: BmsBundleDeleteQuickFix_0002
3563  * Function: DeleteQuickFix
3564  * @tc.name: test DeleteQuickFix
3565  * @tc.require: issueI5N7AD
3566  * @tc.desc: DeleteQuickFix
3567  */
3568 HWTEST_F(BmsBundleQuickFixTest, BmsBundleDeleteQuickFix_0002, Function | SmallTest | Level0)
3569 {
3570     auto quickFixProxy = GetQuickFixManagerProxy();
3571     EXPECT_NE(quickFixProxy, nullptr) << "the quickFixProxy is nullptr";
3572     sptr<MockQuickFixCallback> callback = new (std::nothrow) MockQuickFixCallback();
3573     EXPECT_NE(callback, nullptr) << "the callback is nullptr";
3574     ErrCode ret = quickFixProxy->DeleteQuickFix("", callback);
3575     EXPECT_NE(ret, ERR_OK);
3576     ErrCode res = quickFixProxy->DeleteQuickFix("wrong", nullptr);
3577     EXPECT_EQ(res, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
3578 }
3579 
3580 
3581 /**
3582  * @tc.number: FixDeployer_0001
3583  * @tc.name: test ParseAndCheckAppQuickFixInfos
3584  * @tc.desc: ParseAndCheckAppQuickFixInfos
3585  */
3586 HWTEST_F(BmsBundleQuickFixTest, FixDeployer_0001, Function | SmallTest | Level0)
3587 {
3588     ErrCode installResult = InstallBundle(HAP_FILE_PATH1);
3589     EXPECT_EQ(installResult, ERR_OK);
3590 
3591     auto deployer = GetQuickFixDeployer();
3592     EXPECT_FALSE(deployer == nullptr);
3593     if (deployer != nullptr) {
3594         AppQuickFix appQuickFix = CreateAppQuickFix();
3595         std::vector<std::string> bundleFilePaths;
3596         bundleFilePaths.push_back(HAP_FILE_PATH1);
3597         std::unordered_map<std::string, AppQuickFix> infos;
3598         infos.emplace("AppQuickFix", appQuickFix);
3599         ErrCode ret = deployer->ParseAndCheckAppQuickFixInfos(bundleFilePaths, infos);
3600         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PROFILE_PARSE_FAILED);
3601     }
3602 
3603     ErrCode unInstallResult = UnInstallBundle(BUNDLE_NAME);
3604     EXPECT_EQ(unInstallResult, ERR_OK);
3605 }
3606 
3607 /**
3608  * @tc.number: FixDeployer_0002
3609  * @tc.name: test ParseAndCheckAppQuickFixInfos
3610  * @tc.desc: ParseAndCheckAppQuickFixInfos
3611  */
3612 HWTEST_F(BmsBundleQuickFixTest, FixDeployer_0002, Function | SmallTest | Level0)
3613 {
3614     ErrCode installResult = InstallBundle(HAP_FILE_PATH1);
3615     EXPECT_EQ(installResult, ERR_OK);
3616 
3617     auto deployer = GetQuickFixDeployer();
3618     EXPECT_FALSE(deployer == nullptr);
3619     if (deployer != nullptr) {
3620         AppQuickFix appQuickFix = CreateAppQuickFix();
3621         std::vector<std::string> bundleFilePaths;
3622         bundleFilePaths.push_back(HAP_FILE_PATH1);
3623         InnerAppQuickFix newInnerAppQuickFix;
3624         InnerAppQuickFix oldInnerAppQuickFix;
3625         ErrCode ret = deployer->ToDeployStartStatus(bundleFilePaths, newInnerAppQuickFix, oldInnerAppQuickFix);
3626         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PROFILE_PARSE_FAILED);
3627         appQuickFix.deployingAppqfInfo.type = QuickFixType::PATCH;
3628         appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::PATCH;
3629         appQuickFix.deployingAppqfInfo.nativeLibraryPath = "";
3630         newInnerAppQuickFix.SetAppQuickFix(appQuickFix);
3631         ret = deployer->ToDeployStartStatus(bundleFilePaths, newInnerAppQuickFix, oldInnerAppQuickFix);
3632         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PROFILE_PARSE_FAILED);
3633     }
3634 
3635     ErrCode unInstallResult = UnInstallBundle(BUNDLE_NAME);
3636     EXPECT_EQ(unInstallResult, ERR_OK);
3637 }
3638 
3639 /**
3640  * @tc.number: FixDeployer_0003
3641  * @tc.name: test SaveToInnerBundleInfo
3642  * @tc.desc: SaveToInnerBundleInfo
3643  */
3644 HWTEST_F(BmsBundleQuickFixTest, FixDeployer_0003, Function | SmallTest | Level0)
3645 {
3646     auto deployer = GetQuickFixDeployer();
3647     EXPECT_FALSE(deployer == nullptr);
3648     if (deployer != nullptr) {
3649         AppQuickFix appQuickFix = CreateAppQuickFix();
3650         ClearDataMgr();
3651         InnerBundleInfo innerBundleInfo;
3652         bool ret = deployer->FetchInnerBundleInfo("", innerBundleInfo);
3653         EXPECT_EQ(ret, false);
3654         BundleInfo bundleInfo;
3655         ErrCode res = deployer->GetBundleInfo("", bundleInfo);
3656         EXPECT_EQ(res, ERR_BUNDLEMANAGER_QUICK_FIX_INTERNAL_ERROR);
3657         InnerAppQuickFix newInnerAppQuickFix;
3658         res = deployer->SaveToInnerBundleInfo(newInnerAppQuickFix);
3659         EXPECT_EQ(res, ERR_BUNDLEMANAGER_QUICK_FIX_INTERNAL_ERROR);
3660         ResetDataMgr();
3661     }
3662 }
3663 
3664 /**
3665  * @tc.number: BmsBundleCopyFiles_0001
3666  * Function: CopyFiles
3667  * @tc.name: test CopyFiles
3668  * @tc.require: issueI5N7AD
3669  * @tc.desc: CopyFiles
3670  */
3671 HWTEST_F(BmsBundleQuickFixTest, BmsBundleCopyFiles_0001, Function | SmallTest | Level0)
3672 {
3673     auto quickFixProxy = GetQuickFixManagerProxy();
3674     EXPECT_NE(quickFixProxy, nullptr) << "the quickFixProxy is nullptr";
3675     const std::vector<std::string> sourceFiles {FILE1_PATH, FILE2_PATH};
3676     CreateFiles(sourceFiles);
3677     std::vector<std::string> destFiles;
3678     ErrCode ret = quickFixProxy->CopyFiles(sourceFiles, destFiles);
3679     if (!ret) {
3680         EXPECT_EQ(ret, ERR_OK);
3681     }
3682 }
3683 
3684 /**
3685  * @tc.number: BmsBundleCopyFiles_0002
3686  * Function: CopyFiles
3687  * @tc.name: test CopyFiles
3688  * @tc.require: issueI5N7AD
3689  * @tc.desc: CopyFiles
3690  */
3691 HWTEST_F(BmsBundleQuickFixTest, BmsBundleCopyFiles_0002, Function | SmallTest | Level0)
3692 {
3693     auto quickFixProxy = GetQuickFixManagerProxy();
3694     EXPECT_NE(quickFixProxy, nullptr) << "the quickFixProxy is nullptr";
3695     const std::vector<std::string> sourceFiles {"", ""};
3696     std::vector<std::string> destFiles;
3697     ErrCode ret = quickFixProxy->CopyFiles(sourceFiles, destFiles);
3698     EXPECT_NE(ret, ERR_OK);
3699 }
3700 
3701 /**
3702  * @tc.number: BmsBundleCopyFiles_0003
3703  * Function: CopyFiles
3704  * @tc.name: test CopyFiles
3705  * @tc.require: issueI5N7AD
3706  * @tc.desc: CopyFiles
3707  */
3708 HWTEST_F(BmsBundleQuickFixTest, BmsBundleCopyFiles_0003, Function | SmallTest | Level0)
3709 {
3710     auto quickFixProxy = GetQuickFixManagerProxy();
3711     EXPECT_NE(quickFixProxy, nullptr) << "the quickFixProxy is nullptr";
3712     const std::vector<std::string> sourceFiles {FILE1_PATH, ""};
3713     CreateFiles(sourceFiles);
3714     std::vector<std::string> destFiles = {"hello.hqf"};
3715     ErrCode ret = quickFixProxy->CopyFiles(sourceFiles, destFiles);
3716     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_INTERNAL_ERROR);
3717     DeleteFiles(sourceFiles);
3718     DeleteFiles(destFiles);
3719 }
3720 
3721 /**
3722  * @tc.number: CreateFd_0100
3723  * @tc.name: Test CreateFd
3724  * @tc.desc: 1.Test the CreateFd of QuickFixManagerProxy
3725  */
3726 HWTEST_F(BmsBundleQuickFixTest, CreateFd_0100, Function | SmallTest | Level0)
3727 {
3728     auto quickFixProxy = GetQuickFixManagerProxy();
3729     EXPECT_NE(quickFixProxy, nullptr) << "the quickFixProxy is nullptr";
3730     std::string fileName = "";
3731     int32_t fd = 0;
3732     std::string path;
3733     ErrCode ret = quickFixProxy->CreateFd(fileName, fd, path);
3734     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
3735 }
3736 
3737 /**
3738  * @tc.number: DeployQuickFixResult_0100
3739  * @tc.name: Test Marshalling
3740  * @tc.desc: 1.Test the Marshalling of DeployQuickFixResult
3741  */
3742 HWTEST_F(BmsBundleQuickFixTest, DeployQuickFixResult_0100, Function | SmallTest | Level0)
3743 {
3744     DeployQuickFixResult result;
3745     std::vector<std::string> moduleNames = {"entry1", "entry2"};
3746     result.moduleNames = moduleNames;
3747     Parcel parcel;
3748     bool ret = result.Marshalling(parcel);
3749     EXPECT_EQ(ret, true);
3750 }
3751 
3752 /**
3753  * @tc.number: DeployQuickFixResult_0200
3754  * @tc.name: Test GetResCode
3755  * @tc.desc: 1.Test the GetResCode of DeployQuickFixResult
3756  */
3757 HWTEST_F(BmsBundleQuickFixTest, DeployQuickFixResult_0200, Function | SmallTest | Level0)
3758 {
3759     DeployQuickFixResult result;
3760     int32_t resCode = 100;
3761     result.SetResCode(resCode);
3762     int32_t ret = result.GetResCode();
3763     EXPECT_EQ(ret, resCode);
3764 }
3765 
3766 /**
3767  * @tc.number: SwitchQuickFixResult_0100
3768  * @tc.name: Test Marshalling
3769  * @tc.desc: 1.Test the Marshalling of SwitchQuickFixResult
3770  */
3771 HWTEST_F(BmsBundleQuickFixTest, SwitchQuickFixResult_0100, Function | SmallTest | Level0)
3772 {
3773     SwitchQuickFixResult result;
3774     result.resultCode = 100;
3775     Parcel parcel;
3776     bool ret = result.Marshalling(parcel);
3777     EXPECT_EQ(ret, true);
3778 }
3779 
3780 /**
3781  * @tc.number: SwitchQuickFixResult_0200
3782  * @tc.name: Test GetResCode
3783  * @tc.desc: 1.Test the GetResCode of SwitchQuickFixResult
3784  */
3785 HWTEST_F(BmsBundleQuickFixTest, SwitchQuickFixResult_0200, Function | SmallTest | Level0)
3786 {
3787     SwitchQuickFixResult result;
3788     int32_t resCode = 100;
3789     result.SetResCode(resCode);
3790     int32_t ret = result.GetResCode();
3791     EXPECT_EQ(ret, resCode);
3792 }
3793 
3794 /**
3795  * @tc.number: DeleteQuickFixResult_0100
3796  * @tc.name: Test Marshalling
3797  * @tc.desc: 1.Test the Marshalling of DeleteQuickFixResult
3798  */
3799 HWTEST_F(BmsBundleQuickFixTest, DeleteQuickFixResult_0100, Function | SmallTest | Level0)
3800 {
3801     DeleteQuickFixResult result;
3802     result.resultCode = 100;
3803     Parcel parcel;
3804     bool ret = result.Marshalling(parcel);
3805     EXPECT_EQ(ret, true);
3806 }
3807 
3808 /**
3809  * @tc.number: DeleteQuickFixResult_0200
3810  * @tc.name: Test ToString
3811  * @tc.desc: 1.Test the ToString of DeleteQuickFixResult
3812  */
3813 HWTEST_F(BmsBundleQuickFixTest, DeleteQuickFixResult_0200, Function | SmallTest | Level0)
3814 {
3815     DeleteQuickFixResult result;
3816     result.resultCode = 100;
3817     result.bundleName = "com.ohos.test";
3818     std::string ret = "";
3819     ret = result.ToString();
3820     EXPECT_NE(ret, "");
3821 }
3822 
3823 /**
3824  * @tc.number: DeleteQuickFixResult_0300
3825  * @tc.name: Test GetResCode
3826  * @tc.desc: 1.Test the GetResCode of DeleteQuickFixResult
3827  */
3828 HWTEST_F(BmsBundleQuickFixTest, DeleteQuickFixResult_0300, Function | SmallTest | Level0)
3829 {
3830     DeleteQuickFixResult result;
3831     int32_t resCode = 100;
3832     result.SetResCode(resCode);
3833     int32_t ret = result.GetResCode();
3834     EXPECT_EQ(ret, resCode);
3835 }
3836 
3837 /**
3838  * @tc.number: QuickFixStatusCallbackProxy_0100
3839  * @tc.name: Test OnPatchDeployed
3840  * @tc.desc: 1.Test the OnPatchDeployed of QuickFixStatusCallbackProxy
3841  */
3842 HWTEST_F(BmsBundleQuickFixTest, QuickFixStatusCallbackProxy_0100, Function | SmallTest | Level0)
3843 {
3844     const sptr<IRemoteObject> object;
3845     QuickFixStatusCallbackProxy proxy(object);
3846     std::shared_ptr<QuickFixResult> result = std::make_shared<DeployQuickFixResult>();
3847     uint32_t resultCode = 1;
3848     result->SetResCode(resultCode);
3849     proxy.OnPatchDeployed(result);
3850     EXPECT_EQ(result->GetResCode(), resultCode);
3851 }
3852 
3853 /**
3854  * @tc.number: QuickFixStatusCallbackProxy_0200
3855  * @tc.name: Test OnPatchSwitched
3856  * @tc.desc: 1.Test the OnPatchSwitched of QuickFixStatusCallbackProxy
3857  */
3858 HWTEST_F(BmsBundleQuickFixTest, QuickFixStatusCallbackProxy_0200, Function | SmallTest | Level0)
3859 {
3860     const sptr<IRemoteObject> object;
3861     QuickFixStatusCallbackProxy proxy(object);
3862     std::shared_ptr<QuickFixResult> result = std::make_shared<SwitchQuickFixResult>();
3863     uint32_t resultCode = 1;
3864     result->SetResCode(resultCode);
3865     proxy.OnPatchSwitched(result);
3866     EXPECT_EQ(result->GetResCode(), resultCode);
3867 }
3868 
3869 /**
3870  * @tc.number: QuickFixStatusCallbackProxy_0300
3871  * @tc.name: Test OnPatchDeleted
3872  * @tc.desc: 1.Test the OnPatchDeleted of QuickFixStatusCallbackProxy
3873  */
3874 HWTEST_F(BmsBundleQuickFixTest, QuickFixStatusCallbackProxy_0300, Function | SmallTest | Level0)
3875 {
3876     const sptr<IRemoteObject> object;
3877     QuickFixStatusCallbackProxy proxy(object);
3878     std::shared_ptr<QuickFixResult> result = std::make_shared<DeleteQuickFixResult>();
3879     uint32_t resultCode = 1;
3880     result->SetResCode(resultCode);
3881     proxy.OnPatchDeleted(result);
3882     EXPECT_EQ(result->GetResCode(), resultCode);
3883 }
3884 
3885 /**
3886  * @tc.number: QuickFixDeployer_0100
3887  * @tc.name: Test DeployQuickFix with Execute
3888  * @tc.desc: 1.Test the DeployQuickFix of QuickFixDeployer
3889  */
3890 HWTEST_F(BmsBundleQuickFixTest, QuickFixDeployer_0100, Function | SmallTest | Level0)
3891 {
3892     auto deployer = GetQuickFixDeployer();
3893     EXPECT_FALSE(deployer == nullptr);
3894     if (deployer != nullptr) {
3895         ErrCode ret = deployer->Execute();
3896         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
3897         ret = deployer->DeployQuickFix();
3898         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
3899     }
3900 }
3901 
3902 /**
3903  * @tc.number: QuickFixDeployer_0200
3904  * @tc.name: Test ProcessPatchDeployEnd with Execute
3905  * @tc.desc: 1.Test the ProcessPatchDeployEnd of QuickFixDeployer
3906  */
3907 HWTEST_F(BmsBundleQuickFixTest, QuickFixDeployer_0200, Function | SmallTest | Level0)
3908 {
3909     AddInnerBundleInfo(BUNDLE_NAME);
3910     auto deployer = GetQuickFixDeployer();
3911     EXPECT_FALSE(deployer == nullptr);
3912     if (deployer != nullptr) {
3913         AppQuickFix appQuickFix;
3914         appQuickFix.deployingAppqfInfo.versionCode = QUICK_FIX_VERSION_CODE;
3915         appQuickFix.bundleName = BUNDLE_NAME;
3916         HqfInfo info;
3917         info.hqfFilePath = "/data/test/hello.hqf";
3918         appQuickFix.deployingAppqfInfo.hqfInfos.emplace_back(info);
3919         std::string patchPath = "diff.patch";
3920         ErrCode ret = deployer->ProcessPatchDeployEnd(appQuickFix, patchPath);
3921         EXPECT_EQ(ret, ERR_OK);
3922     }
3923     UninstallBundleInfo(BUNDLE_NAME);
3924 }
3925 
3926 /**
3927  * @tc.number: QuickFixDeployer_0400
3928  * @tc.name: Test ProcessHotReloadDeployEnd with Execute
3929  * @tc.desc: 1.Test the ProcessHotReloadDeployEnd of QuickFixDeployer
3930  */
3931 HWTEST_F(BmsBundleQuickFixTest, QuickFixDeployer_0400, Function | SmallTest | Level0)
3932 {
3933     AddInnerBundleInfo(BUNDLE_NAME);
3934     auto deployer = GetQuickFixDeployer();
3935     EXPECT_FALSE(deployer == nullptr);
3936     if (deployer != nullptr) {
3937         AppQuickFix appQuickFix;
3938         appQuickFix.deployingAppqfInfo.versionCode = QUICK_FIX_VERSION_CODE;
3939         appQuickFix.bundleName = BUNDLE_NAME;
3940         HqfInfo info;
3941         info.hqfFilePath = "/data/test/hello.hqf";
3942         appQuickFix.deployingAppqfInfo.hqfInfos.emplace_back(info);
3943         std::string patchPath = "diff.patch";
3944         ErrCode ret = deployer->ProcessHotReloadDeployEnd(appQuickFix, patchPath);
3945         EXPECT_EQ(ret, false);
3946     }
3947     UninstallBundleInfo(BUNDLE_NAME);
3948 }
3949 
3950 /**
3951  * @tc.number: QuickFixDeployer_0500
3952  * @tc.name: Test GetQuickFixDataMgr with Execute
3953  * @tc.desc: 1.Test the GetQuickFixDataMgr of QuickFixDeployer
3954  */
3955 HWTEST_F(BmsBundleQuickFixTest, QuickFixDeployer_0500, Function | SmallTest | Level0)
3956 {
3957     AddInnerBundleInfo(BUNDLE_NAME);
3958     auto deployer = GetQuickFixDeployer();
3959     deployer->quickFixDataMgr_ = std::make_shared<QuickFixDataMgr>();
3960     EXPECT_FALSE(deployer == nullptr);
3961     if (deployer != nullptr) {
3962         ErrCode ret = deployer->GetQuickFixDataMgr();
3963         EXPECT_EQ(ret, ERR_OK);
3964     }
3965     UninstallBundleInfo(BUNDLE_NAME);
3966 }
3967 
3968 /**
3969  * @tc.number: QuickFixDeployer_0600
3970  * @tc.name: Test SendQuickFixSystemEvent with Execute
3971  * @tc.desc: 1.Test the SendQuickFixSystemEvent of QuickFixDeployer
3972  */
3973 HWTEST_F(BmsBundleQuickFixTest, QuickFixDeployer_0600, Function | SmallTest | Level0)
3974 {
3975     AddInnerBundleInfo(BUNDLE_NAME);
3976     auto deployer = GetQuickFixDeployer();
3977     EXPECT_FALSE(deployer == nullptr);
3978     if (deployer != nullptr) {
3979         BundleInfo bundleInfo;
3980         bundleInfo.name = "bundleName";
3981         InnerBundleInfo innerBundleInfo;
3982         innerBundleInfo.SetBaseBundleInfo(bundleInfo);
3983         deployer->SendQuickFixSystemEvent(innerBundleInfo);
3984         EXPECT_EQ(innerBundleInfo.GetBundleName(), "");
3985     }
3986     UninstallBundleInfo(BUNDLE_NAME);
3987 }
3988 
3989 /**
3990  * @tc.number: QuickFixDeployer_0300
3991  * @tc.name: Test FetchInnerBundleInfo with Execute
3992  * @tc.desc: 1.Test the FetchInnerBundleInfo of QuickFixDeployer
3993  */
3994 HWTEST_F(BmsBundleQuickFixTest, QuickFixDeployer_0300, Function | SmallTest | Level0)
3995 {
3996     auto deployer = GetQuickFixDeployer();
3997     EXPECT_FALSE(deployer == nullptr);
3998     if (deployer != nullptr) {
3999         InnerBundleInfo innerBundleInfo;
4000         auto dataMgr = GetBundleDataMgr();
4001         EXPECT_NE(dataMgr, nullptr);
4002         dataMgr->bundleInfos_.try_emplace(BUNDLE_NAME, innerBundleInfo);
4003         bool ret = deployer->FetchInnerBundleInfo(BUNDLE_NAME, innerBundleInfo);
4004         EXPECT_EQ(ret, true);
4005 
4006         ret = deployer->IsLibIsolated(BUNDLE_NAME, "entry");
4007         EXPECT_EQ(ret, false);
4008     }
4009 }
4010 
4011 /**
4012  * @tc.number: QuickFixManagerRdb_0100
4013  * @tc.name: Test QuickFixManagerRdb
4014  * @tc.desc: 1.Test the failed scene of QuickFixManagerRdb
4015  */
4016 HWTEST_F(BmsBundleQuickFixTest, QuickFixManagerRdb_0100, Function | SmallTest | Level0)
4017 {
4018     QuickFixDataMgr rdb;
4019     rdb.quickFixManagerDb_ = nullptr;
4020     EXPECT_EQ(rdb.quickFixManagerDb_, nullptr);
4021     bool ret = rdb.DeleteInnerAppQuickFix("");
4022     EXPECT_EQ(ret, false);
4023 }
4024 
4025 /**
4026  * @tc.number: QuickFixBootScanner_0100
4027  * @tc.name: Test QuickFixBootScanner
4028  * @tc.desc: 1.Test the failed scene of ReprocessQuickFix
4029  */
4030 HWTEST_F(BmsBundleQuickFixTest, QuickFixBootScanner_0100, Function | SmallTest | Level0)
4031 {
4032     QuickFixBootScanner scanner;
4033     bool ret = scanner.ReprocessQuickFix("", "");
4034     EXPECT_EQ(ret, false);
4035 }
4036 
4037 /**
4038  * @tc.number: QuickFixer_0100
4039  * @tc.name: Test QuickFixer
4040  * @tc.desc: 1.Test the failed scene of QuickFixer
4041  */
4042 HWTEST_F(BmsBundleQuickFixTest, QuickFixer_0100, Function | SmallTest | Level0)
4043 {
4044     sptr<IQuickFixStatusCallback> statusCallback;
4045     QuickFixer fixer(statusCallback);
4046     const std::vector<std::string> bundleFilePaths;
4047     fixer.DeployQuickFix(bundleFilePaths);
4048     EXPECT_EQ(fixer.statusCallback_, nullptr);
4049     EXPECT_EQ(bundleFilePaths.empty(), true);
4050     fixer.SwitchQuickFix("", false);
4051     EXPECT_EQ(fixer.statusCallback_, nullptr);
4052     fixer.DeleteQuickFix("");
4053     EXPECT_EQ(fixer.statusCallback_, nullptr);
4054 }
4055 
4056 /**
4057  * @tc.number: QuickFixMgr_0100
4058  * @tc.name: Test QuickFixMgr
4059  * @tc.desc: 1.Test QuickFixMgr
4060  */
4061 HWTEST_F(BmsBundleQuickFixTest, QuickFixMgr_0100, Function | SmallTest | Level0)
4062 {
4063     sptr<IQuickFixStatusCallback> statusCallback;
4064     QuickFixMgr quickFixMgr;
4065     const std::vector<std::string> bundleFilePaths;
4066     auto ret = quickFixMgr.DeployQuickFix(bundleFilePaths, statusCallback);
4067     EXPECT_EQ(ret, ERR_OK);
4068     ret = quickFixMgr.SwitchQuickFix("", false, statusCallback);
4069     EXPECT_EQ(ret, ERR_OK);
4070     ret = quickFixMgr.DeleteQuickFix("", statusCallback);
4071     EXPECT_EQ(ret, ERR_OK);
4072 }
4073 
4074 /**
4075  * @tc.number: QuickFixManagerHostImpl_0100
4076  * @tc.name: Test QuickFixManagerHostImpl
4077  * @tc.desc: 1.Test the failed scene of QuickFixManagerHostImpl
4078  */
4079 HWTEST_F(BmsBundleQuickFixTest, QuickFixManagerHostImpl_0100, Function | SmallTest | Level0)
4080 {
4081     sptr<IQuickFixStatusCallback> statusCallback;
4082     QuickFixManagerHostImpl quickFixMgrHostImpl;
4083     const std::vector<std::string> bundleFilePaths;
4084     auto ret = quickFixMgrHostImpl.DeployQuickFix(bundleFilePaths, statusCallback);
4085     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
4086     ret = quickFixMgrHostImpl.SwitchQuickFix("", false, statusCallback);
4087     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
4088     ret = quickFixMgrHostImpl.DeleteQuickFix("", statusCallback);
4089     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
4090 
4091     std::string fileName = "";
4092     int32_t fd = 0;
4093     std::string path;
4094     auto res = quickFixMgrHostImpl.CreateFd(fileName, fd, path);
4095     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
4096 }
4097 
4098 /**
4099  * @tc.number: QuickFixManagerHostImpl_0200
4100  * @tc.name: Test QuickFixManagerHostImpl.IsFileNameValid
4101  * @tc.desc: 1.Test QuickFixManagerHostImpl.IsFileNameValid
4102  */
4103 HWTEST_F(BmsBundleQuickFixTest, QuickFixManagerHostImpl_0200, Function | SmallTest | Level0)
4104 {
4105     QuickFixManagerHostImpl quickFixMgrHostImpl;
4106 
4107     auto ret = quickFixMgrHostImpl.IsFileNameValid(INVALID_FILE_NAME);
4108     EXPECT_FALSE(ret);
4109     ret = quickFixMgrHostImpl.IsFileNameValid(VALID_FILE_NAME);
4110     EXPECT_EQ(ret, true);
4111 }
4112 
4113 /**
4114  * @tc.number: QuickFixManagerHostImpl_0300
4115  * @tc.name: Test QuickFixManagerHostImpl.IsFileNameValid
4116  * @tc.desc: 1.Test QuickFixManagerHostImpl.IsFileNameValid
4117  */
4118 HWTEST_F(BmsBundleQuickFixTest, QuickFixManagerHostImpl_0300, Function | SmallTest | Level0)
4119 {
4120     QuickFixManagerHostImpl quickFixMgrHostImpl;
4121     std::vector<std::string> bundleFilePaths;
4122     bundleFilePaths.push_back(VALID_FILE_PATH_3);
4123 
4124     std::vector<std::string> securityFilePaths;
4125 
4126     auto ret = quickFixMgrHostImpl.CopyHqfToSecurityDir(bundleFilePaths, securityFilePaths);
4127     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_MOVE_PATCH_FILE_FAILED);
4128 }
4129 
4130 /**
4131  * @tc.number: QuickFixManagerHostImpl_0400
4132  * @tc.name: Test QuickFixManagerHostImpl.CopyHqfToSecurityDir
4133  * @tc.desc: Expected Failure
4134  */
4135 HWTEST_F(BmsBundleQuickFixTest, QuickFixManagerHostImpl_0400, Function | SmallTest | Level0)
4136 {
4137     QuickFixManagerHostImpl quickFixMgrHostImpl;
4138     std::vector<std::string> bundleFilePaths;
4139     bundleFilePaths.push_back(VALID_FILE_PATH_4);
4140 
4141     std::vector<std::string> securityFilePaths;
4142 
4143     auto ret = quickFixMgrHostImpl.CopyHqfToSecurityDir(bundleFilePaths, securityFilePaths);
4144     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_INVALID_PATH);
4145 }
4146 
4147 /**
4148  * @tc.number: QuickFixDataMgr_0100
4149  * @tc.name: Test QuickFixDataMgr
4150  * @tc.desc: 1.Test the failed scene of QuickFixDataMgr
4151  */
4152 HWTEST_F(BmsBundleQuickFixTest, QuickFixDataMgr_0100, Function | SmallTest | Level0)
4153 {
4154     QuickFixDataMgr dataMgr;
4155     dataMgr.quickFixManagerDb_.reset();
4156     EXPECT_EQ(dataMgr.quickFixManagerDb_, nullptr);
4157     std::map<std::string, InnerAppQuickFix> innerAppQuickFixes;
4158     bool ret = dataMgr.QueryAllInnerAppQuickFix(innerAppQuickFixes);
4159     EXPECT_EQ(ret, false);
4160 
4161     InnerAppQuickFix innerAppQuickFix;
4162     ret = dataMgr.QueryInnerAppQuickFix("", innerAppQuickFix);
4163     EXPECT_EQ(ret, false);
4164 
4165     ret = dataMgr.SaveInnerAppQuickFix(innerAppQuickFix);
4166     EXPECT_EQ(ret, false);
4167 
4168     ret = dataMgr.DeleteInnerAppQuickFix("");
4169     EXPECT_EQ(ret, false);
4170 }
4171 
4172 /**
4173  * @tc.number: AddHqfInfo_0100
4174  * @tc.name: test AddHqfInfo
4175  * @tc.desc: AddHqfInfo return false
4176  */
4177 HWTEST_F(BmsBundleQuickFixTest, AddHqfInfo_0100, Function | SmallTest | Level0)
4178 {
4179     InnerAppQuickFix innerAppQuickFix;
4180     AppQuickFix appQuickFix;
4181     auto ret = innerAppQuickFix.AddHqfInfo(appQuickFix);
4182     EXPECT_FALSE(ret);
4183 }
4184 
4185 /**
4186  * @tc.number: AddHqfInfo_0200
4187  * @tc.name: test AddHqfInfo
4188  * @tc.desc: AddHqfInfo return true
4189  */
4190 HWTEST_F(BmsBundleQuickFixTest, AddHqfInfo_0200, Function | SmallTest | Level0)
4191 {
4192     InnerAppQuickFix innerAppQuickFix;
4193     AppQuickFix appQuickFix;
4194     HqfInfo info;
4195     info.hapSha256 = "hapSha256";
4196     appQuickFix.deployingAppqfInfo.hqfInfos.emplace_back(info);
4197     auto ret = innerAppQuickFix.AddHqfInfo(appQuickFix);
4198     EXPECT_TRUE(ret);
4199 }
4200 
4201 /**
4202  * @tc.number: AddHqfInfo_0300
4203  * @tc.name: test AddHqfInfo
4204  * @tc.desc: AddHqfInfo return true
4205  */
4206 HWTEST_F(BmsBundleQuickFixTest, AddHqfInfo_0300, Function | SmallTest | Level0)
4207 {
4208     InnerAppQuickFix innerAppQuickFix;
4209     AppQuickFix appQuickFix;
4210     HqfInfo info;
4211     info.moduleName = "com.example.bmsaccesstoken.MyApplication1";
4212     appQuickFix.deployingAppqfInfo.hqfInfos.emplace_back(info);
4213     innerAppQuickFix.SetAppQuickFix(appQuickFix);
4214     auto ret = innerAppQuickFix.AddHqfInfo(appQuickFix);
4215     EXPECT_TRUE(ret);
4216 }
4217 
4218 /**
4219  * @tc.number:RemoveHqfInfo_0100
4220  * @tc.name: test RemoveHqfInfo
4221  * @tc.desc: RemoveHqfInfo return true
4222  */
4223 HWTEST_F(BmsBundleQuickFixTest, RemoveHqfInfo_0100, Function | SmallTest | Level0)
4224 {
4225     InnerAppQuickFix innerAppQuickFix;
4226     AppQuickFix appQuickFix;
4227     HqfInfo info;
4228     info.moduleName = "com.example.bmsaccesstoken.MyApplication1";
4229     appQuickFix.deployingAppqfInfo.hqfInfos.emplace_back(info);
4230     innerAppQuickFix.SetAppQuickFix(appQuickFix);
4231     auto ret = innerAppQuickFix.RemoveHqfInfo("com.example.bmsaccesstoken.MyApplication1");
4232     EXPECT_TRUE(ret);
4233 }
4234 
4235 /**
4236  * @tc.number:RemoveHqfInfo_0200
4237  * @tc.name: test RemoveHqfInfo
4238  * @tc.desc: RemoveHqfInfo return false
4239  */
4240 HWTEST_F(BmsBundleQuickFixTest, RemoveHqfInfo_0200, Function | SmallTest | Level0)
4241 {
4242     InnerAppQuickFix innerAppQuickFix;
4243     auto ret = innerAppQuickFix.RemoveHqfInfo("com.example.bmsaccesstoken.MyApplication1");
4244     EXPECT_FALSE(ret);
4245 }
4246 
4247 /**
4248  * @tc.number:RemoveHqfInfo_0300
4249  * @tc.name: test RemoveHqfInfo
4250  * @tc.desc: RemoveHqfInfo return false
4251  */
4252 HWTEST_F(BmsBundleQuickFixTest, RemoveHqfInfo_0300, Function | SmallTest | Level0)
4253 {
4254     InnerAppQuickFix innerAppQuickFix;
4255     auto ret = innerAppQuickFix.RemoveHqfInfo("");
4256     EXPECT_FALSE(ret);
4257 }
4258 
4259 /**
4260  * @tc.number:SwitchQuickFix_0100
4261  * @tc.name: test SwitchQuickFix
4262  * @tc.desc: SwitchQuickFix
4263  */
4264 HWTEST_F(BmsBundleQuickFixTest, SwitchQuickFix_0100, Function | SmallTest | Level0)
4265 {
4266     InnerAppQuickFix innerAppQuickFix;
4267     innerAppQuickFix.appQuickFix_.deployedAppqfInfo.versionCode = 1001;
4268     innerAppQuickFix.appQuickFix_.deployingAppqfInfo.versionCode = 1002;
4269     innerAppQuickFix.appQuickFix_.deployedAppqfInfo.versionName = "test";
4270     innerAppQuickFix.appQuickFix_.deployingAppqfInfo.versionName = "test1";
4271     innerAppQuickFix.SwitchQuickFix();
4272     EXPECT_EQ(innerAppQuickFix.appQuickFix_.deployedAppqfInfo.versionCode, 1002);
4273     EXPECT_EQ(innerAppQuickFix.appQuickFix_.deployedAppqfInfo.versionName, "test1");
4274     EXPECT_EQ(innerAppQuickFix.appQuickFix_.deployingAppqfInfo.versionCode, 1001);
4275     EXPECT_EQ(innerAppQuickFix.appQuickFix_.deployingAppqfInfo.versionName, "test");
4276 }
4277 
4278 /**
4279  * @tc.number: GetQuickFixMark_0100
4280  * @tc.name: test GetQuickFixMark
4281  * @tc.desc: GetQuickFixMark return bundleName
4282  */
4283 HWTEST_F(BmsBundleQuickFixTest, GetQuickFixMark_0100, Function | SmallTest | Level0)
4284 {
4285     InnerAppQuickFix innerAppQuickFix;
4286     QuickFixMark quickFixMark;
4287     quickFixMark.bundleName = "bundle";
4288     innerAppQuickFix.SetQuickFixMark(quickFixMark);
4289     auto ret = innerAppQuickFix.GetQuickFixMark();
4290     EXPECT_EQ(ret.bundleName, "bundle");
4291 }
4292 
4293 /**
4294  * @tc.number: GetQuickFixMark_0200
4295  * @tc.name: test GetQuickFixMark
4296  * @tc.desc: GetQuickFixMark return bundleName is null string
4297  */
4298 HWTEST_F(BmsBundleQuickFixTest, GetQuickFixMark_0200, Function | SmallTest | Level0)
4299 {
4300     InnerAppQuickFix innerAppQuickFix;
4301     QuickFixMark quickFixMark;
4302     auto ret = innerAppQuickFix.GetQuickFixMark();
4303     EXPECT_EQ(ret.bundleName, "");
4304 }
4305 
4306 /**
4307  * @tc.number: ToString_0100
4308  * @tc.name: test ToString
4309  * @tc.desc: ToString return string
4310  */
4311 HWTEST_F(BmsBundleQuickFixTest, ToString_0100, Function | SmallTest | Level0)
4312 {
4313     InnerAppQuickFix innerAppQuickFix;
4314     auto ret = innerAppQuickFix.ToString();
4315     EXPECT_EQ(ret.empty(), false);
4316 }
4317 
4318 /**
4319  * @tc.number: ToJson_0100
4320  * @tc.name: test ToJson
4321  * @tc.desc: ToJson
4322  */
4323 HWTEST_F(BmsBundleQuickFixTest, ToJson_0100, Function | SmallTest | Level0)
4324 {
4325     InnerAppQuickFix innerAppQuickFix;
4326     nlohmann::json jsonObject;
4327     AppQuickFix appQuickFix;
4328     QuickFixMark quickFixMark;
4329     innerAppQuickFix.ToJson(jsonObject);
4330     EXPECT_EQ(jsonObject["appQuickFix"], appQuickFix);
4331     EXPECT_EQ(jsonObject["quickFixMark"], quickFixMark);
4332 }
4333 
4334 /**
4335  * @tc.number: FromJson_0100
4336  * @tc.name: test FromJson
4337  * @tc.desc: Parse json to C++ return ERR_OK
4338  */
4339 HWTEST_F(BmsBundleQuickFixTest, FromJson_0100, Function | SmallTest | Level0)
4340 {
4341     InnerAppQuickFix innerAppQuickFix;
4342     nlohmann::json jsonObject =  nlohmann::json {
4343         {Constants::BUNDLE_NAME, "com.example.MyApplication1"},
4344         {"versionCode", 0},
4345         {"versionName", "versionName"}
4346     };
4347     auto ret = innerAppQuickFix.FromJson(jsonObject);
4348     EXPECT_EQ(ret, ERR_OK);
4349 }
4350 
4351 /**
4352  * @tc.number: FromJson_0200
4353  * @tc.name: test FromJson
4354  * @tc.desc: Parse json to C++ return ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR
4355  */
4356 HWTEST_F(BmsBundleQuickFixTest, FromJson_0200, Function | SmallTest | Level0)
4357 {
4358     InnerAppQuickFix innerAppQuickFix;
4359     nlohmann::json jsonObject = R"(
4360         {
4361             "appQuickFix" : "appQuickFix",
4362             "quickFixMark" : "quickFixMark"
4363         }
4364     )"_json;
4365     auto ret = innerAppQuickFix.FromJson(jsonObject);
4366     EXPECT_EQ(ret, ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR);
4367 }
4368 
4369 /**
4370  * @tc.number: FromJson_0300
4371  * @tc.name: test FromJson
4372  * @tc.desc: Parse json to C++ return ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR
4373  */
4374 HWTEST_F(BmsBundleQuickFixTest, FromJson_0300, Function | SmallTest | Level0)
4375 {
4376     InnerAppQuickFix innerAppQuickFix;
4377     nlohmann::json jsonObject = R"(
4378         {
4379             "appQuickFix" : "appQuickFix",
4380             "quickFixMark" : {}
4381         }
4382     )"_json;
4383     auto ret = innerAppQuickFix.FromJson(jsonObject);
4384     EXPECT_EQ(ret, ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR);
4385 }
4386 
4387 /**
4388  * @tc.number: FromJson_0400
4389  * @tc.name: test FromJson
4390  * @tc.desc: Parse json to C++ return ERR_OK
4391  */
4392 HWTEST_F(BmsBundleQuickFixTest, FromJson_0400, Function | SmallTest | Level0)
4393 {
4394     InnerAppQuickFix innerAppQuickFix;
4395     nlohmann::json jsonObject;
4396     auto ret = innerAppQuickFix.FromJson(jsonObject);
4397     EXPECT_EQ(ret, ERR_OK);
4398 }
4399 
4400 /**
4401  * @tc.number: FromJson_0500
4402  * @tc.name: test FromJson
4403  * @tc.desc: Parse json to C++ return ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR
4404  */
4405 HWTEST_F(BmsBundleQuickFixTest, FromJson_0500, Function | SmallTest | Level0)
4406 {
4407     InnerAppQuickFix innerAppQuickFix;
4408     nlohmann::json jsonObject = R"(
4409         {
4410             "appQuickFix" : {},
4411             "quickFixMark" : "quickFixMark"
4412         }
4413     )"_json;
4414     auto ret = innerAppQuickFix.FromJson(jsonObject);
4415     EXPECT_EQ(ret, ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR);
4416 }
4417 
4418 /**
4419  * @tc.number: FromJson_0600
4420  * @tc.name: test FromJson
4421  * @tc.desc: Parse json to C++ return ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR
4422  */
4423 HWTEST_F(BmsBundleQuickFixTest, FromJson_0600, Function | SmallTest | Level0)
4424 {
4425     InnerAppQuickFix innerAppQuickFix;
4426     nlohmann::json jsonObject = R"(
4427         {
4428             "appQuickFix" : "!@#$%^&*",
4429             "quickFixMark" : "%^&*&^"
4430         }
4431     )"_json;
4432     auto ret = innerAppQuickFix.FromJson(jsonObject);
4433     EXPECT_EQ(ret, ERR_APPEXECFWK_PARSE_PROFILE_PROP_TYPE_ERROR);
4434 }
4435 
4436 /**
4437  * @tc.number: FromJson_0700
4438  * @tc.name: test FromJson
4439  * @tc.desc: Parse json to C++ return ERR_OK
4440  */
4441 HWTEST_F(BmsBundleQuickFixTest, FromJson_0700, Function | SmallTest | Level0)
4442 {
4443     InnerAppQuickFix innerAppQuickFix;
4444     nlohmann::json jsonObject = R"(
4445         {
4446             "appQuickFix" : {},
4447             "quickFixMark" : {}
4448         }
4449     )"_json;
4450     auto ret = innerAppQuickFix.FromJson(jsonObject);
4451     EXPECT_EQ(ret, ERR_OK);
4452 }
4453 
4454 /**
4455  * @tc.number: to_json_0100
4456  * @tc.name: test to_json
4457  * @tc.desc: to_json return ERR_OK
4458  */
4459 HWTEST_F(BmsBundleQuickFixTest, to_json_0100, Function | SmallTest | Level0)
4460 {
4461     nlohmann::json jsonObject;
4462     QuickFixMark quickFixMark;
4463     quickFixMark.bundleName = "bundleName";
4464     quickFixMark.status = QuickFixStatus::DEPLOY_START;
4465     to_json(jsonObject, quickFixMark);
4466     const auto &jsonObjectEnd = jsonObject.end();
4467     int32_t parseResult = ERR_OK;
4468     GetValueIfFindKey<std::string>(jsonObject,
4469         jsonObjectEnd,
4470         Constants::BUNDLE_NAME,
4471         quickFixMark.bundleName,
4472         JsonType::STRING,
4473         false,
4474         parseResult,
4475         ArrayType::NOT_ARRAY);
4476     EXPECT_EQ(parseResult, ERR_OK);
4477 }
4478 
4479 /**
4480  * @tc.number: to_json_0200
4481  * @tc.name: test to_json
4482  * @tc.desc: to_json return ERR_OK
4483  */
4484 HWTEST_F(BmsBundleQuickFixTest, to_json_0200, Function | SmallTest | Level0)
4485 {
4486     nlohmann::json jsonObject;
4487     QuickFixMark quickFixMark;
4488     to_json(jsonObject, quickFixMark);
4489     const auto &jsonObjectEnd = jsonObject.end();
4490     int32_t parseResult = ERR_OK;
4491     GetValueIfFindKey<std::string>(jsonObject,
4492         jsonObjectEnd,
4493         Constants::BUNDLE_NAME,
4494         quickFixMark.bundleName,
4495         JsonType::STRING,
4496         false,
4497         parseResult,
4498         ArrayType::NOT_ARRAY);
4499     EXPECT_EQ(parseResult, ERR_OK);
4500 }
4501 
4502 /**
4503  * @tc.number: from_json_0100
4504  * @tc.name: test from_json
4505  * @tc.desc: parse json to c++ return QuickFixMark
4506  */
4507 HWTEST_F(BmsBundleQuickFixTest, from_json_0100, Function | SmallTest | Level0)
4508 {
4509     nlohmann::json jsonObject;
4510     QuickFixMark quickFixMark;
4511     from_json(jsonObject, quickFixMark);
4512     EXPECT_EQ(quickFixMark.bundleName, "");
4513     EXPECT_EQ(quickFixMark.status, QuickFixStatus::DEFAULT_STATUS);
4514 }
4515 
4516 /**
4517  * @tc.number: BmsBundleQuickFixTest_0360
4518  * Function: ProcessBundleFilePaths
4519  * @tc.name: test ProcessBundleFilePaths
4520  * @tc.require: issueI5N7AD
4521  * @tc.desc: ProcessBundleFilePaths
4522  */
4523 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0360, Function | SmallTest | Level0)
4524 {
4525     auto deployer = GetQuickFixDeployer();
4526     EXPECT_FALSE(deployer == nullptr);
4527     if (deployer != nullptr) {
4528         std::vector<std::string> sourceFiles {INVALID_FILE_PATH_1};
4529         std::vector<std::string> realFilePaths;
4530         ErrCode ret = deployer->ProcessBundleFilePaths(sourceFiles, realFilePaths);
4531         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
4532     }
4533 }
4534 
4535 /**
4536  * @tc.number: BmsBundleQuickFixTest_0370
4537  * Function: ProcessBundleFilePaths
4538  * @tc.name: test ProcessBundleFilePaths
4539  * @tc.require: issueI5N7AD
4540  * @tc.desc: ProcessBundleFilePaths
4541  */
4542 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0370, Function | SmallTest | Level0)
4543 {
4544     auto deployer = GetQuickFixDeployer();
4545     EXPECT_FALSE(deployer == nullptr);
4546     if (deployer != nullptr) {
4547         std::vector<std::string> sourceFiles {INVALID_FILE_PATH_2};
4548         std::vector<std::string> realFilePaths;
4549         ErrCode ret = deployer->ProcessBundleFilePaths(sourceFiles, realFilePaths);
4550         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
4551     }
4552 }
4553 
4554 /**
4555  * @tc.number: BmsBundleQuickFixTest_0380
4556  * Function: ProcessBundleFilePaths
4557  * @tc.name: test ProcessBundleFilePaths
4558  * @tc.require: issueI5N7AD
4559  * @tc.desc: ProcessBundleFilePaths
4560  */
4561 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0380, Function | SmallTest | Level0)
4562 {
4563     auto deployer = GetQuickFixDeployer();
4564     EXPECT_FALSE(deployer == nullptr);
4565     if (deployer != nullptr) {
4566         std::vector<std::string> sourceFiles {VALID_FILE_PATH_3};
4567         std::vector<std::string> realFilePaths;
4568         ErrCode ret = deployer->ProcessBundleFilePaths(sourceFiles, realFilePaths);
4569         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
4570     }
4571 }
4572 
4573 /**
4574  * @tc.number: BmsBundleQuickFixTest_0390
4575  * Function: ToDeployEndStatus
4576  * @tc.name: test ToDeployEndStatus
4577  * @tc.require: issueI5N7AD
4578  * @tc.desc: ToDeployEndStatus, bundleName not exist
4579  */
4580 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0390, Function | SmallTest | Level0)
4581 {
4582     auto deployer = GetQuickFixDeployer();
4583     EXPECT_FALSE(deployer == nullptr);
4584     if (deployer != nullptr) {
4585         AppQuickFix appQuickFix = CreateAppQuickFix();
4586         appQuickFix.deployingAppqfInfo.type = QuickFixType::PATCH;
4587         appQuickFix.deployingAppqfInfo.hqfInfos[0].type = QuickFixType::PATCH;
4588         appQuickFix.deployingAppqfInfo.nativeLibraryPath = "";
4589         InnerAppQuickFix newInnerAppQuickFix;
4590         newInnerAppQuickFix.SetAppQuickFix(appQuickFix);
4591         InnerAppQuickFix oldInnerAppQuickFix;
4592         ErrCode ret = deployer->ToDeployEndStatus(newInnerAppQuickFix, oldInnerAppQuickFix);
4593         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_BUNDLE_NAME_NOT_EXIST);
4594     }
4595 }
4596 
4597 /**
4598  * @tc.number: BmsBundleQuickFixTest_0400
4599  * Function: ExtractSoFiles
4600  * @tc.name: test ExtractSoFiles
4601  * @tc.require: issueI5N7AD
4602  * @tc.desc: ExtractSoFiles
4603  */
4604 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0400, Function | SmallTest | Level0)
4605 {
4606     auto deployer = GetQuickFixDeployer();
4607     EXPECT_FALSE(deployer == nullptr);
4608     if (deployer != nullptr) {
4609         BundleInfo bundleInfo;
4610         bundleInfo.applicationInfo.nativeLibraryPath = "";
4611         std::string tmpSoPath = "";
4612         std::string moduleName = "entry";
4613 
4614         HapModuleInfo moduleInfo;
4615         moduleInfo.nativeLibraryPath = "";
4616         moduleInfo.moduleName = moduleName;
4617         bundleInfo.hapModuleInfos.push_back(moduleInfo);
4618         bool ret = deployer->ExtractSoFiles(bundleInfo, "feature", tmpSoPath);
4619         EXPECT_FALSE(ret);
4620 
4621         ret = deployer->ExtractSoFiles(bundleInfo, moduleName, tmpSoPath);
4622         EXPECT_FALSE(ret);
4623 
4624         bundleInfo.applicationInfo.nativeLibraryPath = "libs/arm";
4625         ret = deployer->ExtractSoFiles(bundleInfo, moduleName, tmpSoPath);
4626         EXPECT_FALSE(ret);
4627 
4628         bundleInfo.applicationInfo.nativeLibraryPath = "";
4629         bundleInfo.hapModuleInfos[0].nativeLibraryPath = "libs/arm";
4630         ret = deployer->ExtractSoFiles(bundleInfo, moduleName, tmpSoPath);
4631         EXPECT_FALSE(ret);
4632     }
4633 }
4634 
4635 /**
4636  * @tc.number: BmsBundleQuickFixTest_0410
4637  * Function: ProcessApplyDiffPatch
4638  * @tc.name: test ProcessApplyDiffPatch
4639  * @tc.require: issueI5N7AD
4640  * @tc.desc: ProcessApplyDiffPatch
4641  */
4642 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0410, Function | SmallTest | Level0)
4643 {
4644     auto deployer = GetQuickFixDeployer();
4645     EXPECT_FALSE(deployer == nullptr);
4646     if (deployer != nullptr) {
4647         AppQuickFix appQuickFix = CreateAppQuickFix();
4648         auto ret = deployer->ProcessApplyDiffPatch(appQuickFix,
4649             appQuickFix.deployingAppqfInfo.hqfInfos[0], "", "");
4650         EXPECT_EQ(ret, ERR_OK);
4651     }
4652 }
4653 
4654 /**
4655  * @tc.number: BmsBundleQuickFixTest_0420
4656  * Function: ProcessApplyDiffPatch
4657  * @tc.name: test ProcessApplyDiffPatch
4658  * @tc.require: issueI5N7AD
4659  * @tc.desc: ProcessApplyDiffPatch
4660  */
4661 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0420, Function | SmallTest | Level0)
4662 {
4663     AddInnerBundleInfo(BUNDLE_NAME_DEMO);
4664 
4665     auto deployer = GetQuickFixDeployer();
4666     EXPECT_FALSE(deployer == nullptr);
4667     if (deployer != nullptr) {
4668         AppQuickFix appQuickFix = CreateAppQuickFix();
4669         appQuickFix.bundleName = BUNDLE_NAME_DEMO;
4670         appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
4671         auto ret = deployer->ProcessApplyDiffPatch(appQuickFix,
4672             appQuickFix.deployingAppqfInfo.hqfInfos[0], "/data/test/", "/data/test/");
4673         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_EXTRACT_DIFF_FILES_FAILED);
4674     }
4675     UninstallBundleInfo(BUNDLE_NAME_DEMO);
4676 }
4677 
4678 /**
4679  * @tc.number: BmsBundleQuickFixTest_0430
4680  * Function: ProcessBundleFilePaths
4681  * @tc.name: test ProcessBundleFilePaths
4682  * @tc.desc: ProcessBundleFilePaths
4683  */
4684 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0430, Function | SmallTest | Level0)
4685 {
4686     auto deployer = GetQuickFixDeployer();
4687     ASSERT_FALSE(deployer == nullptr);
4688     QuickFixManagerHostImpl quickFixManagerHostImpl;
4689     std::string fileName = "test.hqf";
4690     int32_t fd = -1;
4691     std::string path = "";
4692     auto res = quickFixManagerHostImpl.CreateFd(fileName, fd, path);
4693     EXPECT_EQ(res, ERR_OK);
4694     const std::vector<std::string> sourceFiles {path};
4695     std::vector<std::string> realFilePaths;
4696     auto ret = deployer->ProcessBundleFilePaths(sourceFiles, realFilePaths);
4697     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
4698     deployer->DeployQuickFix();
4699     DeleteFiles(sourceFiles);
4700 }
4701 
4702 /**
4703  * @tc.number: BmsBundleQuickFixTest_0440
4704  * Function: MoveHqfFiles
4705  * @tc.name: test MoveHqfFiles
4706  * @tc.desc: MoveHqfFiles
4707  */
4708 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0440, Function | SmallTest | Level0)
4709 {
4710     auto deployer = GetQuickFixDeployer();
4711     ASSERT_FALSE(deployer == nullptr);
4712     InnerAppQuickFix innerAppQuickFix;
4713     AppQuickFix appQuickFix;
4714     HqfInfo hqfInfo;
4715     hqfInfo.moduleName = "entry";
4716     hqfInfo.hqfFilePath = "data/test";
4717     appQuickFix.deployingAppqfInfo.hqfInfos.push_back(hqfInfo);
4718     innerAppQuickFix.SetAppQuickFix(appQuickFix);
4719     std::string targetPath = "data/test";
4720     auto ret = deployer->MoveHqfFiles(innerAppQuickFix, targetPath);
4721     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_MOVE_PATCH_FILE_FAILED);
4722 }
4723 
4724 /**
4725  * @tc.number: BmsBundleQuickFixTest_0460
4726  * Function: ToDeletePatchDir
4727  * @tc.name: test ToDeletePatchDir
4728  * @tc.desc: ToDeletePatchDir
4729  */
4730 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0460, Function | SmallTest | Level0)
4731 {
4732     auto deleter = GetQuickFixDeleter();
4733     ASSERT_FALSE(deleter == nullptr);
4734     InnerAppQuickFix innerAppQuickFix;
4735     AppQuickFix appQuickFix;
4736     HqfInfo hqfInfo;
4737     hqfInfo.moduleName = "entry";
4738     appQuickFix.deployingAppqfInfo.hqfInfos.push_back(hqfInfo);
4739     appQuickFix.deployedAppqfInfo.type = QuickFixType::UNKNOWN;
4740     innerAppQuickFix.SetAppQuickFix(appQuickFix);
4741     ErrCode ret = deleter->ToDeletePatchDir(innerAppQuickFix);
4742     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_UNKNOWN_QUICK_FIX_TYPE);
4743 }
4744 
4745 /**
4746  * @tc.number: BmsBundleQuickFixTest_0470
4747  * Function: ToDeletePatchDir
4748  * @tc.name: test ToDeletePatchDir
4749  * @tc.desc: ToDeletePatchDir
4750  */
4751 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0470, Function | SmallTest | Level0)
4752 {
4753     auto deleter = GetQuickFixDeleter();
4754     ASSERT_FALSE(deleter == nullptr);
4755     InnerAppQuickFix innerAppQuickFix;
4756     AppQuickFix appQuickFix;
4757     HqfInfo hqfInfo;
4758     hqfInfo.moduleName = "entry";
4759     appQuickFix.deployingAppqfInfo.hqfInfos.push_back(hqfInfo);
4760     appQuickFix.deployingAppqfInfo.type = QuickFixType::UNKNOWN;
4761     innerAppQuickFix.SetAppQuickFix(appQuickFix);
4762     ErrCode ret = deleter->ToDeletePatchDir(innerAppQuickFix);
4763     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_UNKNOWN_QUICK_FIX_TYPE);
4764 }
4765 
4766 /**
4767  * @tc.number: BmsBundleQuickFixTest_0480
4768  * Function: RemoveDeployingInfo
4769  * @tc.name: test RemoveDeployingInfo
4770  * @tc.desc: RemoveDeployingInfo with dataMgr_ is nullptr
4771  */
4772 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0480, Function | SmallTest | Level0)
4773 {
4774     auto deleter = GetQuickFixDeleter();
4775     ASSERT_FALSE(deleter == nullptr);
4776     auto dataMgr = DelayedSingleton<BundleMgrService>::GetInstance()->dataMgr_;
4777     DelayedSingleton<BundleMgrService>::GetInstance()->dataMgr_ = nullptr;
4778     ErrCode ret = deleter->RemoveDeployingInfo("");
4779     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_INTERNAL_ERROR);
4780     DelayedSingleton<BundleMgrService>::GetInstance()->dataMgr_ = dataMgr;
4781 }
4782 
4783 /**
4784  * @tc.number: BmsBundleQuickFixTest_0490
4785  * Function: InnerSwitchQuickFix
4786  * @tc.name: test InnerSwitchQuickFix
4787  * @tc.desc: InnerSwitchQuickFix, dataMgr_ is nullptr
4788  */
4789 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0490, Function | SmallTest | Level0)
4790 {
4791     auto switcher = GetQuickFixSwitcher();
4792     ASSERT_FALSE(switcher == nullptr);
4793     InnerAppQuickFix innerAppQuickFix;
4794 
4795     auto dataMgr = DelayedSingleton<BundleMgrService>::GetInstance()->dataMgr_;
4796     DelayedSingleton<BundleMgrService>::GetInstance()->dataMgr_ = nullptr;
4797     ErrCode ret = switcher->InnerSwitchQuickFix(BUNDLE_NAME, innerAppQuickFix, true);
4798     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_INTERNAL_ERROR);
4799 
4800     DelayedSingleton<BundleMgrService>::GetInstance()->dataMgr_ = dataMgr;
4801 }
4802 
4803 /**
4804  * @tc.number: BmsBundleQuickFixTest_0610
4805  * Function: PrepareCodeSignatureParam
4806  * @tc.name: test PrepareCodeSignatureParam
4807  * @tc.require: issueI5N7AD
4808  * @tc.desc: PrepareCodeSignatureParam
4809  */
4810 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0610, Function | SmallTest | Level0)
4811 {
4812     AddInnerBundleInfo(BUNDLE_NAME_DEMO);
4813 
4814     auto deployer = GetQuickFixDeployer();
4815     EXPECT_FALSE(deployer == nullptr);
4816     if (deployer != nullptr) {
4817         AppQuickFix appQuickFix = CreateAppQuickFix();
4818         appQuickFix.bundleName = BUNDLE_NAME_DEMO;
4819         appQuickFix.deployingAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
4820 
4821         HqfInfo hqf;
4822         BundleInfo bundleInfo;
4823         bundleInfo.applicationInfo.compileSdkType = "";
4824         std::string hqfSoPath = "/data/test/";
4825         CodeSignatureParam codeSignatureParam;
4826         deployer->PrepareCodeSignatureParam(appQuickFix, hqf, bundleInfo, hqfSoPath, codeSignatureParam);
4827         EXPECT_EQ(codeSignatureParam.isCompileSdkOpenHarmony, false);
4828     }
4829     UninstallBundleInfo(BUNDLE_NAME_DEMO);
4830 }
4831 
4832 /**
4833  * @tc.number: BmsBundleQuickFixTest_0620
4834  * Function: ProcessPatchDeployStart
4835  * @tc.name: test ProcessPatchDeployStart
4836  */
4837 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0620, Function | SmallTest | Level0)
4838 {
4839     auto deployer = GetQuickFixDeployer();
4840     EXPECT_FALSE(deployer == nullptr);
4841     if (deployer != nullptr) {
4842         std::vector<std::string> bundleFilePaths;
4843         bundleFilePaths.push_back(HAP_FILE_PATH1);
4844         BundleInfo bundleInfo;
4845         std::unordered_map<std::string, AppQuickFix> infos;
4846         AppQuickFix appQuickFix;
4847         infos.emplace("appQuickFix_1", appQuickFix);
4848         ErrCode ret = deployer->ProcessPatchDeployStart(bundleFilePaths, bundleInfo, infos);
4849         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SIGNATURE_INFO_NOT_SAME);
4850     }
4851 }
4852 
4853 /**
4854  * @tc.number: ExtractEncryptedSoFiles_0630
4855  * Function: ExtractEncryptedSoFiles
4856  * @tc.name: test ExtractEncryptedSoFiles
4857  */
4858 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0630, Function | SmallTest | Level0)
4859 {
4860     auto deployer = GetQuickFixDeployer();
4861     EXPECT_FALSE(deployer == nullptr);
4862     if (deployer != nullptr) {
4863         BundleInfo bundleInfo;
4864         std::string tmpSoPath;
4865         std::string moduleName;
4866         int32_t uid = -1;
4867         bool ret = deployer->ExtractEncryptedSoFiles(bundleInfo, moduleName, uid, tmpSoPath);
4868         EXPECT_FALSE(ret);
4869     }
4870 }
4871 
4872 /**
4873  * @tc.number: ExtractEncryptedSoFiles_0640
4874  * Function: ExtractEncryptedSoFiles
4875  * @tc.name: test ExtractEncryptedSoFiles
4876  */
4877 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0640, Function | SmallTest | Level0)
4878 {
4879     auto deployer = GetQuickFixDeployer();
4880     EXPECT_FALSE(deployer == nullptr);
4881     if (deployer != nullptr) {
4882         BundleInfo bundleInfo;
4883         HapModuleInfo hapModuleInfo;
4884         hapModuleInfo.moduleName = BUNDLE_NAME;
4885         bundleInfo.hapModuleInfos.push_back(hapModuleInfo);
4886         std::string tmpSoPath = FILE1_PATH;
4887         int32_t uid = -1;
4888         bool ret = deployer->ExtractEncryptedSoFiles(bundleInfo, BUNDLE_NAME, uid, tmpSoPath);
4889         EXPECT_FALSE(ret);
4890     }
4891 }
4892 
4893 /**
4894  * @tc.number: ExtractEncryptedSoFiles_0650
4895  * Function: ExtractEncryptedSoFiles
4896  * @tc.name: test ExtractEncryptedSoFiles
4897  */
4898 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0650, Function | SmallTest | Level0)
4899 {
4900     auto deployer = GetQuickFixDeployer();
4901     EXPECT_FALSE(deployer == nullptr);
4902     if (deployer != nullptr) {
4903         BundleInfo bundleInfo;
4904         HapModuleInfo hapModuleInfo;
4905         hapModuleInfo.moduleName = BUNDLE_NAME;
4906         ApplicationInfo applicationInfo;
4907         bundleInfo.applicationInfo.cpuAbi = "cpuAbi_test";
4908         bundleInfo.applicationInfo.nativeLibraryPath = VALID_FILE_PATH_4;
4909         bundleInfo.hapModuleInfos.push_back(hapModuleInfo);
4910         std::string tmpSoPath = FILE1_PATH;
4911         int32_t uid = -1;
4912         bool ret = deployer->ExtractEncryptedSoFiles(bundleInfo, BUNDLE_NAME, uid, tmpSoPath);
4913         EXPECT_FALSE(ret);
4914     }
4915 }
4916 
4917 /**
4918  * @tc.number: BmsBundleQuickFixTest_0660
4919  * Function: ExtractQuickFixResFile
4920  * @tc.name: test ExtractQuickFixResFile
4921  */
4922 HWTEST_F(BmsBundleQuickFixTest, BmsBundleQuickFixTest_0660, Function | SmallTest | Level0)
4923 {
4924     auto deployer = GetQuickFixDeployer();
4925     EXPECT_FALSE(deployer == nullptr);
4926     AppQuickFix appQuickFix = CreateAppQuickFix();
4927     std::vector<HqfInfo> hqfInfo;
4928     HqfInfo hqf;
4929     HapModuleInfo hapModuleInfo;
4930     hapModuleInfo.moduleName = BUNDLE_NAME;
4931     hqf.moduleName = BUNDLE_NAME;
4932     appQuickFix.deployingAppqfInfo.hqfInfos = hqfInfo;
4933     BundleInfo bundleInfo;
4934     bundleInfo.hapModuleInfos.push_back(hapModuleInfo);
4935     auto ret = deployer->ExtractQuickFixResFile(appQuickFix, bundleInfo);
4936     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PROFILE_PARSE_FAILED);
4937 }
4938 
4939 /**
4940  * @tc.number: DeployQuickFix_0001
4941  * Function: DeployQuickFix
4942  * @tc.name: test DeployQuickFix
4943  * @tc.require: issueI5N7AD
4944  * @tc.desc: DeployQuickFix
4945  */
4946 HWTEST_F(BmsBundleQuickFixTest, DeployQuickFix_0001, Function | SmallTest | Level0)
4947 {
4948     auto deployer = GetQuickFixDeployer();
4949     EXPECT_FALSE(deployer == nullptr);
4950     std::string path = VALID_FILE_PATH_3;
4951     deployer->patchPaths_.push_back(path);
4952     ErrCode ret = deployer->DeployQuickFix();
4953     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
4954 }
4955 
4956 /**
4957  * @tc.number: DeployQuickFix_0002
4958  * Function: DeployQuickFix
4959  * @tc.name: test DeployQuickFix
4960  * @tc.desc: DeployQuickFix
4961  */
4962 HWTEST_F(BmsBundleQuickFixTest, DeployQuickFix_0002, Function | SmallTest | Level0)
4963 {
4964     auto deployer = GetQuickFixDeployer();
4965     EXPECT_FALSE(deployer == nullptr);
4966     if (deployer != nullptr) {
4967         std::vector<std::string> paths;
4968         PatchParser patchParser;
4969         bool hasResourceFile = patchParser.HasResourceFile(paths);
4970         EXPECT_FALSE(hasResourceFile);
4971         paths.emplace_back("");
4972         paths.emplace_back(BUNDLE_NAME);
4973         hasResourceFile = patchParser.HasResourceFile(paths);
4974         EXPECT_FALSE(hasResourceFile);
4975         paths.emplace_back(HAP_PATH_TEST_RAW_FILE);
4976         hasResourceFile = patchParser.HasResourceFile(paths);
4977         EXPECT_TRUE(hasResourceFile);
4978     }
4979 }
4980 
4981 /**
4982  * @tc.number: DeployQuickFix_0003
4983  * Function: DeployQuickFix
4984  * @tc.name: test DeployQuickFix
4985  * @tc.desc: DeployQuickFix
4986  */
4987 HWTEST_F(BmsBundleQuickFixTest, DeployQuickFix_0003, Function | SmallTest | Level0)
4988 {
4989     auto deployer = GetQuickFixDeployer();
4990     EXPECT_FALSE(deployer == nullptr);
4991     if (deployer != nullptr) {
4992         std::vector<std::string> paths;
4993         BundleInfo bundleInfo;
4994         bundleInfo.applicationInfo.debug = true;
4995         bundleInfo.applicationInfo.appProvisionType = Constants::APP_PROVISION_TYPE_DEBUG;
4996         auto ret = deployer->CheckHqfResourceIsValid(paths, bundleInfo);
4997         EXPECT_EQ(ret, ERR_OK);
4998 
4999         bundleInfo.applicationInfo.debug = false;
5000         ret = deployer->CheckHqfResourceIsValid(paths, bundleInfo);
5001         EXPECT_EQ(ret, ERR_OK);
5002 
5003         bundleInfo.applicationInfo.appProvisionType = Constants::APP_PROVISION_TYPE_RELEASE;
5004         ret = deployer->CheckHqfResourceIsValid(paths, bundleInfo);
5005         EXPECT_EQ(ret, ERR_OK);
5006 
5007         paths.emplace_back(HAP_PATH_TEST_RAW_FILE);
5008         ret = deployer->CheckHqfResourceIsValid(paths, bundleInfo);
5009         EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_RELEASE_HAP_HAS_RESOURCES_FILE_FAILED);
5010     }
5011 }
5012 
5013 /**
5014  * @tc.number: QuickFixBootScanner_0200
5015  * @tc.name: Test QuickFixBootScanner
5016  * @tc.desc: 1.Test SetQuickFixState
5017  */
5018 HWTEST_F(BmsBundleQuickFixTest, QuickFixBootScanner_0200, Function | SmallTest | Level0)
5019 {
5020     QuickFixBootScanner scanner;
5021     const std::shared_ptr<QuickFixState> state;
5022     scanner.SetQuickFixState(state);
5023     EXPECT_EQ(scanner.state_, nullptr);
5024 }
5025 
5026 /**
5027  * @tc.number: DefaultNativeSo_0200
5028  * Function: DefaultNativeSo
5029  * @tc.name: test DefaultNativeSo
5030  */
5031 HWTEST_F(BmsBundleQuickFixTest, DefaultNativeSo_0200, Function | SmallTest | Level0)
5032 {
5033     PatchProfile patchProfile;
5034     PatchExtractor patchExtractor(std::string(ServiceConstants::LIBS) + ServiceConstants::ARM64_V8A);
5035     patchExtractor.zipFile_.isOpen_ = true;
5036     ZipEntry zipEntry;
5037     bool res = patchExtractor.Init();
5038     patchExtractor.zipFile_.entriesMap_.emplace(
5039         std::string(ServiceConstants::LIBS) + ServiceConstants::ARM64_V8A + ServiceConstants::BASE, zipEntry);
5040     EXPECT_TRUE(res);
5041     bool isSystemLib64Exist = true;
5042     AppqfInfo appqfInfo;
5043     res = patchProfile.DefaultNativeSo(patchExtractor, isSystemLib64Exist, appqfInfo);
5044     EXPECT_TRUE(res);
5045 }
5046 
5047 /**
5048  * @tc.number: DefaultNativeSo_0300
5049  * Function: DefaultNativeSo
5050  * @tc.name: test DefaultNativeSo
5051  */
5052 HWTEST_F(BmsBundleQuickFixTest, DefaultNativeSo_0300, Function | SmallTest | Level0)
5053 {
5054     PatchProfile patchProfile;
5055     PatchExtractor patchExtractor(std::string(ServiceConstants::LIBS) + ServiceConstants::ARM_EABI_V7A);
5056     patchExtractor.zipFile_.isOpen_ = true;
5057     ZipEntry zipEntry;
5058     bool res = patchExtractor.Init();
5059     patchExtractor.zipFile_.entriesMap_.emplace(
5060         std::string(ServiceConstants::LIBS) + ServiceConstants::ARM_EABI_V7A + ServiceConstants::BASE, zipEntry);
5061     EXPECT_TRUE(res);
5062     bool isSystemLib64Exist = false;
5063     AppqfInfo appqfInfo;
5064     res = patchProfile.DefaultNativeSo(patchExtractor, isSystemLib64Exist, appqfInfo);
5065     EXPECT_TRUE(res);
5066 }
5067 
5068 /**
5069  * @tc.number: DefaultNativeSo_0400
5070  * Function: DefaultNativeSo
5071  * @tc.name: test DefaultNativeSo
5072  */
5073 HWTEST_F(BmsBundleQuickFixTest, DefaultNativeSo_0400, Function | SmallTest | Level0)
5074 {
5075     PatchProfile patchProfile;
5076     PatchExtractor patchExtractor(std::string(ServiceConstants::LIBS) + ServiceConstants::ARM_EABI);
5077     patchExtractor.zipFile_.isOpen_ = true;
5078     ZipEntry zipEntry;
5079     bool res = patchExtractor.Init();
5080     patchExtractor.zipFile_.entriesMap_.emplace(
5081         std::string(ServiceConstants::LIBS) + ServiceConstants::ARM_EABI + ServiceConstants::BASE, zipEntry);
5082     EXPECT_TRUE(res);
5083     bool isSystemLib64Exist = false;
5084     AppqfInfo appqfInfo;
5085     res = patchProfile.DefaultNativeSo(patchExtractor, isSystemLib64Exist, appqfInfo);
5086     EXPECT_TRUE(res);
5087 }
5088 
5089 /**
5090  * @tc.number: ParseNativeSo_0100
5091  * Function: ParseNativeSo
5092  * @tc.name: test ParseNativeSo
5093  */
5094 HWTEST_F(BmsBundleQuickFixTest, ParseNativeSo_0100, Function | SmallTest | Level0)
5095 {
5096     PatchProfile patchProfile;
5097     PatchExtractor patchExtractor(ServiceConstants::LIBS);
5098     patchExtractor.zipFile_.isOpen_ = true;
5099     ZipEntry zipEntry;
5100     bool res = patchExtractor.Init();
5101     patchExtractor.zipFile_.entriesMap_.emplace(std::string(ServiceConstants::LIBS) + ServiceConstants::BASE, zipEntry);
5102     EXPECT_TRUE(res);
5103     AppqfInfo deployedAppqfInfo;
5104     deployedAppqfInfo.versionCode = QUICK_FIX_VERSION_CODE;
5105     deployedAppqfInfo.versionName = QUICK_FIX_VERSION_NAME;
5106     deployedAppqfInfo.cpuAbi = "arm";
5107     deployedAppqfInfo.nativeLibraryPath = QUICK_FIX_SO_PATH;
5108     deployedAppqfInfo.type = QuickFixType::HOT_RELOAD;
5109     res = patchProfile.ParseNativeSo(patchExtractor, deployedAppqfInfo);
5110     EXPECT_FALSE(res);
5111 }
5112 
5113 /**
5114  * @tc.number: QuickFixManagerHost_0100
5115  * @tc.name: test OnRemoteRequest by QuickFixManagerHost
5116  * @tc.desc: OnRemoteRequest
5117  */
5118 HWTEST_F(BmsBundleQuickFixTest, QuickFixManagerHost_0100, Function | SmallTest | Level0)
5119 {
5120     QuickFixManagerHostImpl quickFixMgrHostImpl;
5121 
5122     uint32_t code = static_cast<uint32_t>(QuickFixManagerInterfaceCode::DEPLOY_QUICK_FIX);
5123     MessageParcel data;
5124     MessageParcel reply;
5125     MessageOption option;
5126     int ret = quickFixMgrHostImpl.OnRemoteRequest(code, data, reply, option);
5127     EXPECT_NE(ret, 0);
5128 
5129     code = static_cast<uint32_t>(QuickFixManagerInterfaceCode::SWITCH_QUICK_FIX);
5130     ret = quickFixMgrHostImpl.OnRemoteRequest(code, data, reply, option);
5131     EXPECT_NE(ret, 0);
5132 
5133     code = static_cast<uint32_t>(QuickFixManagerInterfaceCode::DELETE_QUICK_FIX);
5134     ret = quickFixMgrHostImpl.OnRemoteRequest(code, data, reply, option);
5135     EXPECT_NE(ret, 0);
5136 
5137     code = static_cast<uint32_t>(QuickFixManagerInterfaceCode::CREATE_FD);
5138     ret = quickFixMgrHostImpl.OnRemoteRequest(code, data, reply, option);
5139     EXPECT_NE(ret, 0);
5140 
5141     code = -1;
5142     ret = quickFixMgrHostImpl.OnRemoteRequest(code, data, reply, option);
5143     EXPECT_NE(ret, 0);
5144 }
5145 
5146 /**
5147  * @tc.number: QuickFixManagerHost_0200
5148  * @tc.name: test OnRemoteRequest by QuickFixManagerHost
5149  * @tc.desc: OnRemoteRequest
5150  */
5151 HWTEST_F(BmsBundleQuickFixTest, QuickFixManagerHost_0200, Function | SmallTest | Level0)
5152 {
5153     QuickFixManagerHost quickFixMgrHost;
5154 
5155     uint32_t code = static_cast<uint32_t>(QuickFixManagerInterfaceCode::DEPLOY_QUICK_FIX);
5156     MessageParcel data;
5157     MessageParcel reply;
5158     MessageOption option;
5159     int ret = quickFixMgrHost.OnRemoteRequest(code, data, reply, option);
5160     EXPECT_NE(ret, 0);
5161 
5162     code = static_cast<uint32_t>(QuickFixManagerInterfaceCode::SWITCH_QUICK_FIX);
5163     ret = quickFixMgrHost.OnRemoteRequest(code, data, reply, option);
5164     EXPECT_NE(ret, 0);
5165 
5166     code = static_cast<uint32_t>(QuickFixManagerInterfaceCode::DELETE_QUICK_FIX);
5167     ret = quickFixMgrHost.OnRemoteRequest(code, data, reply, option);
5168     EXPECT_NE(ret, 0);
5169 
5170     code = static_cast<uint32_t>(QuickFixManagerInterfaceCode::CREATE_FD);
5171     ret = quickFixMgrHost.OnRemoteRequest(code, data, reply, option);
5172     EXPECT_NE(ret, 0);
5173 
5174     code = -1;
5175     ret = quickFixMgrHost.OnRemoteRequest(code, data, reply, option);
5176     EXPECT_NE(ret, 0);
5177 }
5178 
5179 /**
5180  * @tc.number: DeployQuickFixResult_0300
5181  * @tc.name: Test ReadFromParcel
5182  * @tc.desc: 1.Test the ReadFromParcel of DeployQuickFixResult
5183  */
5184 HWTEST_F(BmsBundleQuickFixTest, DeployQuickFixResult_0300, Function | SmallTest | Level0)
5185 {
5186     DeployQuickFixResult result;
5187 
5188     Parcel parcel;
5189     bool ret = result.ReadFromParcel(parcel);
5190     EXPECT_EQ(ret, true);
5191 }
5192 
5193 /**
5194  * @tc.number: DeployQuickFixResult_0400
5195  * @tc.name: Test Unmarshalling
5196  * @tc.desc: 1.Test the Unmarshalling of DeployQuickFixResult
5197  */
5198 HWTEST_F(BmsBundleQuickFixTest, DeployQuickFixResult_0400, Function | SmallTest | Level0)
5199 {
5200     DeployQuickFixResult result;
5201 
5202     Parcel parcel;
5203     DeployQuickFixResult* ret = result.Unmarshalling(parcel);
5204     EXPECT_NE(ret, nullptr);
5205 }
5206 
5207 /**
5208  * @tc.number: SwitchQuickFixResult_0300
5209  * @tc.name: Test ReadFromParcel
5210  * @tc.desc: 1.Test the ReadFromParcel of SwitchQuickFixResult
5211  */
5212 HWTEST_F(BmsBundleQuickFixTest, SwitchQuickFixResult_0300, Function | SmallTest | Level0)
5213 {
5214     SwitchQuickFixResult result;
5215     Parcel parcel;
5216     bool ret = result.ReadFromParcel(parcel);
5217     EXPECT_EQ(ret, true);
5218 }
5219 
5220 /**
5221  * @tc.number: SwitchQuickFixResult_0400
5222  * @tc.name: Test Unmarshalling
5223  * @tc.desc: 1.Test the Unmarshalling of SwitchQuickFixResult
5224  */
5225 HWTEST_F(BmsBundleQuickFixTest, SwitchQuickFixResult_0400, Function | SmallTest | Level0)
5226 {
5227     SwitchQuickFixResult result;
5228     Parcel parcel;
5229     SwitchQuickFixResult* ret = result.Unmarshalling(parcel);
5230     EXPECT_NE(ret, nullptr);
5231 }
5232 
5233 /**
5234  * @tc.number: SwitchQuickFixResult_0500
5235  * @tc.name: Test Unmarshalling
5236  * @tc.desc: 1.Test the Unmarshalling of SwitchQuickFixResult
5237  */
5238 HWTEST_F(BmsBundleQuickFixTest, SwitchQuickFixResult_0500, Function | SmallTest | Level0)
5239 {
5240     SwitchQuickFixResult result;
5241     Parcel parcel;
5242     std::string ret = result.ToString();
5243     EXPECT_FALSE(ret.empty());
5244 }
5245 
5246 /**
5247  * @tc.number: QuickFixStatusCallbackHost_0100
5248  * Function: OnRemoteRequest
5249  * @tc.name: test OnRemoteRequest by QuickFixStatusCallbackHost
5250  * @tc.desc: OnRemoteRequest.
5251  */
5252 HWTEST_F(BmsBundleQuickFixTest, QuickFixStatusCallbackHost_0100, Function | SmallTest | Level0)
5253 {
5254     MockQuickFixCallback quickFixStatusCallbackHost;
5255     uint32_t code = static_cast<uint32_t>(QuickFixStatusCallbackInterfaceCode::ON_PATCH_DEPLOYED);
5256     MessageParcel data;
5257     MessageParcel reply;
5258     MessageOption option;
5259     int ret = quickFixStatusCallbackHost.OnRemoteRequest(code, data, reply, option);
5260     EXPECT_NE(ret, 0);
5261 
5262     code = static_cast<uint32_t>(QuickFixStatusCallbackInterfaceCode::ON_PATCH_SWITCHED);
5263     ret = quickFixStatusCallbackHost.OnRemoteRequest(code, data, reply, option);
5264     EXPECT_NE(ret, 0);
5265 
5266     code = static_cast<uint32_t>(QuickFixStatusCallbackInterfaceCode::ON_PATCH_DELETED);
5267     ret = quickFixStatusCallbackHost.OnRemoteRequest(code, data, reply, option);
5268     EXPECT_NE(ret, 0);
5269 
5270     code = -1;
5271     ret = quickFixStatusCallbackHost.OnRemoteRequest(code, data, reply, option);
5272     EXPECT_NE(ret, 0);
5273 }
5274 
5275 /**
5276  * @tc.number:QuickFixManagerProxy_0100
5277  * Function: DeployQuickFix
5278  * @tc.name: test DeployQuickFix by QuickFixManagerProxy
5279  * @tc.desc: DeployQuickFix.
5280  */
5281 HWTEST_F(BmsBundleQuickFixTest, QuickFixManagerProxy_0100, Function | SmallTest | Level0)
5282 {
5283     sptr<IRemoteObject> object;
5284     QuickFixManagerProxy quickFixProxy(object);
5285     sptr<MockQuickFixCallback> callback = new (std::nothrow) MockQuickFixCallback();
5286     EXPECT_NE(callback, nullptr) << "the callback is nullptr";
5287     std::vector<std::string> bundleFilePaths;
5288 
5289     ErrCode ret = quickFixProxy.DeployQuickFix(bundleFilePaths, callback);
5290     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
5291 
5292     bundleFilePaths.push_back(HAP_FILE_PATH1);
5293     ret = quickFixProxy.DeployQuickFix(bundleFilePaths, nullptr);
5294     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
5295 
5296     ret = quickFixProxy.DeployQuickFix(bundleFilePaths, callback);
5297     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SEND_REQUEST_FAILED);
5298 }
5299 
5300 /**
5301  * @tc.number:QuickFixManagerProxy_0200
5302  * Function: SwitchQuickFix
5303  * @tc.name: test SwitchQuickFix by QuickFixManagerProxy
5304  * @tc.desc: SwitchQuickFix.
5305  */
5306 HWTEST_F(BmsBundleQuickFixTest, QuickFixManagerProxy_0200, Function | SmallTest | Level0)
5307 {
5308     sptr<IRemoteObject> object;
5309     QuickFixManagerProxy quickFixProxy(object);
5310     sptr<MockQuickFixCallback> callback = new (std::nothrow) MockQuickFixCallback();
5311     EXPECT_NE(callback, nullptr) << "the callback is nullptr";
5312 
5313     ErrCode ret = quickFixProxy.SwitchQuickFix("", true, callback);
5314     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
5315 
5316     ret = quickFixProxy.SwitchQuickFix(BUNDLE_NAME, true, callback);
5317     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SEND_REQUEST_FAILED);
5318 }
5319 
5320 /**
5321  * @tc.number:QuickFixManagerProxy_0300
5322  * Function: DeleteQuickFix
5323  * @tc.name: test DeleteQuickFix by QuickFixManagerProxy
5324  * @tc.desc: DeleteQuickFix.
5325  */
5326 HWTEST_F(BmsBundleQuickFixTest, QuickFixManagerProxy_0300, Function | SmallTest | Level0)
5327 {
5328     sptr<IRemoteObject> object;
5329     QuickFixManagerProxy quickFixProxy(object);
5330     sptr<MockQuickFixCallback> callback = new (std::nothrow) MockQuickFixCallback();
5331     EXPECT_NE(callback, nullptr) << "the callback is nullptr";
5332 
5333     ErrCode ret = quickFixProxy.DeleteQuickFix("", callback);
5334     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
5335 
5336     ret = quickFixProxy.DeleteQuickFix(BUNDLE_NAME, nullptr);
5337     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
5338 
5339     ret = quickFixProxy.DeleteQuickFix(BUNDLE_NAME, callback);
5340     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_SEND_REQUEST_FAILED);
5341 }
5342 
5343 /**
5344  * @tc.number:QuickFixManagerProxy_0400
5345  * Function: CopyFiles
5346  * @tc.name: test CopyFiles by QuickFixManagerProxy
5347  * @tc.desc: CopyFiles.
5348  */
5349 HWTEST_F(BmsBundleQuickFixTest, QuickFixManagerProxy_0400, Function | SmallTest | Level0)
5350 {
5351     sptr<IRemoteObject> object;
5352     QuickFixManagerProxy quickFixProxy(object);
5353     std::vector<std::string> sourceFiles;
5354     std::vector<std::string> destFiles;
5355     ErrCode ret = quickFixProxy.CopyFiles(sourceFiles, destFiles);
5356     EXPECT_EQ(ret, ERR_BUNDLEMANAGER_QUICK_FIX_PARAM_ERROR);
5357 
5358     sourceFiles.push_back(FILE1_PATH);
5359     CreateFiles(sourceFiles);
5360     ret = quickFixProxy.CopyFiles(sourceFiles, destFiles);
5361     EXPECT_EQ(ret, ERR_CODE);
5362     DeleteFiles(sourceFiles);
5363 }
5364 } // OHOS
5365