!5393 quick fix tdd

Merge pull request !5393 from zhuhan/tdd0505
This commit is contained in:
openharmony_ci 2023-05-10 04:23:40 +00:00 committed by Gitee
commit 36d69e06f2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 240 additions and 4 deletions

View File

@ -24,6 +24,7 @@
#define private public
#include "quick_fix_manager_service.h"
#undef private
#include "quick_fix_result_info.h"
#include "system_ability_definition.h"
using namespace testing;
@ -205,5 +206,240 @@ HWTEST_F(QuickFixManagerApplyTaskTest, NotifyApplyStatus_0100, TestSize.Level1)
applyTask->NotifyApplyStatus(QUICK_FIX_OK);
HILOG_INFO("%{public}s end.", __func__);
}
/**
* @tc.name: RemoveTimeoutTask_0100
* @tc.desc: remove timeout task
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(QuickFixManagerApplyTaskTest, RemoveTimeoutTask_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
auto applyTask = std::make_shared<QuickFixManagerApplyTask>(bundleQfMgr_, appMgr_,
nullptr, quickFixMs_);
ASSERT_NE(applyTask, nullptr);
applyTask->RemoveTimeoutTask();
HILOG_INFO("%{public}s end.", __func__);
}
/**
* @tc.name: RemoveTimeoutTask_0200
* @tc.desc: remove timeout task
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(QuickFixManagerApplyTaskTest, RemoveTimeoutTask_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
auto applyTask = std::make_shared<QuickFixManagerApplyTask>(bundleQfMgr_, appMgr_,
quickFixMs_->eventHandler_, quickFixMs_);
ASSERT_NE(applyTask, nullptr);
applyTask->RemoveTimeoutTask();
HILOG_INFO("%{public}s end.", __func__);
}
/**
* @tc.name: SetQuickFixInfo_0100
* @tc.desc: set quick fix info
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(QuickFixManagerApplyTaskTest, SetQuickFixInfo_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
auto applyTask = std::make_shared<QuickFixManagerApplyTask>(bundleQfMgr_, appMgr_,
quickFixMs_->eventHandler_, quickFixMs_);
ASSERT_NE(applyTask, nullptr);
std::shared_ptr<AppExecFwk::QuickFixResult> quickFixRes =
std::make_shared<AppExecFwk::DeployQuickFixResult>();
bool res = applyTask->SetQuickFixInfo(quickFixRes);
ASSERT_EQ(res, false);
HILOG_INFO("%{public}s end.", __func__);
}
/**
* @tc.name: SetQuickFixInfo_0200
* @tc.desc: set quick fix info
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(QuickFixManagerApplyTaskTest, SetQuickFixInfo_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
auto applyTask = std::make_shared<QuickFixManagerApplyTask>(bundleQfMgr_, appMgr_,
quickFixMs_->eventHandler_, quickFixMs_);
ASSERT_NE(applyTask, nullptr);
auto quickFixRes = std::make_shared<AppExecFwk::DeployQuickFixResult>();
quickFixRes->bundleName = "bundleName";
quickFixRes->type = AppExecFwk::QuickFixType::PATCH;
bool res = applyTask->SetQuickFixInfo(quickFixRes);
ASSERT_EQ(res, true);
HILOG_INFO("%{public}s end.", __func__);
}
/**
* @tc.name: SetQuickFixInfo_0300
* @tc.desc: set quick fix info
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(QuickFixManagerApplyTaskTest, SetQuickFixInfo_0300, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
auto applyTask = std::make_shared<QuickFixManagerApplyTask>(bundleQfMgr_, appMgr_,
quickFixMs_->eventHandler_, quickFixMs_);
ASSERT_NE(applyTask, nullptr);
auto quickFixRes = std::make_shared<AppExecFwk::DeployQuickFixResult>();
quickFixRes->bundleName = "bundleName";
bool res = applyTask->SetQuickFixInfo(quickFixRes);
ASSERT_EQ(res, false);
HILOG_INFO("%{public}s end.", __func__);
}
/**
* @tc.name: GetRunningState_0100
* @tc.desc: get running state
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(QuickFixManagerApplyTaskTest, GetRunningState_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
auto applyTask = std::make_shared<QuickFixManagerApplyTask>(bundleQfMgr_, nullptr,
quickFixMs_->eventHandler_, quickFixMs_);
ASSERT_NE(applyTask, nullptr);
bool res = applyTask->GetRunningState();
ASSERT_EQ(res, false);
HILOG_INFO("%{public}s end.", __func__);
}
/**
* @tc.name: PostNotifyLoadRepairPatchTask_0100
* @tc.desc: post notify load repair patch task
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(QuickFixManagerApplyTaskTest, PostNotifyLoadRepairPatchTask_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
auto applyTask = std::make_shared<QuickFixManagerApplyTask>(bundleQfMgr_, appMgr_,
quickFixMs_->eventHandler_, quickFixMs_);
ASSERT_NE(applyTask, nullptr);
applyTask->PostNotifyLoadRepairPatchTask();
HILOG_INFO("%{public}s end.", __func__);
}
/**
* @tc.name: PostNotifyLoadRepairPatchTask_0200
* @tc.desc: post notify load repair patch task
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(QuickFixManagerApplyTaskTest, PostNotifyLoadRepairPatchTask_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
auto applyTask = std::make_shared<QuickFixManagerApplyTask>(bundleQfMgr_, appMgr_,
nullptr, quickFixMs_);
ASSERT_NE(applyTask, nullptr);
applyTask->PostNotifyLoadRepairPatchTask();
HILOG_INFO("%{public}s end.", __func__);
}
/**
* @tc.name: PostNotifyUnloadRepairPatchTask_0100
* @tc.desc: post notify unload repair patch task
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(QuickFixManagerApplyTaskTest, PostNotifyUnloadRepairPatchTask_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
auto applyTask = std::make_shared<QuickFixManagerApplyTask>(bundleQfMgr_, appMgr_,
quickFixMs_->eventHandler_, quickFixMs_);
ASSERT_NE(applyTask, nullptr);
applyTask->PostNotifyUnloadRepairPatchTask();
HILOG_INFO("%{public}s end.", __func__);
}
/**
* @tc.name: PostNotifyUnloadRepairPatchTask_0200
* @tc.desc: post notify unload repair patch task
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(QuickFixManagerApplyTaskTest, PostNotifyUnloadRepairPatchTask_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
auto applyTask = std::make_shared<QuickFixManagerApplyTask>(bundleQfMgr_, appMgr_,
nullptr, quickFixMs_);
ASSERT_NE(applyTask, nullptr);
applyTask->PostNotifyUnloadRepairPatchTask();
HILOG_INFO("%{public}s end.", __func__);
}
/**
* @tc.name: PostNotifyHotReloadPageTask_0100
* @tc.desc: post notify hotreload page task
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(QuickFixManagerApplyTaskTest, PostNotifyHotReloadPageTask_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
auto applyTask = std::make_shared<QuickFixManagerApplyTask>(bundleQfMgr_, appMgr_,
quickFixMs_->eventHandler_, quickFixMs_);
ASSERT_NE(applyTask, nullptr);
applyTask->PostNotifyHotReloadPageTask();
HILOG_INFO("%{public}s end.", __func__);
}
/**
* @tc.name: PostNotifyHotReloadPageTask_0200
* @tc.desc: post notify hotreload page task
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(QuickFixManagerApplyTaskTest, PostNotifyHotReloadPageTask_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
auto applyTask = std::make_shared<QuickFixManagerApplyTask>(bundleQfMgr_, appMgr_,
nullptr, quickFixMs_);
ASSERT_NE(applyTask, nullptr);
applyTask->PostNotifyHotReloadPageTask();
HILOG_INFO("%{public}s end.", __func__);
}
/**
* @tc.name: RegAppStateObserver_0100
* @tc.desc: register app state observer
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(QuickFixManagerApplyTaskTest, RegAppStateObserver_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
auto applyTask = std::make_shared<QuickFixManagerApplyTask>(bundleQfMgr_, appMgr_,
quickFixMs_->eventHandler_, quickFixMs_);
ASSERT_NE(applyTask, nullptr);
applyTask->RegAppStateObserver();
HILOG_INFO("%{public}s end.", __func__);
}
/**
* @tc.name: RegAppStateObserver_0200
* @tc.desc: register app state observer
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(QuickFixManagerApplyTaskTest, RegAppStateObserver_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
auto applyTask = std::make_shared<QuickFixManagerApplyTask>(bundleQfMgr_, nullptr,
quickFixMs_->eventHandler_, quickFixMs_);
ASSERT_NE(applyTask, nullptr);
applyTask->RegAppStateObserver();
HILOG_INFO("%{public}s end.", __func__);
}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -116,8 +116,8 @@ ohos_executable("aa") {
part_name = "ability_tools"
}
ohos_prebuilt_etc("shell_command_excutor_config.json") {
source = "resource/shell_command_excutor_config.json"
ohos_prebuilt_etc("shell_command_executor_config.json") {
source = "resource/shell_command_executor_config.json"
subsystem_name = "ability"
part_name = "ability_tools"
}
@ -125,6 +125,6 @@ ohos_prebuilt_etc("shell_command_excutor_config.json") {
group("tools_aa") {
deps = [
":aa",
":shell_command_excutor_config.json",
":shell_command_executor_config.json",
]
}

View File

@ -29,7 +29,7 @@ using namespace std::chrono_literals;
namespace OHOS {
namespace AAFwk {
namespace {
constexpr const char* AA_TOOL_COMMAND_CONFIG = "/system/etc/shell_command_excutor_config.json";
constexpr const char* AA_TOOL_COMMAND_CONFIG = "/system/etc/shell_command_executor_config.json";
}
TestObserver::TestObserver() : isFinished_(false)