!5138 整改tdd用例缺少断言问题

Merge pull request !5138 from 周士成/master
This commit is contained in:
openharmony_ci
2023-04-01 10:03:15 +00:00
committed by Gitee
31 changed files with 458 additions and 41 deletions
@@ -1502,6 +1502,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_TerminateAbilityResultLocked
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_GetOrCreateServiceRecord_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
AbilityRequest abilityRequest;
bool isCreatedByConnect = false;
std::shared_ptr<AbilityRecord> targetService = nullptr;
@@ -1522,6 +1523,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_GetOrCreateServiceRecord_001
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_ConnectAbilityLocked_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
auto handler = std::make_shared<EventHandler>(EventRunner::Create());
connectManager->SetEventHandler(handler);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
@@ -1581,6 +1583,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_AttachAbilityThreadLocked_00
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_OnAppStateChanged_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
AppInfo info;
std::string bundleName = "bundleName";
@@ -1606,6 +1609,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_OnAppStateChanged_001, TestS
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_OnAppStateChanged_002, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
AppInfo info;
std::string bundleName = "bundleName";
@@ -1864,6 +1868,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_LoadAbility_002, TestSize.Le
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_PostTimeOutTask_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
uint32_t messageId = 2;
connectManager->PostTimeOutTask(abilityRecord, messageId);
@@ -1880,6 +1885,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_PostTimeOutTask_001, TestSiz
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_HandleStartTimeoutTask_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
int resultCode = LOAD_ABILITY_TIMEOUT;
abilityRecord->abilityInfo_.name = "abilityName";
@@ -1897,6 +1903,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_HandleStartTimeoutTask_001,
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_HandleStartTimeoutTask_002, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
int resultCode = LOAD_ABILITY_TIMEOUT;
abilityRecord->abilityInfo_.name = AbilityConfig::LAUNCHER_ABILITY_NAME;
@@ -1914,6 +1921,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_HandleStartTimeoutTask_002,
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_HandleStartTimeoutTask_003, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
int resultCode = CONNECTION_TIMEOUT;
abilityRecord->abilityInfo_.name = AbilityConfig::LAUNCHER_ABILITY_NAME;
@@ -1931,6 +1939,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_HandleStartTimeoutTask_003,
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_HandleCommandTimeoutTask_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
abilityRecord->abilityInfo_.name = AbilityConfig::LAUNCHER_ABILITY_NAME;
connectManager->HandleCommandTimeoutTask(abilityRecord);
@@ -1949,6 +1958,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_HandleCommandTimeoutTask_001
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_HandleTerminateDisconnectTask_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
OHOS::sptr<IAbilityConnection> callback = new AbilityConnectCallback();
std::shared_ptr<ConnectionRecord> connection =
std::make_shared<ConnectionRecord>(nullptr, nullptr, callback);
@@ -2008,6 +2018,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_DispatchTerminate_001, TestS
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_CommandAbility_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
connectManager->SetEventHandler(nullptr);
connectManager->CommandAbility(abilityRecord);
@@ -2024,6 +2035,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_CommandAbility_001, TestSize
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_TerminateDone_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
abilityRecord->SetAbilityState(AbilityState::TERMINATING);
connectManager->TerminateDone(abilityRecord);
@@ -2064,6 +2076,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_IsAbilityConnected_001, Test
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_RemoveServiceAbility_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
AbilityInfo abilityInfo;
abilityRecord->abilityInfo_ = abilityInfo;
@@ -2082,6 +2095,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_RemoveServiceAbility_001, Te
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_OnCallBackDied_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
wptr<IRemoteObject> remote{ abilityRecord->GetToken() };
connectManager->SetEventHandler(nullptr);
@@ -2099,6 +2113,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_OnCallBackDied_001, TestSize
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_HandleCallBackDiedTask_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
sptr<IRemoteObject> connect = abilityRecord->GetToken();
connectManager->connectMap_.clear();
@@ -2116,6 +2131,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_HandleCallBackDiedTask_001,
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_OnAbilityDied_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
int32_t currentUserId = 0;
abilityRecord->abilityInfo_.type = AbilityType::PAGE;
@@ -2136,6 +2152,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_OnAbilityDied_001, TestSize.
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_OnTimeOut_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
uint32_t msgId = 2;
connectManager->serviceMap_.emplace("first", abilityRecord);
@@ -2156,6 +2173,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_OnTimeOut_001, TestSize.Leve
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_HandleInactiveTimeout_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
abilityRecord->abilityInfo_.name = AbilityConfig::LAUNCHER_ABILITY_NAME;
connectManager->HandleInactiveTimeout(abilityRecord);
@@ -2174,6 +2192,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_HandleInactiveTimeout_001, T
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_HandleAbilityDiedTask_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
int32_t currentUserId = 0;
connectManager->serviceMap_.clear();
@@ -2191,6 +2210,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_HandleAbilityDiedTask_001, T
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_RestartAbility_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
int32_t currentUserId = 0;
connectManager->userId_ = 1;
@@ -2211,6 +2231,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_RestartAbility_001, TestSize
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_RestartAbility_002, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
int32_t currentUserId = 0;
connectManager->userId_ = currentUserId;
@@ -2230,6 +2251,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_RestartAbility_002, TestSize
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_DumpState_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
std::vector<std::string> info;
bool isClient = false;
@@ -2253,6 +2275,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_DumpState_001, TestSize.Leve
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_DumpStateByUri_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
std::vector<std::string> info;
bool isClient = false;
@@ -2275,6 +2298,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_DumpStateByUri_001, TestSize
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_GetExtensionRunningInfos_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
int upperLimit = 1;
std::vector<ExtensionRunningInfo> info;
@@ -2297,6 +2321,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_GetExtensionRunningInfos_001
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_GetExtensionRunningInfo_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = serviceRecord_;
OHOS::sptr<IAbilityConnection> callback = new AbilityConnectCallback();
std::shared_ptr<ConnectionRecord> connection =
@@ -2324,6 +2349,7 @@ HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_GetExtensionRunningInfo_001,
HWTEST_F(AbilityConnectManagerTest, AAFwk_AbilityMS_StopAllExtensions_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(0);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord1 = serviceRecord_;
std::shared_ptr<AbilityRecord> abilityRecord2 = serviceRecord_;
abilityRecord1->abilityInfo_.type = AbilityType::EXTENSION;
@@ -2599,6 +2625,7 @@ HWTEST_F(AbilityConnectManagerTest, MinimizeUIExtensionAbilityLocked_003, TestSi
HWTEST_F(AbilityConnectManagerTest, MoveToBackground_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord;
connectManager->MoveToBackground(abilityRecord);
connectManager.reset();
@@ -2615,6 +2642,7 @@ HWTEST_F(AbilityConnectManagerTest, MoveToBackground_001, TestSize.Level1)
HWTEST_F(AbilityConnectManagerTest, MoveToBackground_002, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
abilityRecord->lifeCycleStateInfo_.sceneFlag = 1;
connectManager->MoveToBackground(abilityRecord);
@@ -2632,6 +2660,7 @@ HWTEST_F(AbilityConnectManagerTest, MoveToBackground_002, TestSize.Level1)
HWTEST_F(AbilityConnectManagerTest, MoveToBackground_003, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
abilityRecord->lifeCycleStateInfo_.sceneFlag = 2;
abilityRecord->SetClearMissionFlag(true);
@@ -2651,6 +2680,7 @@ HWTEST_F(AbilityConnectManagerTest, MoveToBackground_003, TestSize.Level1)
HWTEST_F(AbilityConnectManagerTest, CompleteBackground_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
abilityRecord->currentState_ = AbilityState::FOREGROUND;
connectManager->CompleteBackground(abilityRecord);
@@ -2668,6 +2698,7 @@ HWTEST_F(AbilityConnectManagerTest, CompleteBackground_001, TestSize.Level1)
HWTEST_F(AbilityConnectManagerTest, CompleteBackground_002, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
abilityRecord->currentState_ = AbilityState::BACKGROUNDING;
abilityRecord->SetPendingState(AbilityState::FOREGROUND);
@@ -2687,6 +2718,7 @@ HWTEST_F(AbilityConnectManagerTest, CompleteBackground_002, TestSize.Level1)
HWTEST_F(AbilityConnectManagerTest, CompleteBackground_003, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
abilityRecord->currentState_ = AbilityState::BACKGROUNDING;
abilityRecord->SetPendingState(AbilityState::BACKGROUND);
@@ -2709,6 +2741,7 @@ HWTEST_F(AbilityConnectManagerTest, CompleteBackground_003, TestSize.Level1)
HWTEST_F(AbilityConnectManagerTest, CompleteBackground_004, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
std::shared_ptr<AbilityRecord> abilityRecord2 = InitAbilityRecord();
abilityRecord->currentState_ = AbilityState::BACKGROUNDING;
@@ -2733,6 +2766,7 @@ HWTEST_F(AbilityConnectManagerTest, CompleteBackground_004, TestSize.Level1)
HWTEST_F(AbilityConnectManagerTest, CompleteBackground_005, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
std::shared_ptr<AbilityRecord> abilityRecord2 = InitAbilityRecord();
abilityRecord->currentState_ = AbilityState::BACKGROUNDING;
@@ -2757,6 +2791,7 @@ HWTEST_F(AbilityConnectManagerTest, CompleteBackground_005, TestSize.Level1)
HWTEST_F(AbilityConnectManagerTest, CompleteBackground_006, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
std::shared_ptr<AbilityRecord> abilityRecord2 = InitAbilityRecord();
abilityRecord->currentState_ = AbilityState::BACKGROUNDING;
@@ -2781,6 +2816,7 @@ HWTEST_F(AbilityConnectManagerTest, CompleteBackground_006, TestSize.Level1)
HWTEST_F(AbilityConnectManagerTest, PrintTimeOutLog_001, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
uint32_t msgId = 0;
connectManager->PrintTimeOutLog(nullptr, msgId);
connectManager.reset();
@@ -2797,6 +2833,7 @@ HWTEST_F(AbilityConnectManagerTest, PrintTimeOutLog_001, TestSize.Level1)
HWTEST_F(AbilityConnectManagerTest, PrintTimeOutLog_002, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
uint32_t msgId = 0;
connectManager->PrintTimeOutLog(abilityRecord, msgId);
@@ -2814,6 +2851,7 @@ HWTEST_F(AbilityConnectManagerTest, PrintTimeOutLog_002, TestSize.Level1)
HWTEST_F(AbilityConnectManagerTest, PrintTimeOutLog_003, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
uint32_t msgId = 1;
connectManager->PrintTimeOutLog(abilityRecord, msgId);
@@ -2831,6 +2869,7 @@ HWTEST_F(AbilityConnectManagerTest, PrintTimeOutLog_003, TestSize.Level1)
HWTEST_F(AbilityConnectManagerTest, PrintTimeOutLog_004, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
uint32_t msgId = 2;
connectManager->PrintTimeOutLog(abilityRecord, msgId);
@@ -2848,6 +2887,7 @@ HWTEST_F(AbilityConnectManagerTest, PrintTimeOutLog_004, TestSize.Level1)
HWTEST_F(AbilityConnectManagerTest, PrintTimeOutLog_005, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
uint32_t msgId = 4;
connectManager->PrintTimeOutLog(abilityRecord, msgId);
@@ -2865,6 +2905,7 @@ HWTEST_F(AbilityConnectManagerTest, PrintTimeOutLog_005, TestSize.Level1)
HWTEST_F(AbilityConnectManagerTest, PrintTimeOutLog_006, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
uint32_t msgId = 5;
connectManager->PrintTimeOutLog(abilityRecord, msgId);
@@ -2882,6 +2923,7 @@ HWTEST_F(AbilityConnectManagerTest, PrintTimeOutLog_006, TestSize.Level1)
HWTEST_F(AbilityConnectManagerTest, PrintTimeOutLog_007, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
uint32_t msgId = 6;
connectManager->PrintTimeOutLog(abilityRecord, msgId);
@@ -2899,6 +2941,7 @@ HWTEST_F(AbilityConnectManagerTest, PrintTimeOutLog_007, TestSize.Level1)
HWTEST_F(AbilityConnectManagerTest, PrintTimeOutLog_008, TestSize.Level1)
{
std::shared_ptr<AbilityConnectManager> connectManager = std::make_shared<AbilityConnectManager>(3);
ASSERT_NE(connectManager, nullptr);
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
uint32_t msgId = 3;
connectManager->PrintTimeOutLog(abilityRecord, msgId);
@@ -904,6 +904,7 @@ HWTEST_F(AbilityManagerServiceTest, NotifyCompleteContinuation_001, TestSize.Lev
{
HILOG_INFO("AbilityManagerServiceTest NotifyCompleteContinuation_001 start");
std::string deviceId = "test";
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->NotifyCompleteContinuation(deviceId, 1, true);
HILOG_INFO("AbilityManagerServiceTest NotifyCompleteContinuation_001 end");
}
@@ -1105,6 +1106,7 @@ HWTEST_F(AbilityManagerServiceTest, SendWantSender_001, TestSize.Level1)
HWTEST_F(AbilityManagerServiceTest, CancelWantSender_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest CancelWantSender_001 start");
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->CancelWantSender(nullptr);
HILOG_INFO("AbilityManagerServiceTest CancelWantSender_001 end");
}
@@ -1203,6 +1205,7 @@ HWTEST_F(AbilityManagerServiceTest, GetPendingWantType_001, TestSize.Level1)
HWTEST_F(AbilityManagerServiceTest, RegisterCancelListener_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest RegisterCancelListener_001 start");
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->RegisterCancelListener(nullptr, nullptr);
HILOG_INFO("AbilityManagerServiceTest RegisterCancelListener_001 end");
}
@@ -1216,6 +1219,7 @@ HWTEST_F(AbilityManagerServiceTest, RegisterCancelListener_001, TestSize.Level1)
HWTEST_F(AbilityManagerServiceTest, UnregisterCancelListener_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest UnregisterCancelListener_001 start");
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->UnregisterCancelListener(nullptr, nullptr);
HILOG_INFO("AbilityManagerServiceTest UnregisterCancelListener_001 end");
}
@@ -1466,6 +1470,7 @@ HWTEST_F(AbilityManagerServiceTest, DumpInner_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest DumpInner_001 start");
std::vector<std::string> info;
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->DumpInner("", info);
HILOG_INFO("AbilityManagerServiceTest DumpInner_001 end");
}
@@ -1480,6 +1485,7 @@ HWTEST_F(AbilityManagerServiceTest, DumpMissionListInner_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest DumpMissionListInner_001 start");
std::vector<std::string> info;
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->DumpMissionListInner("", info);
HILOG_INFO("AbilityManagerServiceTest DumpMissionListInner_001 end");
}
@@ -1494,6 +1500,7 @@ HWTEST_F(AbilityManagerServiceTest, DumpMissionInfosInner_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest DumpMissionInfosInner_001 start");
std::vector<std::string> info;
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->DumpMissionInfosInner("", info);
HILOG_INFO("AbilityManagerServiceTest DumpMissionInfosInner_001 end");
}
@@ -1508,6 +1515,7 @@ HWTEST_F(AbilityManagerServiceTest, DumpMissionInner_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest DumpMissionInner_001 start");
std::vector<std::string> info;
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->DumpMissionInner("", info);
HILOG_INFO("AbilityManagerServiceTest DumpMissionInner_001 end");
}
@@ -1522,6 +1530,7 @@ HWTEST_F(AbilityManagerServiceTest, DumpStateInner_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest DumpStateInner_001 start");
std::vector<std::string> info;
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->DumpStateInner("", info);
HILOG_INFO("AbilityManagerServiceTest DumpStateInner_001 end");
}
@@ -1536,6 +1545,7 @@ HWTEST_F(AbilityManagerServiceTest, DataDumpStateInner_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest DataDumpStateInner_001 start");
std::vector<std::string> info;
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->DataDumpStateInner("", info);
HILOG_INFO("AbilityManagerServiceTest DataDumpStateInner_001 end");
}
@@ -1550,6 +1560,7 @@ HWTEST_F(AbilityManagerServiceTest, DumpState_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest DumpState_001 start");
std::vector<std::string> info;
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->DumpState("", info);
HILOG_INFO("AbilityManagerServiceTest DumpState_001 end");
}
@@ -1564,6 +1575,7 @@ HWTEST_F(AbilityManagerServiceTest, DumpSysState_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest DumpSysState_001 start");
std::vector<std::string> info;
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->DumpSysState("", info, true, true, 100);
HILOG_INFO("AbilityManagerServiceTest DumpSysState_001 end");
}
@@ -1619,6 +1631,7 @@ HWTEST_F(AbilityManagerServiceTest, ScheduleCommandAbilityDone_001, TestSize.Lev
HWTEST_F(AbilityManagerServiceTest, OnAbilityRequestDone_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest OnAbilityRequestDone_001 start");
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->OnAbilityRequestDone(nullptr, 1);
abilityMs_->OnAbilityRequestDone(MockToken(AbilityType::DATA), 1);
abilityMs_->OnAbilityRequestDone(MockToken(AbilityType::UNKNOWN), 1);
@@ -1635,6 +1648,7 @@ HWTEST_F(AbilityManagerServiceTest, OnAppStateChanged_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest OnAppStateChanged_001 start");
AppInfo info;
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->OnAppStateChanged(info);
HILOG_INFO("AbilityManagerServiceTest OnAppStateChanged_001 end");
}
@@ -1648,6 +1662,7 @@ HWTEST_F(AbilityManagerServiceTest, OnAppStateChanged_001, TestSize.Level1)
HWTEST_F(AbilityManagerServiceTest, GetEventHandler_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest GetEventHandler_001 start");
ASSERT_NE(abilityMs_, nullptr);
EXPECT_NE(abilityMs_->GetEventHandler(), nullptr);
HILOG_INFO("AbilityManagerServiceTest GetEventHandler_001 end");
}
@@ -1661,6 +1676,7 @@ HWTEST_F(AbilityManagerServiceTest, GetEventHandler_001, TestSize.Level1)
HWTEST_F(AbilityManagerServiceTest, InitMissionListManager_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest InitMissionListManager_001 start");
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->InitMissionListManager(100, false);
HILOG_INFO("AbilityManagerServiceTest InitMissionListManager_001 end");
}
@@ -1745,6 +1761,7 @@ HWTEST_F(AbilityManagerServiceTest, GetMaxRestartNum_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest GetMaxRestartNum_001 start");
int max = 0;
ASSERT_NE(abilityMs_, nullptr);
max = AmsConfigurationParameter::GetInstance().GetMaxRestartNum(true);
HILOG_INFO("AbilityManagerServiceTest GetMaxRestartNum_001 end");
}
@@ -1843,6 +1860,7 @@ HWTEST_F(AbilityManagerServiceTest, IsSystemUI_001, TestSize.Level1)
HWTEST_F(AbilityManagerServiceTest, HandleActiveTimeOut_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest HandleActiveTimeOut_001 start");
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->HandleActiveTimeOut(100);
HILOG_INFO("AbilityManagerServiceTest HandleActiveTimeOut_001 end");
}
@@ -1856,6 +1874,7 @@ HWTEST_F(AbilityManagerServiceTest, HandleActiveTimeOut_001, TestSize.Level1)
HWTEST_F(AbilityManagerServiceTest, HandleInactiveTimeOut_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest HandleInactiveTimeOut_001 start");
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->HandleInactiveTimeOut(100);
HILOG_INFO("AbilityManagerServiceTest HandleInactiveTimeOut_001 end");
}
@@ -1970,6 +1989,7 @@ HWTEST_F(AbilityManagerServiceTest, GetDataAbilityManagerByToken_001, TestSize.L
HWTEST_F(AbilityManagerServiceTest, StartResidentApps_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest StartResidentApps_001 start");
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->StartResidentApps();
HILOG_INFO("AbilityManagerServiceTest StartResidentApps_001 end");
}
@@ -1983,6 +2003,7 @@ HWTEST_F(AbilityManagerServiceTest, StartResidentApps_001, TestSize.Level1)
HWTEST_F(AbilityManagerServiceTest, ConnectBmsService_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest ConnectBmsService_001 start");
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->ConnectBmsService();
HILOG_INFO("AbilityManagerServiceTest ConnectBmsService_001 end");
}
@@ -2144,6 +2165,7 @@ HWTEST_F(AbilityManagerServiceTest, OnAcceptWantResponse_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest OnAcceptWantResponse_001 start");
AAFwk::Want want;
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->OnAcceptWantResponse(want, "test");
auto temp = abilityMs_->currentMissionListManager_;
@@ -2163,6 +2185,7 @@ HWTEST_F(AbilityManagerServiceTest, OnStartSpecifiedAbilityTimeoutResponse_001,
{
HILOG_INFO("AbilityManagerServiceTest OnStartSpecifiedAbilityTimeoutResponse_001 start");
AAFwk::Want want;
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->OnStartSpecifiedAbilityTimeoutResponse(want);
auto temp = abilityMs_->currentMissionListManager_;
@@ -2257,6 +2280,7 @@ HWTEST_F(AbilityManagerServiceTest, GetProcessRunningInfosByUserId_001, TestSize
HWTEST_F(AbilityManagerServiceTest, ClearUserData_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest ClearUserData_001 start");
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->ClearUserData(100);
HILOG_INFO("AbilityManagerServiceTest ClearUserData_001 end");
}
@@ -2296,6 +2320,7 @@ HWTEST_F(AbilityManagerServiceTest, CallRequestDone_001, TestSize.Level1)
HILOG_INFO("AbilityManagerServiceTest CallRequestDone_001 start");
sptr<IRemoteObject> token = nullptr;
sptr<IRemoteObject> callStub = nullptr;
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->CallRequestDone(token, callStub);
HILOG_INFO("AbilityManagerServiceTest CallRequestDone_001 end");
}
@@ -2333,6 +2358,7 @@ HWTEST_F(AbilityManagerServiceTest, UpdateMissionSnapShot_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest UpdateMissionSnapShot_001 start");
MissionSnapshot missionSnapshot;
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->UpdateMissionSnapShot(nullptr);
MyFlag::flag_ = 1;
@@ -2350,6 +2376,7 @@ HWTEST_F(AbilityManagerServiceTest, UpdateMissionSnapShot_001, TestSize.Level1)
HWTEST_F(AbilityManagerServiceTest, EnableRecoverAbility_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest EnableRecoverAbility_001 start");
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->EnableRecoverAbility(nullptr);
abilityMs_->EnableRecoverAbility(MockToken(AbilityType::PAGE));
HILOG_INFO("AbilityManagerServiceTest EnableRecoverAbility_001 end");
@@ -2365,6 +2392,7 @@ HWTEST_F(AbilityManagerServiceTest, RecoverAbilityRestart_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest RecoverAbilityRestart_001 start");
Want want;
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->RecoverAbilityRestart(want);
HILOG_INFO("AbilityManagerServiceTest RecoverAbilityRestart_001 end");
}
@@ -2378,6 +2406,7 @@ HWTEST_F(AbilityManagerServiceTest, RecoverAbilityRestart_001, TestSize.Level1)
HWTEST_F(AbilityManagerServiceTest, ScheduleRecoverAbility_001, TestSize.Level1)
{
HILOG_INFO("AbilityManagerServiceTest ScheduleRecoverAbility_001 start");
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->ScheduleRecoverAbility(nullptr, 1);
sptr<IRemoteObject> token = MockToken(AbilityType::SERVICE);
abilityMs_->ScheduleRecoverAbility(token, 1);
@@ -2658,6 +2687,7 @@ HWTEST_F(AbilityManagerServiceTest, UpdateCallerInfo_001, TestSize.Level1)
HILOG_INFO("AbilityManagerServiceTest UpdateCallerInfo_001 start");
Want want;
sptr<IRemoteObject> callerToken = MockToken(AbilityType::PAGE);
ASSERT_NE(abilityMs_, nullptr);
abilityMs_->UpdateCallerInfo(want, callerToken);
HILOG_INFO("AbilityManagerServiceTest UpdateCallerInfo_001 end");
}
@@ -24,8 +24,10 @@ ohos_unittest("ams_mgr_scheduler_test") {
"${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy/include",
]
sources =
[ "${ability_runtime_services_path}/appmgr/src/ams_mgr_scheduler.cpp" ]
sources = [
"${ability_runtime_services_path}/appmgr/src/ams_mgr_scheduler.cpp",
"${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp",
]
sources += [ "ams_mgr_scheduler_test.cpp" ]
@@ -23,6 +23,7 @@
#include "hilog_wrapper.h"
#include "mock_ability_token.h"
#include "mock_app_mgr_service_inner.h"
#include "mock_bundle_manager.h"
#include "application_state_observer_stub.h"
using namespace testing;
@@ -106,6 +107,7 @@ HWTEST_F(AmsMgrSchedulerTest, AmsMgrScheduler_001, TestSize.Level1)
auto amsEventHandler = GetAmsEventHandler();
std::unique_ptr<AmsMgrScheduler> amsMgrScheduler =
std::make_unique<AmsMgrScheduler>(mockAppMgrServiceInner, amsEventHandler);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IRemoteObject> token = new MockAbilityToken();
sptr<IRemoteObject> preToken = new MockAbilityToken();
@@ -139,6 +141,7 @@ HWTEST_F(AmsMgrSchedulerTest, AmsMgrScheduler_002, TestSize.Level1)
auto amsEventHandler = std::make_shared<AMSEventHandler>(eventRunner, mockAppMgrServiceInner);
std::unique_ptr<AmsMgrScheduler> amsMgrScheduler =
std::make_unique<AmsMgrScheduler>(mockAppMgrServiceInner, amsEventHandler);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IRemoteObject> token = new MockAbilityToken();
sptr<IRemoteObject> preToken = new MockAbilityToken();
@@ -174,6 +177,7 @@ HWTEST_F(AmsMgrSchedulerTest, AmsMgrScheduler_003, TestSize.Level1)
auto amsEventHandler = GetAmsEventHandler();
std::unique_ptr<AmsMgrScheduler> amsMgrScheduler =
std::make_unique<AmsMgrScheduler>(mockAppMgrServiceInner, amsEventHandler);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IRemoteObject> token = new MockAbilityToken();
AbilityState abilityState = AbilityState::ABILITY_STATE_CREATE;
@@ -202,6 +206,7 @@ HWTEST_F(AmsMgrSchedulerTest, AmsMgrScheduler_004, TestSize.Level1)
auto amsEventHandler = GetAmsEventHandler();
std::unique_ptr<AmsMgrScheduler> amsMgrScheduler =
std::make_unique<AmsMgrScheduler>(mockAppMgrServiceInner, amsEventHandler);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IRemoteObject> token = new MockAbilityToken();
bool clearMissionFlag = true;
EXPECT_CALL(*mockAppMgrServiceInner, TerminateAbility(_, _))
@@ -228,6 +233,7 @@ HWTEST_F(AmsMgrSchedulerTest, AmsMgrScheduler_005, TestSize.Level1)
auto amsEventHandler = GetAmsEventHandler();
std::unique_ptr<AmsMgrScheduler> amsMgrScheduler =
std::make_unique<AmsMgrScheduler>(mockAppMgrServiceInner, amsEventHandler);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<AppStateCallbackHost> appStateCallbackHost = new AppStateCallbackHost();
EXPECT_CALL(*mockAppMgrServiceInner, RegisterAppStateCallback(_))
@@ -429,6 +435,7 @@ HWTEST_F(AmsMgrSchedulerTest, UnregisterApplicationStateObserver_001, TestSize.L
HWTEST_F(AmsMgrSchedulerTest, LoadAbility_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_shared<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IRemoteObject> token = nullptr;
sptr<IRemoteObject> preToken = nullptr;
std::shared_ptr<AbilityInfo> abilityInfo = nullptr;
@@ -448,6 +455,7 @@ HWTEST_F(AmsMgrSchedulerTest, LoadAbility_001, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, LoadAbility_002, TestSize.Level0)
{
auto amsMgrScheduler = std::make_shared<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IRemoteObject> token = nullptr;
sptr<IRemoteObject> preToken = nullptr;
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
@@ -467,6 +475,7 @@ HWTEST_F(AmsMgrSchedulerTest, LoadAbility_002, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, LoadAbility_003, TestSize.Level0)
{
auto amsMgrScheduler = std::make_shared<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IRemoteObject> token = nullptr;
sptr<IRemoteObject> preToken = nullptr;
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
@@ -489,6 +498,7 @@ HWTEST_F(AmsMgrSchedulerTest, LoadAbility_004, TestSize.Level0)
auto amsEventHandler = GetAmsEventHandler();
std::unique_ptr<AmsMgrScheduler> amsMgrScheduler =
std::make_unique<AmsMgrScheduler>(mockAppMgrServiceInner, amsEventHandler);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IRemoteObject> token = nullptr;
sptr<IRemoteObject> preToken = nullptr;
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
@@ -508,6 +518,7 @@ HWTEST_F(AmsMgrSchedulerTest, LoadAbility_004, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, UpdateAbilityState_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IRemoteObject> token = nullptr;
AbilityState state = AbilityState::ABILITY_STATE_READY;
amsMgrScheduler->UpdateAbilityState(token, state);
@@ -527,6 +538,7 @@ HWTEST_F(AmsMgrSchedulerTest, UpdateAbilityState_001, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, UpdateExtensionState_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IRemoteObject> token = nullptr;
ExtensionState state = ExtensionState::EXTENSION_STATE_READY;
amsMgrScheduler->UpdateExtensionState(token, state);
@@ -546,6 +558,7 @@ HWTEST_F(AmsMgrSchedulerTest, UpdateExtensionState_001, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, TerminateAbility_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IRemoteObject> token = nullptr;
bool clearMissionFlag = true;
amsMgrScheduler->TerminateAbility(token, clearMissionFlag);
@@ -565,6 +578,7 @@ HWTEST_F(AmsMgrSchedulerTest, TerminateAbility_001, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, RegisterAppStateCallback_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IAppStateCallback> callback = nullptr;
amsMgrScheduler->RegisterAppStateCallback(callback);
amsMgrScheduler->amsMgrServiceInner_ = GetMockAppMgrServiceInner();
@@ -583,6 +597,7 @@ HWTEST_F(AmsMgrSchedulerTest, RegisterAppStateCallback_001, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, AbilityBehaviorAnalysis_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IRemoteObject> token = nullptr;
sptr<IRemoteObject> preToken = nullptr;
int32_t visibility = 0;
@@ -605,6 +620,7 @@ HWTEST_F(AmsMgrSchedulerTest, AbilityBehaviorAnalysis_001, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, KillProcessesByUserId_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
int32_t userId = 0;
amsMgrScheduler->KillProcessesByUserId(userId);
}
@@ -620,6 +636,7 @@ HWTEST_F(AmsMgrSchedulerTest, KillProcessesByUserId_001, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, KillProcessWithAccount_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
std::string bundleName = "bundleName";
int accountId = 0;
int32_t res1 = amsMgrScheduler->KillProcessWithAccount(bundleName, accountId);
@@ -641,6 +658,7 @@ HWTEST_F(AmsMgrSchedulerTest, KillProcessWithAccount_001, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, AbilityAttachTimeOut_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IRemoteObject> token = nullptr;
amsMgrScheduler->AbilityAttachTimeOut(token);
amsMgrScheduler->amsMgrServiceInner_ = GetMockAppMgrServiceInner();
@@ -659,6 +677,7 @@ HWTEST_F(AmsMgrSchedulerTest, AbilityAttachTimeOut_001, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, PrepareTerminate_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IRemoteObject> token = nullptr;
amsMgrScheduler->PrepareTerminate(token);
amsMgrScheduler->amsMgrServiceInner_ = GetMockAppMgrServiceInner();
@@ -677,6 +696,7 @@ HWTEST_F(AmsMgrSchedulerTest, PrepareTerminate_001, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, KillApplication_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
std::string bundleName = "bundleName";
amsMgrScheduler->KillApplication(bundleName);
amsMgrScheduler->amsMgrServiceInner_ = GetMockAppMgrServiceInner();
@@ -695,6 +715,7 @@ HWTEST_F(AmsMgrSchedulerTest, KillApplication_001, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, KillApplicationByUid_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
std::string bundleName = "bundleName";
int uid = 0;
amsMgrScheduler->KillApplicationByUid(bundleName, uid);
@@ -714,6 +735,7 @@ HWTEST_F(AmsMgrSchedulerTest, KillApplicationByUid_001, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, KillApplicationSelf_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
amsMgrScheduler->KillApplicationSelf();
amsMgrScheduler->amsMgrServiceInner_ = GetMockAppMgrServiceInner();
amsMgrScheduler->amsHandler_ = GetAmsEventHandler();
@@ -731,6 +753,7 @@ HWTEST_F(AmsMgrSchedulerTest, KillApplicationSelf_001, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, GetRunningProcessInfoByToken_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IRemoteObject> token = nullptr;
RunningProcessInfo info;
amsMgrScheduler->GetRunningProcessInfoByToken(token, info);
@@ -750,6 +773,7 @@ HWTEST_F(AmsMgrSchedulerTest, GetRunningProcessInfoByToken_001, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, GetRunningProcessInfoByPid_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
pid_t pid = 0;
RunningProcessInfo info;
amsMgrScheduler->GetRunningProcessInfoByPid(pid, info);
@@ -768,7 +792,13 @@ HWTEST_F(AmsMgrSchedulerTest, GetRunningProcessInfoByPid_001, TestSize.Level0)
*/
HWTEST_F(AmsMgrSchedulerTest, StartSpecifiedAbility_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
auto mockBundleMgr = new (std::nothrow) BundleMgrService();
auto remoteClientManager = std::make_shared<RemoteClientManager>();
remoteClientManager->SetBundleManager(mockBundleMgr);
auto amsMgrServiceInner = std::make_shared<AppMgrServiceInner>();
amsMgrServiceInner->remoteClientManager_ = remoteClientManager;
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(amsMgrServiceInner, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
Want want;
AbilityInfo abilityInfo;
amsMgrScheduler->StartSpecifiedAbility(want, abilityInfo);
@@ -788,6 +818,7 @@ HWTEST_F(AmsMgrSchedulerTest, StartSpecifiedAbility_001, TestSize.Level0)
HWTEST_F(AmsMgrSchedulerTest, RegisterStartSpecifiedAbilityResponse_001, TestSize.Level0)
{
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
ASSERT_NE(amsMgrScheduler, nullptr);
sptr<IStartSpecifiedAbilityResponse> response = nullptr;
amsMgrScheduler->RegisterStartSpecifiedAbilityResponse(response);
amsMgrScheduler->amsMgrServiceInner_ = GetMockAppMgrServiceInner();
@@ -59,6 +59,7 @@ void AppMgrServiceTest::TearDown()
HWTEST_F(AppMgrServiceTest, OnStop_001, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
appMgrService->appMgrServiceInner_ = nullptr;
appMgrService->OnStop();
}
@@ -107,6 +108,7 @@ HWTEST_F(AppMgrServiceTest, Init_001, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, AttachApplication_001, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
sptr<IRemoteObject> app = nullptr;
appMgrService->SetInnerService(nullptr);
appMgrService->AttachApplication(app);
@@ -123,6 +125,7 @@ HWTEST_F(AppMgrServiceTest, AttachApplication_001, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, AttachApplication_002, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
sptr<IRemoteObject> app = nullptr;
appMgrService->SetInnerService(std::make_shared<AppMgrServiceInner>());
appMgrService->handler_ = std::make_shared<AMSEventHandler>(runner_, appMgrService->appMgrServiceInner_);
@@ -140,6 +143,7 @@ HWTEST_F(AppMgrServiceTest, AttachApplication_002, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, ApplicationForegrounded_001, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
int32_t recordId = 1;
appMgrService->SetInnerService(nullptr);
appMgrService->ApplicationForegrounded(recordId);
@@ -156,6 +160,7 @@ HWTEST_F(AppMgrServiceTest, ApplicationForegrounded_001, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, ApplicationBackgrounded_001, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
int32_t recordId = 1;
appMgrService->SetInnerService(nullptr);
appMgrService->ApplicationBackgrounded(recordId);
@@ -172,6 +177,7 @@ HWTEST_F(AppMgrServiceTest, ApplicationBackgrounded_001, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, ApplicationTerminated_001, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
int32_t recordId = 1;
appMgrService->SetInnerService(nullptr);
appMgrService->ApplicationTerminated(recordId);
@@ -188,6 +194,7 @@ HWTEST_F(AppMgrServiceTest, ApplicationTerminated_001, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, AbilityCleaned_001, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
appMgrService->SetInnerService(nullptr);
appMgrService->AbilityCleaned(nullptr);
}
@@ -203,6 +210,7 @@ HWTEST_F(AppMgrServiceTest, AbilityCleaned_001, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, AbilityCleaned_002, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
appMgrService->SetInnerService(std::make_shared<AppMgrServiceInner>());
appMgrService->handler_ = std::make_shared<AMSEventHandler>(runner_, appMgrService->appMgrServiceInner_);
appMgrService->AbilityCleaned(nullptr);
@@ -219,6 +227,7 @@ HWTEST_F(AppMgrServiceTest, AbilityCleaned_002, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, AddAppDeathRecipient_001, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
pid_t pid = 1;
appMgrService->SetInnerService(nullptr);
appMgrService->AddAppDeathRecipient(pid);
@@ -235,6 +244,7 @@ HWTEST_F(AppMgrServiceTest, AddAppDeathRecipient_001, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, AddAppDeathRecipient_002, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
pid_t pid = 1;
appMgrService->SetInnerService(std::make_shared<AppMgrServiceInner>());
appMgrService->handler_ = std::make_shared<AMSEventHandler>(runner_, appMgrService->appMgrServiceInner_);
@@ -252,6 +262,7 @@ HWTEST_F(AppMgrServiceTest, AddAppDeathRecipient_002, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, StartupResidentProcess_001, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
std::vector<AppExecFwk::BundleInfo> bundleInfos;
appMgrService->SetInnerService(nullptr);
appMgrService->StartupResidentProcess(bundleInfos);
@@ -268,6 +279,7 @@ HWTEST_F(AppMgrServiceTest, StartupResidentProcess_001, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, StartupResidentProcess_002, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
std::vector<AppExecFwk::BundleInfo> bundleInfos;
appMgrService->SetInnerService(std::make_shared<AppMgrServiceInner>());
appMgrService->handler_ = std::make_shared<AMSEventHandler>(runner_, appMgrService->appMgrServiceInner_);
@@ -391,6 +403,7 @@ HWTEST_F(AppMgrServiceTest, NotifyMemoryLevel_002, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, AddAbilityStageDone_001, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
int32_t recordId = 1;
appMgrService->SetInnerService(nullptr);
appMgrService->AddAbilityStageDone(recordId);
@@ -407,6 +420,7 @@ HWTEST_F(AppMgrServiceTest, AddAbilityStageDone_001, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, AddAbilityStageDone_002, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
int32_t recordId = 1;
appMgrService->SetInnerService(std::make_shared<AppMgrServiceInner>());
appMgrService->handler_ = std::make_shared<AMSEventHandler>(runner_, appMgrService->appMgrServiceInner_);
@@ -575,6 +589,7 @@ HWTEST_F(AppMgrServiceTest, FinishUserTest_002, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, ScheduleAcceptWantDone_001, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
int32_t recordId = 1;
Want want;
std::string flag = "flag";
@@ -593,6 +608,7 @@ HWTEST_F(AppMgrServiceTest, ScheduleAcceptWantDone_001, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, ScheduleAcceptWantDone_002, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
int32_t recordId = 1;
Want want;
std::string flag = "flag";
@@ -724,6 +740,7 @@ HWTEST_F(AppMgrServiceTest, StartRenderProcess_002, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, AttachRenderProcess_001, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
sptr<IRemoteObject> scheduler = nullptr;
appMgrService->SetInnerService(nullptr);
appMgrService->AttachRenderProcess(scheduler);
@@ -740,6 +757,7 @@ HWTEST_F(AppMgrServiceTest, AttachRenderProcess_001, TestSize.Level0)
HWTEST_F(AppMgrServiceTest, AttachRenderProcess_002, TestSize.Level0)
{
auto appMgrService = std::make_shared<AppMgrService>();
ASSERT_NE(appMgrService, nullptr);
sptr<IRemoteObject> scheduler = nullptr;
appMgrService->SetInnerService(std::make_shared<AppMgrServiceInner>());
appMgrService->handler_ = std::make_shared<AMSEventHandler>(runner_, appMgrService->appMgrServiceInner_);
@@ -337,6 +337,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_008, TestSize.Level1)
auto abilityReq = GenerateAbilityRequest(deviceName, abilityName, appName, bundleName);
auto record = AbilityRecord::CreateAbilityRecord(abilityReq);
auto token = record->GetToken();
ASSERT_NE(token, nullptr);
DelayedSingleton<AppScheduler>::GetInstance()->MoveToForeground(token);
}
@@ -360,6 +361,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_009, TestSize.Level1)
auto abilityReq = GenerateAbilityRequest(deviceName, abilityName, appName, bundleName);
auto record = AbilityRecord::CreateAbilityRecord(abilityReq);
auto token = record->GetToken();
ASSERT_NE(token, nullptr);
DelayedSingleton<AppScheduler>::GetInstance()->MoveToForeground(token);
}
@@ -383,6 +385,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_010, TestSize.Level1)
auto abilityReq = GenerateAbilityRequest(deviceName, abilityName, appName, bundleName);
auto record = AbilityRecord::CreateAbilityRecord(abilityReq);
auto token = record->GetToken();
ASSERT_NE(token, nullptr);
DelayedSingleton<AppScheduler>::GetInstance()->MoveToBackground(token);
}
@@ -467,6 +470,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_014, TestSize.Level1)
auto abilityReq = GenerateAbilityRequest(deviceName, abilityName, appName, bundleName);
auto record = AbilityRecord::CreateAbilityRecord(abilityReq);
auto token = record->GetToken();
ASSERT_NE(token, nullptr);
const int32_t visibility = 1;
const int32_t perceptibility = 1;
const int32_t connectionState = 1;
@@ -510,6 +514,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_015, TestSize.Level1)
auto abilityReq = GenerateAbilityRequest(deviceName, abilityName, appName, bundleName);
auto record = AbilityRecord::CreateAbilityRecord(abilityReq);
auto token = record->GetToken();
ASSERT_NE(token, nullptr);
const int32_t visibility = 0;
const int32_t perceptibility = 1;
const int32_t connectionState = 1;
@@ -537,6 +542,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_016, TestSize.Level1)
auto abilityReq = GenerateAbilityRequest(deviceName, abilityName, appName, bundleName);
auto record = AbilityRecord::CreateAbilityRecord(abilityReq);
auto token = record->GetToken();
ASSERT_NE(token, nullptr);
DelayedSingleton<AppScheduler>::GetInstance()->KillProcessByAbilityToken(token);
}
@@ -560,6 +566,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_017, TestSize.Level1)
auto abilityReq = GenerateAbilityRequest(deviceName, abilityName, appName, bundleName);
auto record = AbilityRecord::CreateAbilityRecord(abilityReq);
auto token = record->GetToken();
ASSERT_NE(token, nullptr);
DelayedSingleton<AppScheduler>::GetInstance()->KillProcessByAbilityToken(token);
}
@@ -575,6 +582,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_017, TestSize.Level1)
HWTEST_F(AppSchedulerTest, AppScheduler_UpdateAbilityState_001, TestSize.Level1)
{
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = std::make_unique<AppExecFwk::AppMgrClient>();
ASSERT_NE(DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_, nullptr);
sptr<IRemoteObject> token = nullptr;
AppExecFwk::AbilityState state = AppExecFwk::AbilityState::ABILITY_STATE_CREATE;
DelayedSingleton<AppScheduler>::GetInstance()->UpdateAbilityState(token, state);
@@ -593,6 +601,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_UpdateExtensionState_001, TestSize.Level
EXPECT_CALL(*clientMock_, UpdateExtensionState(_, _)).Times(1)
.WillOnce(Return(AppMgrResultCode::RESULT_OK));
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = std::move(clientMock_);
ASSERT_NE(DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_, nullptr);
sptr<IRemoteObject> token = nullptr;
AppExecFwk::ExtensionState state = AppExecFwk::ExtensionState::EXTENSION_STATE_READY;
DelayedSingleton<AppScheduler>::GetInstance()->UpdateExtensionState(token, state);
@@ -609,6 +618,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_UpdateExtensionState_001, TestSize.Level
HWTEST_F(AppSchedulerTest, AppScheduler_KillProcessesByUserId_001, TestSize.Level1)
{
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = std::make_unique<AppExecFwk::AppMgrClient>();
ASSERT_NE(DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_, nullptr);
int32_t userId = 0;
DelayedSingleton<AppScheduler>::GetInstance()->KillProcessesByUserId(userId);
}
@@ -625,6 +635,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_OnAbilityRequestDone_001, TestSize.Level
{
sptr<IRemoteObject> token = nullptr;
AppExecFwk::AbilityState state = AppExecFwk::AbilityState::ABILITY_STATE_CREATE;
ASSERT_NE(appStateMock_, nullptr);
DelayedSingleton<AppScheduler>::GetInstance()->callback_ = appStateMock_;
DelayedSingleton<AppScheduler>::GetInstance()->OnAbilityRequestDone(token, state);
}
@@ -751,6 +762,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_PrepareTerminate_001, TestSize.Level1)
{
sptr<IRemoteObject> token = nullptr;
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = std::make_unique<AppExecFwk::AppMgrClient>();
ASSERT_NE(DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_, nullptr);
DelayedSingleton<AppScheduler>::GetInstance()->PrepareTerminate(token);
}
@@ -765,6 +777,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_PrepareTerminate_001, TestSize.Level1)
HWTEST_F(AppSchedulerTest, AppScheduler_OnAppStateChanged_001, TestSize.Level1)
{
AppExecFwk::AppProcessData appData;
ASSERT_NE(DelayedSingleton<AppScheduler>::GetInstance(), nullptr);
DelayedSingleton<AppScheduler>::GetInstance()->OnAppStateChanged(appData);
}
@@ -780,6 +793,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_GetRunningProcessInfoByToken_001, TestSi
{
sptr<IRemoteObject> token;
AppExecFwk::RunningProcessInfo info;
ASSERT_NE(DelayedSingleton<AppScheduler>::GetInstance(), nullptr);
DelayedSingleton<AppScheduler>::GetInstance()->GetRunningProcessInfoByToken(token, info);
}
@@ -795,6 +809,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_GetRunningProcessInfoByPid_001, TestSize
{
pid_t pid = 0;
AppExecFwk::RunningProcessInfo info;
ASSERT_NE(DelayedSingleton<AppScheduler>::GetInstance(), nullptr);
DelayedSingleton<AppScheduler>::GetInstance()->GetRunningProcessInfoByPid(pid, info);
}
@@ -810,6 +825,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_StartupResidentProcess_001, TestSize.Lev
{
EXPECT_CALL(*clientMock_, StartupResidentProcess(_)).Times(1);
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = std::move(clientMock_);
ASSERT_NE(DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_, nullptr);
std::vector<AppExecFwk::BundleInfo> bundleInfos;
DelayedSingleton<AppScheduler>::GetInstance()->StartupResidentProcess(bundleInfos);
}
@@ -826,6 +842,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_StartSpecifiedAbility_001, TestSize.Leve
{
EXPECT_CALL(*clientMock_, StartSpecifiedAbility(_, _)).Times(1);
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = std::move(clientMock_);
ASSERT_NE(DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_, nullptr);
AAFwk::Want want;
AppExecFwk::AbilityInfo abilityInfo;
DelayedSingleton<AppScheduler>::GetInstance()->StartSpecifiedAbility(want, abilityInfo);
@@ -843,6 +860,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_GetProcessRunningInfos_001, TestSize.Lev
{
EXPECT_CALL(*clientMock_, GetAllRunningProcesses(_)).Times(1);
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = std::move(clientMock_);
ASSERT_NE(DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_, nullptr);
std::vector<AppExecFwk::RunningProcessInfo> info;
DelayedSingleton<AppScheduler>::GetInstance()->GetProcessRunningInfos(info);
}
@@ -859,6 +877,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_GetProcessRunningInfosByUserId_001, Test
{
EXPECT_CALL(*clientMock_, GetProcessRunningInfosByUserId(_, _)).Times(1);
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = std::move(clientMock_);
ASSERT_NE(DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_, nullptr);
std::vector<AppExecFwk::RunningProcessInfo> info;
int32_t userId = 0;
DelayedSingleton<AppScheduler>::GetInstance()->GetProcessRunningInfosByUserId(info, userId);
@@ -875,6 +894,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_GetProcessRunningInfosByUserId_001, Test
HWTEST_F(AppSchedulerTest, AppScheduler_ConvertAppState_001, TestSize.Level1)
{
AppState state = AppState::BEGIN;
ASSERT_NE(DelayedSingleton<AppScheduler>::GetInstance(), nullptr);
DelayedSingleton<AppScheduler>::GetInstance()->ConvertAppState(state);
}
@@ -157,6 +157,7 @@ HWTEST_F(AppSpawnSocketTest, UnregisterApplicationStateObserver_001, TestSize.Le
HWTEST_F(AppSpawnSocketTest, OnAppStateChanged_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::shared_ptr<AppRunningRecord> appRecord;
ApplicationState state = ApplicationState::APP_STATE_CREATE;
bool needNotifyApp = false;
@@ -174,6 +175,7 @@ HWTEST_F(AppSpawnSocketTest, OnAppStateChanged_001, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, OnAppStateChanged_002, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::shared_ptr<AppRunningRecord> appRecord;
ApplicationState state = ApplicationState::APP_STATE_CREATE;
bool needNotifyApp = false;
@@ -192,6 +194,7 @@ HWTEST_F(AppSpawnSocketTest, OnAppStateChanged_002, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, OnProcessDied_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::shared_ptr<AppRunningRecord> appRecord;
manager->OnProcessDied(appRecord);
manager->Init();
@@ -209,6 +212,7 @@ HWTEST_F(AppSpawnSocketTest, OnProcessDied_001, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, OnRenderProcessDied_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::shared_ptr<RenderRecord> renderRecord;
manager->OnRenderProcessDied(renderRecord);
manager->Init();
@@ -226,6 +230,7 @@ HWTEST_F(AppSpawnSocketTest, OnRenderProcessDied_001, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, OnProcessStateChanged_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::shared_ptr<AppRunningRecord> appRecord;
manager->OnProcessStateChanged(appRecord);
manager->Init();
@@ -243,6 +248,7 @@ HWTEST_F(AppSpawnSocketTest, OnProcessStateChanged_001, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, OnProcessCreated_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::shared_ptr<AppRunningRecord> appRecord;
manager->OnProcessCreated(appRecord);
manager->Init();
@@ -260,6 +266,7 @@ HWTEST_F(AppSpawnSocketTest, OnProcessCreated_001, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, OnRenderProcessCreated_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::shared_ptr<RenderRecord> renderRecord;
manager->OnRenderProcessCreated(renderRecord);
manager->Init();
@@ -277,6 +284,7 @@ HWTEST_F(AppSpawnSocketTest, OnRenderProcessCreated_001, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, StateChangedNotifyObserver_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
AbilityStateData abilityStateData;
bool isAbility = false;
manager->StateChangedNotifyObserver(abilityStateData, isAbility);
@@ -295,6 +303,7 @@ HWTEST_F(AppSpawnSocketTest, StateChangedNotifyObserver_001, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleAppStateChanged_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::vector<std::string> bundleNameList;
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
ApplicationState state = ApplicationState::APP_STATE_FOREGROUND;
@@ -317,6 +326,7 @@ HWTEST_F(AppSpawnSocketTest, HandleAppStateChanged_001, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleAppStateChanged_002, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::vector<std::string> bundleNameList;
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
ApplicationState state = ApplicationState::APP_STATE_BACKGROUND;
@@ -339,6 +349,7 @@ HWTEST_F(AppSpawnSocketTest, HandleAppStateChanged_002, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleAppStateChanged_003, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::vector<std::string> bundleNameList;
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
ApplicationState state = ApplicationState::APP_STATE_BACKGROUND;
@@ -360,6 +371,7 @@ HWTEST_F(AppSpawnSocketTest, HandleAppStateChanged_003, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleAppStateChanged_004, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::vector<std::string> bundleNameList;
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
ApplicationState state = ApplicationState::APP_STATE_CREATE;
@@ -381,6 +393,7 @@ HWTEST_F(AppSpawnSocketTest, HandleAppStateChanged_004, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleAppStateChanged_005, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::vector<std::string> bundleNameList;
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
ApplicationState state = ApplicationState::APP_STATE_TERMINATED;
@@ -403,6 +416,7 @@ HWTEST_F(AppSpawnSocketTest, HandleAppStateChanged_005, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleAppStateChanged_006, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::vector<std::string> bundleNameList;
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
ApplicationState state = ApplicationState::APP_STATE_CREATE;
@@ -426,6 +440,7 @@ HWTEST_F(AppSpawnSocketTest, HandleAppStateChanged_006, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleAppStateChanged_007, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::vector<std::string> bundleNameList;
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
ApplicationState state = ApplicationState::APP_STATE_CREATE;
@@ -447,6 +462,7 @@ HWTEST_F(AppSpawnSocketTest, HandleAppStateChanged_007, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleAppStateChanged_008, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::vector<std::string> bundleNameList;
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
ApplicationState state = ApplicationState::APP_STATE_END;
@@ -465,6 +481,7 @@ HWTEST_F(AppSpawnSocketTest, HandleAppStateChanged_008, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleStateChangedNotifyObserver_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
AbilityStateData abilityStateData;
bool isAbility = true;
std::vector<std::string> bundleNameList;
@@ -486,6 +503,7 @@ HWTEST_F(AppSpawnSocketTest, HandleStateChangedNotifyObserver_001, TestSize.Leve
HWTEST_F(AppSpawnSocketTest, HandleStateChangedNotifyObserver_002, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
AbilityStateData abilityStateData;
bool isAbility = false;
std::vector<std::string> bundleNameList;
@@ -506,6 +524,7 @@ HWTEST_F(AppSpawnSocketTest, HandleStateChangedNotifyObserver_002, TestSize.Leve
HWTEST_F(AppSpawnSocketTest, HandleStateChangedNotifyObserver_003, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
AbilityStateData abilityStateData;
bool isAbility = false;
std::vector<std::string> bundleNameList;
@@ -528,6 +547,7 @@ HWTEST_F(AppSpawnSocketTest, HandleStateChangedNotifyObserver_003, TestSize.Leve
HWTEST_F(AppSpawnSocketTest, HandleStateChangedNotifyObserver_004, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
AbilityStateData abilityStateData;
bool isAbility = false;
std::vector<std::string> bundleNameList;
@@ -549,6 +569,7 @@ HWTEST_F(AppSpawnSocketTest, HandleStateChangedNotifyObserver_004, TestSize.Leve
HWTEST_F(AppSpawnSocketTest, HandleOnAppProcessCreated_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
manager->HandleOnAppProcessCreated(nullptr);
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
manager->HandleOnAppProcessCreated(appRecord);
@@ -565,6 +586,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnAppProcessCreated_001, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleOnRenderProcessCreated_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
manager->HandleOnRenderProcessCreated(nullptr);
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
std::shared_ptr<RenderRecord> renderRecord =
@@ -584,6 +606,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnRenderProcessCreated_001, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleOnProcessCreated_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
ProcessData data;
std::vector<std::string> bundleNameList;
std::string bundleName = "com.ohos.unittest";
@@ -603,6 +626,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnProcessCreated_001, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleOnProcessCreated_002, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
ProcessData data;
std::vector<std::string> bundleNameList;
std::string bundleName = "com.ohos.unittest";
@@ -623,6 +647,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnProcessCreated_002, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleOnProcessCreated_003, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
ProcessData data;
std::vector<std::string> bundleNameList;
std::string bundleName1 = "com.ohos.unittest";
@@ -644,6 +669,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnProcessCreated_003, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleOnProcessCreated_004, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
ProcessData data;
std::vector<std::string> bundleNameList;
std::string bundleName = "com.ohos.unittest";
@@ -664,6 +690,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnProcessCreated_004, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleOnProcessStateChanged_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
manager->HandleOnProcessStateChanged(nullptr);
}
@@ -678,6 +705,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnProcessStateChanged_001, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleOnProcessStateChanged_002, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
std::vector<std::string> bundleNameList;
std::string bundleName = "com.ohos.unittest";
@@ -698,6 +726,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnProcessStateChanged_002, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleOnProcessStateChanged_003, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
std::vector<std::string> bundleNameList;
std::string bundleName = "com.ohos.unittest";
@@ -717,6 +746,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnProcessStateChanged_003, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleOnProcessStateChanged_004, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
std::vector<std::string> bundleNameList;
std::string bundleName1 = "com.ohos.unittest1";
@@ -738,6 +768,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnProcessStateChanged_004, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleOnProcessStateChanged_005, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
std::vector<std::string> bundleNameList;
std::string bundleName = "com.ohos.unittest";
@@ -758,6 +789,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnProcessStateChanged_005, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleOnAppProcessDied_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
manager->HandleOnAppProcessDied(nullptr);
manager->HandleOnAppProcessDied(appRecord);
@@ -774,6 +806,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnAppProcessDied_001, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleOnRenderProcessDied_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
std::shared_ptr<RenderRecord> renderRecord =
std::make_shared<RenderRecord>(1, "param", 1, 1, 1, appRecord);
@@ -793,6 +826,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnRenderProcessDied_001, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleOnProcessDied_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
ProcessData data;
std::vector<std::string> bundleNameList;
std::string bundleName = "com.ohos.unittest";
@@ -812,6 +846,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnProcessDied_001, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleOnProcessDied_002, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
ProcessData data;
std::vector<std::string> bundleNameList;
std::string bundleName = "com.ohos.unittest";
@@ -832,6 +867,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnProcessDied_002, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleOnProcessDied_003, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
ProcessData data;
std::vector<std::string> bundleNameList;
std::string bundleName1 = "com.ohos.unittest1";
@@ -853,6 +889,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnProcessDied_003, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, HandleOnProcessDied_004, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
ProcessData data;
std::vector<std::string> bundleNameList;
std::string bundleName1 = "com.ohos.unittest1";
@@ -907,6 +944,7 @@ HWTEST_F(AppSpawnSocketTest, ObserverExist_002, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, AddObserverDeathRecipient_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
manager->AddObserverDeathRecipient(nullptr);
manager->AddObserverDeathRecipient(observer_);
}
@@ -922,6 +960,7 @@ HWTEST_F(AppSpawnSocketTest, AddObserverDeathRecipient_001, TestSize.Level0)
HWTEST_F(AppSpawnSocketTest, RemoveObserverDeathRecipient_001, TestSize.Level0)
{
auto manager = std::make_shared<AppStateObserverManager>();
ASSERT_NE(manager, nullptr);
manager->RemoveObserverDeathRecipient(nullptr);
manager->AddObserverDeathRecipient(observer_);
}
@@ -720,6 +720,7 @@ HWTEST_F(MainThreadTest, CheckAbilityItem_0300, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleTerminateApplicationLocal_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->application_ = nullptr;
mainThread_->HandleTerminateApplicationLocal();
HILOG_INFO("%{public}s end.", __func__);
@@ -734,6 +735,7 @@ HWTEST_F(MainThreadTest, HandleTerminateApplicationLocal_0100, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleTerminateApplicationLocal_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->signalHandler_->SetEventRunner(nullptr);
mainThread_->HandleTerminateApplicationLocal();
HILOG_INFO("%{public}s end.", __func__);
@@ -748,6 +750,7 @@ HWTEST_F(MainThreadTest, HandleTerminateApplicationLocal_0200, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleTerminateApplicationLocal_0300, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->mainHandler_->SetEventRunner(nullptr);
mainThread_->HandleTerminateApplicationLocal();
HILOG_INFO("%{public}s end.", __func__);
@@ -762,6 +765,7 @@ HWTEST_F(MainThreadTest, HandleTerminateApplicationLocal_0300, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleTerminateApplicationLocal_0400, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->watchdog_ = nullptr;
mainThread_->HandleTerminateApplicationLocal();
HILOG_INFO("%{public}s end.", __func__);
@@ -776,6 +780,7 @@ HWTEST_F(MainThreadTest, HandleTerminateApplicationLocal_0400, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleProcessSecurityExit_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->abilityRecordMgr_ = nullptr;
mainThread_->HandleProcessSecurityExit();
@@ -797,6 +802,7 @@ HWTEST_F(MainThreadTest, HandleProcessSecurityExit_0100, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleProcessSecurityExit_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->HandleProcessSecurityExit();
HILOG_INFO("%{public}s end.", __func__);
}
@@ -869,6 +875,7 @@ HWTEST_F(MainThreadTest, CheckForHandleLaunchApplication_0300, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleAbilityStage_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
HapModuleInfo info;
mainThread_->HandleAbilityStage(info);
HILOG_INFO("%{public}s end.", __func__);
@@ -883,6 +890,7 @@ HWTEST_F(MainThreadTest, HandleAbilityStage_0100, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleAbilityStage_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->application_ = nullptr;
HapModuleInfo info;
mainThread_->HandleAbilityStage(info);
@@ -898,6 +906,7 @@ HWTEST_F(MainThreadTest, HandleAbilityStage_0200, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleAbilityStage_0300, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->appMgr_ = nullptr;
HapModuleInfo info;
mainThread_->HandleAbilityStage(info);
@@ -913,6 +922,7 @@ HWTEST_F(MainThreadTest, HandleAbilityStage_0300, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleAbilityStage_0400, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->applicationImpl_ = nullptr;
HapModuleInfo info;
mainThread_->HandleAbilityStage(info);
@@ -997,6 +1007,7 @@ HWTEST_F(MainThreadTest, HandleLaunchAbility_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
std::shared_ptr<AbilityLocalRecord> abilityRecord = std::make_shared<AbilityLocalRecord>(nullptr, nullptr);
ASSERT_NE(abilityRecord, nullptr);
mainThread_->HandleLaunchAbility(abilityRecord);
HILOG_INFO("%{public}s end.", __func__);
}
@@ -1010,6 +1021,7 @@ HWTEST_F(MainThreadTest, HandleLaunchAbility_0100, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleCleanAbilityLocal_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->application_ = nullptr;
mainThread_->HandleCleanAbilityLocal(nullptr);
HILOG_INFO("%{public}s end.", __func__);
@@ -1024,6 +1036,7 @@ HWTEST_F(MainThreadTest, HandleCleanAbilityLocal_0100, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleCleanAbilityLocal_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->HandleCleanAbilityLocal(nullptr);
HILOG_INFO("%{public}s end.", __func__);
}
@@ -1037,6 +1050,7 @@ HWTEST_F(MainThreadTest, HandleCleanAbilityLocal_0200, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleForegroundApplication_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->HandleForegroundApplication();
HILOG_INFO("%{public}s end.", __func__);
}
@@ -1050,6 +1064,7 @@ HWTEST_F(MainThreadTest, HandleForegroundApplication_0100, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleForegroundApplication_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->application_ = nullptr;
mainThread_->HandleForegroundApplication();
HILOG_INFO("%{public}s end.", __func__);
@@ -1064,6 +1079,7 @@ HWTEST_F(MainThreadTest, HandleForegroundApplication_0200, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleForegroundApplication_0300, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->appMgr_ = nullptr;
mainThread_->HandleForegroundApplication();
HILOG_INFO("%{public}s end.", __func__);
@@ -1078,6 +1094,7 @@ HWTEST_F(MainThreadTest, HandleForegroundApplication_0300, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleBackgroundApplication_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->HandleBackgroundApplication();
HILOG_INFO("%{public}s end.", __func__);
}
@@ -1091,6 +1108,7 @@ HWTEST_F(MainThreadTest, HandleBackgroundApplication_0100, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleBackgroundApplication_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->application_ = nullptr;
mainThread_->HandleBackgroundApplication();
HILOG_INFO("%{public}s end.", __func__);
@@ -1105,6 +1123,7 @@ HWTEST_F(MainThreadTest, HandleBackgroundApplication_0200, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleBackgroundApplication_0300, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->appMgr_ = nullptr;
mainThread_->HandleBackgroundApplication();
HILOG_INFO("%{public}s end.", __func__);
@@ -1119,6 +1138,7 @@ HWTEST_F(MainThreadTest, HandleBackgroundApplication_0300, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleTerminateApplication_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->HandleTerminateApplication();
HILOG_INFO("%{public}s end.", __func__);
}
@@ -1132,6 +1152,7 @@ HWTEST_F(MainThreadTest, HandleTerminateApplication_0100, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleTerminateApplication_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->application_ = nullptr;
mainThread_->HandleTerminateApplication();
HILOG_INFO("%{public}s end.", __func__);
@@ -1146,6 +1167,7 @@ HWTEST_F(MainThreadTest, HandleTerminateApplication_0200, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleTerminateApplication_0300, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->appMgr_ = nullptr;
mainThread_->HandleTerminateApplication();
HILOG_INFO("%{public}s end.", __func__);
@@ -1160,6 +1182,7 @@ HWTEST_F(MainThreadTest, HandleTerminateApplication_0300, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleTerminateApplication_0400, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->signalHandler_->SetEventRunner(nullptr);
mainThread_->HandleTerminateApplication();
HILOG_INFO("%{public}s end.", __func__);
@@ -1174,6 +1197,7 @@ HWTEST_F(MainThreadTest, HandleTerminateApplication_0400, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleTerminateApplication_0500, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->mainHandler_->SetEventRunner(nullptr);
mainThread_->HandleTerminateApplication();
HILOG_INFO("%{public}s end.", __func__);
@@ -1188,6 +1212,7 @@ HWTEST_F(MainThreadTest, HandleTerminateApplication_0500, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleTerminateApplication_0600, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->watchdog_ = nullptr;
mainThread_->HandleTerminateApplication();
HILOG_INFO("%{public}s end.", __func__);
@@ -1202,6 +1227,7 @@ HWTEST_F(MainThreadTest, HandleTerminateApplication_0600, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleShrinkMemory_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->HandleShrinkMemory(1);
HILOG_INFO("%{public}s end.", __func__);
}
@@ -1215,6 +1241,7 @@ HWTEST_F(MainThreadTest, HandleShrinkMemory_0100, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleShrinkMemory_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->applicationImpl_ = nullptr;
mainThread_->HandleShrinkMemory(1);
HILOG_INFO("%{public}s end.", __func__);
@@ -1229,6 +1256,7 @@ HWTEST_F(MainThreadTest, HandleShrinkMemory_0200, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleMemoryLevel_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->HandleMemoryLevel(1);
HILOG_INFO("%{public}s end.", __func__);
}
@@ -1242,6 +1270,7 @@ HWTEST_F(MainThreadTest, HandleMemoryLevel_0100, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleMemoryLevel_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->application_ = nullptr;
mainThread_->HandleMemoryLevel(1);
HILOG_INFO("%{public}s end.", __func__);
@@ -1256,6 +1285,7 @@ HWTEST_F(MainThreadTest, HandleMemoryLevel_0200, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleConfigurationUpdated_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
Configuration config;
mainThread_->HandleConfigurationUpdated(config);
HILOG_INFO("%{public}s end.", __func__);
@@ -1270,6 +1300,7 @@ HWTEST_F(MainThreadTest, HandleConfigurationUpdated_0100, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleConfigurationUpdated_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->applicationImpl_ = nullptr;
Configuration config;
mainThread_->HandleConfigurationUpdated(config);
@@ -1285,6 +1316,7 @@ HWTEST_F(MainThreadTest, HandleConfigurationUpdated_0200, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleSignal_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
constexpr int SIGNAL_JS_HEAP = 39;
mainThread_->HandleSignal(SIGNAL_JS_HEAP);
HILOG_INFO("%{public}s end.", __func__);
@@ -1299,6 +1331,7 @@ HWTEST_F(MainThreadTest, HandleSignal_0100, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleSignal_0200, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
constexpr int SIGNAL_JS_HEAP_PRIV = 40;
mainThread_->HandleSignal(SIGNAL_JS_HEAP_PRIV);
HILOG_INFO("%{public}s end.", __func__);
@@ -1313,6 +1346,7 @@ HWTEST_F(MainThreadTest, HandleSignal_0200, TestSize.Level1)
HWTEST_F(MainThreadTest, HandleSignal_0300, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->HandleSignal(-1);
HILOG_INFO("%{public}s end.", __func__);
}
@@ -1418,6 +1452,7 @@ HWTEST_F(MainThreadTest, HandleScheduleAcceptWant_0100, TestSize.Level1)
HILOG_INFO("%{public}s start.", __func__);
Want want;
std::string moduleName;
ASSERT_NE(mainThread_, nullptr);
mainThread_->HandleScheduleAcceptWant(want, moduleName);
HILOG_INFO("%{public}s end.", __func__);
}
@@ -1434,6 +1469,7 @@ HWTEST_F(MainThreadTest, HandleScheduleAcceptWant_0200, TestSize.Level1)
mainThread_->application_ = nullptr;
Want want;
std::string moduleName;
ASSERT_NE(mainThread_, nullptr);
mainThread_->HandleScheduleAcceptWant(want, moduleName);
HILOG_INFO("%{public}s end.", __func__);
}
@@ -1450,6 +1486,7 @@ HWTEST_F(MainThreadTest, HandleScheduleAcceptWant_0300, TestSize.Level1)
mainThread_->appMgr_ = nullptr;
Want want;
std::string moduleName;
ASSERT_NE(mainThread_, nullptr);
mainThread_->HandleScheduleAcceptWant(want, moduleName);
HILOG_INFO("%{public}s end.", __func__);
}
@@ -1466,6 +1503,7 @@ HWTEST_F(MainThreadTest, HandleScheduleAcceptWant_0400, TestSize.Level1)
mainThread_->applicationImpl_ = nullptr;
Want want;
std::string moduleName;
ASSERT_NE(mainThread_, nullptr);
mainThread_->HandleScheduleAcceptWant(want, moduleName);
HILOG_INFO("%{public}s end.", __func__);
}
@@ -1483,6 +1521,7 @@ HWTEST_F(MainThreadTest, LoadNativeLiabrary_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
std::string nativeLibraryPath = "";
ASSERT_NE(mainThread_, nullptr);
mainThread_->LoadNativeLiabrary(nativeLibraryPath);
nativeLibraryPath = "test/";
@@ -1502,6 +1541,7 @@ HWTEST_F(MainThreadTest, LoadNativeLiabrary_0100, TestSize.Level1)
HWTEST_F(MainThreadTest, TaskTimeoutDetected_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
ASSERT_NE(mainThread_, nullptr);
mainThread_->TaskTimeoutDetected(nullptr);
std::shared_ptr<EventRunner> runner = EventRunner::GetMainEventRunner();
@@ -1524,6 +1564,7 @@ HWTEST_F(MainThreadTest, HandleDumpHeap_0100, TestSize.Level1)
{
HILOG_INFO("%{public}s start.", __func__);
bool isPrivate = false;
ASSERT_NE(mainThread_, nullptr);
mainThread_->HandleDumpHeap(isPrivate);
mainThread_->mainHandler_ = nullptr;
@@ -69,6 +69,7 @@ HWTEST_F(ConnectionObserverControllerTest, AddObserver_001, TestSize.Level1)
HWTEST_F(ConnectionObserverControllerTest, RemoveObserver_001, TestSize.Level1)
{
auto connectionObserverController = std::make_shared<ConnectionObserverController>();
ASSERT_NE(connectionObserverController, nullptr);
sptr<IConnectionObserver> observer = nullptr;
connectionObserverController->RemoveObserver(observer);
}
@@ -84,6 +85,7 @@ HWTEST_F(ConnectionObserverControllerTest, RemoveObserver_001, TestSize.Level1)
HWTEST_F(ConnectionObserverControllerTest, NotifyExtensionConnected_001, TestSize.Level1)
{
auto connectionObserverController = std::make_shared<ConnectionObserverController>();
ASSERT_NE(connectionObserverController, nullptr);
ConnectionData data;
connectionObserverController->NotifyExtensionConnected(data);
}
@@ -99,6 +101,7 @@ HWTEST_F(ConnectionObserverControllerTest, NotifyExtensionConnected_001, TestSiz
HWTEST_F(ConnectionObserverControllerTest, NotifyExtensionDisconnected_001, TestSize.Level1)
{
auto connectionObserverController = std::make_shared<ConnectionObserverController>();
ASSERT_NE(connectionObserverController, nullptr);
ConnectionData data;
connectionObserverController->NotifyExtensionDisconnected(data);
}
@@ -114,6 +117,7 @@ HWTEST_F(ConnectionObserverControllerTest, NotifyExtensionDisconnected_001, Test
HWTEST_F(ConnectionObserverControllerTest, NotifyDlpAbilityOpened_001, TestSize.Level1)
{
auto connectionObserverController = std::make_shared<ConnectionObserverController>();
ASSERT_NE(connectionObserverController, nullptr);
DlpStateData data;
connectionObserverController->NotifyDlpAbilityOpened(data);
}
@@ -129,6 +133,7 @@ HWTEST_F(ConnectionObserverControllerTest, NotifyDlpAbilityOpened_001, TestSize.
HWTEST_F(ConnectionObserverControllerTest, NotifyDlpAbilityClosed_001, TestSize.Level1)
{
auto connectionObserverController = std::make_shared<ConnectionObserverController>();
ASSERT_NE(connectionObserverController, nullptr);
DlpStateData data;
connectionObserverController->NotifyDlpAbilityClosed(data);
}
@@ -160,6 +165,7 @@ HWTEST_F(ConnectionObserverControllerTest, GetObservers_001, TestSize.Level1)
HWTEST_F(ConnectionObserverControllerTest, HandleRemoteDied_001, TestSize.Level1)
{
auto connectionObserverController = std::make_shared<ConnectionObserverController>();
ASSERT_NE(connectionObserverController, nullptr);
wptr<IRemoteObject> remote;
connectionObserverController->HandleRemoteDied(remote);
}
@@ -175,6 +181,7 @@ HWTEST_F(ConnectionObserverControllerTest, HandleRemoteDied_001, TestSize.Level1
HWTEST_F(ConnectionObserverControllerTest, OnRemoteDied_001, TestSize.Level1)
{
auto connectionObserverController = std::make_shared<ConnectionObserverController>();
ASSERT_NE(connectionObserverController, nullptr);
ConnectionObserverController::ObserverDeathRecipient::ObserverDeathHandler handler;
auto observerDeathRecipient = std::make_shared<ConnectionObserverController::ObserverDeathRecipient>(handler);
wptr<IRemoteObject> remote;
@@ -756,6 +756,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_AbilityTransitionDone_
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_OnAbilityDied_001, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
AbilityRequest abilityRequest;
abilityRequest.abilityInfo.type = AppExecFwk::AbilityType::DATA;
abilityRequest.abilityInfo.bundleName = "bundleName";
@@ -778,6 +779,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_OnAbilityDied_001, Tes
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_OnAbilityDied_002, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
AbilityRequest abilityRequest;
abilityRequest.abilityInfo.type = AppExecFwk::AbilityType::DATA;
abilityRequest.abilityInfo.bundleName = "bundleName";
@@ -800,6 +802,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_OnAbilityDied_002, Tes
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_OnAbilityDied_003, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
AbilityRequest abilityRequest;
abilityRequest.abilityInfo.type = AppExecFwk::AbilityType::PAGE;
abilityRequest.abilityInfo.bundleName = "bundleName";
@@ -822,6 +825,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_OnAbilityDied_003, Tes
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_OnAppStateChanged_001, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
AppInfo info;
std::string processName = "processName";
std::string appName = "appName";
@@ -1057,6 +1061,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_LoadLocked_002, TestSi
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpLocked_001, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
const char func[1] = "";
int line = 0;
dataAbilityManager->dataAbilityRecordsLoaded_["a"] = nullptr;
@@ -1075,6 +1080,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpLocked_001, TestSi
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpLocked_002, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
const char func[2] = "a";
int line = 0;
AbilityRequest abilityRequest;
@@ -1100,6 +1106,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpLocked_002, TestSi
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpLocked_003, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
const char func[2] = "a";
int line = -1;
dataAbilityManager->dataAbilityRecordsLoaded_.clear();
@@ -1118,6 +1125,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpLocked_003, TestSi
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpState_001, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<std::string> info;
std::string args = "args";
AbilityRequest abilityRequest;
@@ -1144,6 +1152,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpState_001, TestSiz
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpState_002, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<std::string> info;
std::string args = "args";
dataAbilityManager->dataAbilityRecordsLoaded_.clear();
@@ -1161,6 +1170,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpState_002, TestSiz
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpState_003, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<std::string> info;
std::string args = "";
AbilityRequest abilityRequest;
@@ -1186,6 +1196,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpState_003, TestSiz
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_001, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<std::string> info;
bool isClient = true;
std::string args = "args";
@@ -1213,6 +1224,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_001, Test
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_002, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<std::string> info;
bool isClient = true;
std::string args = "args";
@@ -1240,6 +1252,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_002, Test
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_003, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<std::string> info;
bool isClient = true;
std::string args = "args";
@@ -1265,6 +1278,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_003, Test
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_004, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<std::string> info;
bool isClient = true;
std::string args = "args";
@@ -1290,6 +1304,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_004, Test
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_005, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<std::string> info;
bool isClient = true;
std::string args = "args";
@@ -1308,6 +1323,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_005, Test
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_006, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<std::string> info;
bool isClient = false;
std::string args = "args";
@@ -1326,6 +1342,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_006, Test
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_007, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<std::string> info;
bool isClient = false;
std::string args = "args";
@@ -1344,6 +1361,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_007, Test
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_008, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<std::string> info;
bool isClient = true;
std::string args = "";
@@ -1371,6 +1389,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_008, Test
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_009, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<std::string> info;
bool isClient = true;
std::string args = "";
@@ -1398,6 +1417,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_009, Test
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_010, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<std::string> info;
bool isClient = true;
std::string args = "";
@@ -1423,6 +1443,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_010, Test
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_011, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<std::string> info;
bool isClient = true;
std::string args = "";
@@ -1447,6 +1468,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_011, Test
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_012, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<std::string> info;
bool isClient = true;
std::string args = "";
@@ -1465,6 +1487,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_012, Test
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_013, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<std::string> info;
bool isClient = false;
std::string args = "";
@@ -1483,6 +1506,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_DumpSysState_013, Test
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_GetAbilityRunningInfos_001, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<AbilityRunningInfo> info;
bool isPerm = true;
dataAbilityManager->dataAbilityRecordsLoaded_["a"] = nullptr;
@@ -1500,6 +1524,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_GetAbilityRunningInfos
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_GetAbilityRunningInfos_002, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<AbilityRunningInfo> info;
bool isPerm = true;
AbilityRequest abilityRequest;
@@ -1523,6 +1548,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_GetAbilityRunningInfos
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_GetAbilityRunningInfos_003, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<AbilityRunningInfo> info;
bool isPerm = false;
AbilityRequest abilityRequest;
@@ -1548,6 +1574,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_GetAbilityRunningInfos
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_GetAbilityRunningInfos_004, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<AbilityRunningInfo> info;
bool isPerm = false;
AbilityRequest abilityRequest;
@@ -1573,6 +1600,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_GetAbilityRunningInfos
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_RestartDataAbility_001, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
std::vector<AbilityRunningInfo> info;
AbilityRequest abilityRequest;
abilityRequest.abilityInfo.type = AppExecFwk::AbilityType::DATA;
@@ -1593,6 +1621,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_RestartDataAbility_001
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_ReportDataAbilityAcquired_001, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
bool isNotHap = true;
AbilityRequest abilityRequest;
abilityRequest.abilityInfo.type = AppExecFwk::AbilityType::DATA;
@@ -1615,6 +1644,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_ReportDataAbilityAcqui
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_ReportDataAbilityAcquired_002, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
bool isNotHap = true;
AbilityRequest abilityRequest;
abilityRequest.abilityInfo.type = AppExecFwk::AbilityType::DATA;
@@ -1635,6 +1665,7 @@ HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_ReportDataAbilityAcqui
HWTEST_F(DataAbilityManagerTest, AaFwk_DataAbilityManager_ReportDataAbilityReleased_001, TestSize.Level1)
{
std::unique_ptr<DataAbilityManager> dataAbilityManager = std::make_unique<DataAbilityManager>();
ASSERT_NE(dataAbilityManager, nullptr);
bool isNotHap = true;
AbilityRequest abilityRequest;
abilityRequest.abilityInfo.type = AppExecFwk::AbilityType::DATA;
@@ -326,6 +326,7 @@ HWTEST_F(DataObsMgrInnerTest, DataObsMgrInner_AddRemove_ObsDeathRecipient_0100,
HWTEST_F(DataObsMgrInnerTest, DataObsMgrInner_RemoveObs_0100, TestSize.Level1)
{
std::shared_ptr<DataObsMgrInner> dataObsMgrInner = std::make_shared<DataObsMgrInner>();
ASSERT_NE(dataObsMgrInner, nullptr);
std::string uri1 = "uri1";
std::string uri2 = "uri2";
sptr<MockDataAbilityObserverStub> observer(new (std::nothrow) MockDataAbilityObserverStub());
@@ -14,7 +14,9 @@
*/
#include <gtest/gtest.h>
#define private public
#include "event_report.h"
#undef private
using namespace testing;
using namespace testing::ext;
@@ -47,6 +49,8 @@ void EventReportTest::TearDown()
HWTEST_F(EventReportTest, SendAbilityEvent_0100, TestSize.Level0)
{
EventName eventName = EventName::ABILITY_ONACTIVE;
std::string name = "ABILITY_ONACTIVE";
EXPECT_EQ(EventReport::ConvertEventName(eventName), name);
HiSysEventType type = HiSysEventType::BEHAVIOR;
EventInfo eventInfo;
EventReport::SendAbilityEvent(eventName, type, eventInfo);
@@ -61,6 +65,8 @@ HWTEST_F(EventReportTest, SendAbilityEvent_0100, TestSize.Level0)
HWTEST_F(EventReportTest, SendAbilityEvent_0200, TestSize.Level0)
{
EventName eventName = EventName::ABILITY_ONINACTIVE;
std::string name = "ABILITY_ONINACTIVE";
EXPECT_EQ(EventReport::ConvertEventName(eventName), name);
HiSysEventType type = HiSysEventType::BEHAVIOR;
EventInfo eventInfo;
EventReport::SendAbilityEvent(eventName, type, eventInfo);
@@ -175,6 +175,7 @@ HWTEST_F(AbilityContextInterfaceTest, AaFwk_AbilityContext_SetTheme_0100, Functi
std::shared_ptr<Global::Resource::ResourceManager2> resourceManager(Global::Resource::CreateResourceManager2());
std::shared_ptr<MockAbilityContextDeal> contextDeal = std::make_shared<MockAbilityContextDeal>();
std::shared_ptr<AbilityContext> abilityContext = std::make_shared<AbilityContext>();
ASSERT_NE(abilityContext, nullptr);
resourceManager->SetThemeById(testValue, testList);
contextDeal->initResourceManager(resourceManager);
abilityContext->AttachBaseContext(contextDeal);
@@ -194,6 +195,7 @@ HWTEST_F(AbilityContextInterfaceTest, AaFwk_AbilityContext_SetTheme_0200, Functi
std::shared_ptr<Global::Resource::ResourceManager2> resourceManager(Global::Resource::CreateResourceManager2());
std::shared_ptr<MockAbilityContextDeal> contextDeal = std::make_shared<MockAbilityContextDeal>();
std::shared_ptr<AbilityContext> abilityContext = std::make_shared<AbilityContext>();
ASSERT_NE(abilityContext, nullptr);
abilityContext->SetTheme(testValue);
abilityContext->AttachBaseContext(contextDeal);
abilityContext->SetTheme(testValue);
@@ -280,6 +282,7 @@ HWTEST_F(AbilityContextInterfaceTest, AaFwk_AbilityContext_GetTheme_0100, Functi
std::shared_ptr<Global::Resource::ResourceManager2> resourceManager(Global::Resource::CreateResourceManager2());
std::shared_ptr<MockAbilityContextDeal> contextDeal = std::make_shared<MockAbilityContextDeal>();
std::shared_ptr<AbilityContext> abilityContext = std::make_shared<AbilityContext>();
ASSERT_NE(abilityContext, nullptr);
resourceManager->SetThemeById(testValue, testList);
contextDeal->initResourceManager(resourceManager);
abilityContext->AttachBaseContext(contextDeal);
@@ -318,6 +321,7 @@ HWTEST_F(AbilityContextInterfaceTest, AaFwk_AbilityContext_GetString_ByIdAndForm
std::shared_ptr<Global::Resource::ResourceManager2> resourceManager(Global::Resource::CreateResourceManager2());
std::shared_ptr<MockAbilityContextDeal> contextDeal = std::make_shared<MockAbilityContextDeal>();
std::shared_ptr<AbilityContext> abilityContext = std::make_shared<AbilityContext>();
ASSERT_NE(abilityContext, nullptr);
std::string testByName = "";
GTEST_LOG_(INFO) << "AaFwk_AbilityContext_GetString_ByIdAndFormat_0100 end";
}
@@ -458,6 +462,7 @@ HWTEST_F(AbilityContextInterfaceTest, AaFwk_AbilityContext_GetThemeId_0100, Func
GTEST_LOG_(INFO) << "AaFwk_AbilityContext_GetThemeId_0100 start";
std::shared_ptr<MockAbilityContextDeal> contextDeal = std::make_shared<MockAbilityContextDeal>();
std::shared_ptr<AbilityContext> abilityContext = std::make_shared<AbilityContext>();
ASSERT_NE(abilityContext, nullptr);
abilityContext->AttachBaseContext(contextDeal);
GTEST_LOG_(INFO) << "AaFwk_AbilityContext_GetThemeId_0100 end";
}
@@ -1097,6 +1097,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_DoKeyDown_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_DoKeyDown_001 start";
auto keyEvent = MMI::KeyEvent::Create();
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->DoKeyDown(keyEvent);
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_DoKeyDown_001 end";
}
@@ -1113,6 +1114,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_DoKeyUp_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_DoKeyUp_001 start";
auto keyEvent = MMI::KeyEvent::Create();
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->DoKeyUp(keyEvent);
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_DoKeyUp_001 end";
}
@@ -1129,6 +1131,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_DoTouchEvent_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_DoTouchEvent_001 start";
auto pointerEvent = MMI::PointerEvent::Create();
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->DoPointerEvent(pointerEvent);
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_DoTouchEvent_001 end";
}
@@ -2181,6 +2184,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_HandleAbilityTransaction_0100, TestS
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_HandleAbilityTransaction_0100 start";
Want want;
AAFwk::LifeCycleStateInfo targetState;
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->HandleAbilityTransaction(want, targetState);
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_HandleAbilityTransaction_0100 end";
}
@@ -2194,6 +2198,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_AbilityTransactionCallback_0100, Tes
{
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_AbilityTransactionCallback_0100 start";
AAFwk::AbilityLifeCycleState state = AAFwk::ABILITY_STATE_INITIAL;
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->AbilityTransactionCallback(state);
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_AbilityTransactionCallback_0100 end";
}
@@ -2222,6 +2227,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_ConnectAbility_0100, TestSize.Level1
HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_DisconnectAbility_0100, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_DisconnectAbility_0100 start";
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->ability_ = nullptr;
Want want;
AbilityImpl_->DisconnectAbility(want);
@@ -2240,6 +2246,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_DisconnectAbility_0200, TestSize.Lev
std::shared_ptr<Ability> ability = pMocKPageAbility;
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
std::shared_ptr<ContextDeal> contextDeal = std::make_shared<ContextDeal>();
ASSERT_NE(contextDeal, nullptr);
contextDeal->SetAbilityInfo(abilityInfo);
ability->AttachBaseContext(contextDeal);
AbilityImpl_->ability_ = ability;
@@ -2275,6 +2282,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_CommandAbility_0100, TestSize.Level1
HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_SendResult_0100, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_SendResult_0100 start";
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->ability_ = nullptr;
int32_t requestCode = 0;
int32_t resultCode = 0;
@@ -2291,6 +2299,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_SendResult_0100, TestSize.Level1)
HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_NewWant_0100, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_NewWant_0100 start";
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->ability_ = nullptr;
Want want;
AbilityImpl_->NewWant(want);
@@ -2405,6 +2414,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_SerUriString_0100, TestSize.Level1)
HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_SerUriString_0200, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_SerUriString_0200 start";
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->contextDeal_ = nullptr;
std::string uri = "abc";
AbilityImpl_->SerUriString(uri);
@@ -2444,6 +2454,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_SetLifeCycleStateInfo_0100, TestSize
HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_SetLifeCycleStateInfo_0200, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_SetLifeCycleStateInfo_0200 start";
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->contextDeal_ = nullptr;
AAFwk::LifeCycleStateInfo info;
info.isNewWant = true;
@@ -2593,6 +2604,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_DenormalizeUri_0100, TestSize.Level1
HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_ScheduleUpdateConfiguration_0100, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_ScheduleUpdateConfiguration_0100 start";
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->ability_ = nullptr;
Configuration config;
AbilityImpl_->ScheduleUpdateConfiguration(config);
@@ -2638,6 +2650,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_ExecuteBatch_0100, TestSize.Level1)
HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_ContinueAbility_0100, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_ContinueAbility_0100 start";
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->ability_ = nullptr;
std::string deviceId = "deviceId";
uint32_t versionCode = 0;
@@ -2657,6 +2670,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_ContinueAbility_0200, TestSize.Level
std::shared_ptr<Ability> ability = pMocKPageAbility;
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
std::shared_ptr<ContextDeal> contextDeal = std::make_shared<ContextDeal>();
ASSERT_NE(contextDeal, nullptr);
contextDeal->SetAbilityInfo(abilityInfo);
ability->AttachBaseContext(contextDeal);
AbilityImpl_->ability_ = ability;
@@ -2675,6 +2689,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_ContinueAbility_0200, TestSize.Level
HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_NotifyContinuationResult_0100, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_NotifyContinuationResult_0100 start";
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->ability_ = nullptr;
int32_t result = 0;
AbilityImpl_->NotifyContinuationResult(result);
@@ -2693,6 +2708,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_NotifyContinuationResult_0200, TestS
std::shared_ptr<Ability> ability = pMocKPageAbility;
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
std::shared_ptr<ContextDeal> contextDeal = std::make_shared<ContextDeal>();
ASSERT_NE(contextDeal, nullptr);
contextDeal->SetAbilityInfo(abilityInfo);
ability->AttachBaseContext(contextDeal);
AbilityImpl_->ability_ = ability;
@@ -2710,6 +2726,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_NotifyContinuationResult_0200, TestS
HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_NotifyMemoryLevel_0100, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_NotifyMemoryLevel_0100 start";
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->ability_ = nullptr;
int32_t level = 0;
AbilityImpl_->NotifyMemoryLevel(level);
@@ -2728,6 +2745,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_NotifyMemoryLevel_0200, TestSize.Lev
std::shared_ptr<Ability> ability = pMocKPageAbility;
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
std::shared_ptr<ContextDeal> contextDeal = std::make_shared<ContextDeal>();
ASSERT_NE(contextDeal, nullptr);
contextDeal->SetAbilityInfo(abilityInfo);
ability->AttachBaseContext(contextDeal);
AbilityImpl_->ability_ = ability;
@@ -2745,6 +2763,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_NotifyMemoryLevel_0200, TestSize.Lev
HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_AfterUnFocused_0100, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_AfterUnFocused_0100 start";
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->AfterUnFocused();
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_AfterUnFocused_0100 end";
}
@@ -2757,6 +2776,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_AfterUnFocused_0100, TestSize.Level1
HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_AfterFocused_0100, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_AfterFocused_0100 start";
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->AfterFocused();
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_AfterFocused_0100 end";
}
@@ -2769,6 +2789,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_AfterFocused_0100, TestSize.Level1)
HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_AfterFocusedCommon_0100, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_AfterFocusedCommon_0100 start";
ASSERT_NE(AbilityImpl_, nullptr);
AbilityImpl_->AfterFocusedCommon(true);
AbilityImpl_->AfterFocusedCommon(false);
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_AfterFocusedCommon_0100 end";
@@ -2784,6 +2805,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_AfterFocusedCommon_0200, TestSize.Le
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_AfterFocusedCommon_0200 start";
std::shared_ptr<MockPageAbility> pMocKPageAbility = std::make_shared<MockPageAbility>();
std::shared_ptr<Ability> ability = pMocKPageAbility;
ASSERT_NE(ability, nullptr);
AbilityImpl_->ability_ = ability;
AbilityImpl_->AfterFocusedCommon(true);
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_AfterFocusedCommon_0200 end";
@@ -2801,6 +2823,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_AfterFocusedCommon_0300, TestSize.Le
std::shared_ptr<Ability> ability = pMocKPageAbility;
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
std::shared_ptr<ContextDeal> contextDeal = std::make_shared<ContextDeal>();
ASSERT_NE(contextDeal, nullptr);
contextDeal->SetAbilityInfo(abilityInfo);
ability->AttachBaseContext(contextDeal);
AbilityImpl_->ability_ = ability;
@@ -2820,6 +2843,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_AfterFocusedCommon_0400, TestSize.Le
std::shared_ptr<Ability> ability = pMocKPageAbility;
auto abilityInfo = std::make_shared<AbilityInfo>();
auto contextDeal = std::make_shared<ContextDeal>();
ASSERT_NE(contextDeal, nullptr);
contextDeal->SetAbilityInfo(abilityInfo);
ability->AttachBaseContext(contextDeal);
AbilityImpl_->ability_ = ability;
@@ -2842,6 +2866,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_AfterFocusedCommon_0500, TestSize.Le
auto abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->isStageBasedModel = true;
auto contextDeal = std::make_shared<ContextDeal>();
ASSERT_NE(contextDeal, nullptr);
contextDeal->SetAbilityInfo(abilityInfo);
ability->AttachBaseContext(contextDeal);
AbilityImpl_->ability_ = ability;
@@ -2868,6 +2893,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_AfterFocusedCommon_0600, TestSize.Le
auto abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->isStageBasedModel = false;
auto contextDeal = std::make_shared<ContextDeal>();
ASSERT_NE(contextDeal, nullptr);
contextDeal->SetAbilityInfo(abilityInfo);
ability->AttachBaseContext(contextDeal);
AbilityImpl_->ability_ = ability;
@@ -2931,6 +2957,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_AfterForeground_0300, TestSize.Level
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
sptr<AbilityImpl::WindowLifeCycleImpl> impl =
new (std::nothrow) AbilityImpl::WindowLifeCycleImpl(token, nullptr);
ASSERT_NE(impl, nullptr);
impl->AfterForeground();
auto abilityImpl = std::make_shared<AbilityImpl>();
@@ -2955,6 +2982,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_AfterBackground_0100, TestSize.Level
sptr<AbilityImpl::WindowLifeCycleImpl> impl =
new (std::nothrow) AbilityImpl::WindowLifeCycleImpl(token, nullptr);
impl->AfterBackground();
ASSERT_NE(impl, nullptr);
auto abilityImpl = std::make_shared<AbilityImpl>();
abilityImpl->isStageBasedModel_ = false;
@@ -2976,6 +3004,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_AfterBackground_0200, TestSize.Level
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_AfterBackground_0200 start";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
auto abilityImpl = std::make_shared<AbilityImpl>();
ASSERT_NE(abilityImpl, nullptr);
abilityImpl->isStageBasedModel_ = true;
abilityImpl->notifyForegroundByAbility_ = false;
abilityImpl->notifyForegroundByWindow_ = false;
@@ -2995,6 +3024,7 @@ HWTEST_F(AbilityImplTest, AaFwk_WindowLifeCycleImpl_0100, TestSize.Level1)
GTEST_LOG_(INFO) << "AaFwk_WindowLifeCycleImpl_0100 start";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
auto abilityImpl = std::make_shared<AbilityImpl>();
ASSERT_NE(abilityImpl, nullptr);
sptr<AbilityImpl::WindowLifeCycleImpl> impl =
new (std::nothrow) AbilityImpl::WindowLifeCycleImpl(token, abilityImpl);
impl->AfterFocused();
@@ -3012,6 +3042,7 @@ HWTEST_F(AbilityImplTest, AaFwk_WindowLifeCycleImpl_0200, TestSize.Level1)
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
sptr<AbilityImpl::WindowLifeCycleImpl> impl =
new (std::nothrow) AbilityImpl::WindowLifeCycleImpl(token, nullptr);
ASSERT_NE(impl, nullptr);
impl->AfterFocused();
GTEST_LOG_(INFO) << "AaFwk_WindowLifeCycleImpl_0200 end";
}
@@ -3027,6 +3058,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_AfterUnfocused_0100, TestSize.Level1
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
sptr<AbilityImpl::WindowLifeCycleImpl> impl =
new (std::nothrow) AbilityImpl::WindowLifeCycleImpl(token, nullptr);
ASSERT_NE(impl, nullptr);
impl->AfterUnfocused();
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_AfterUnfocused_0100 end";
}
@@ -3043,6 +3075,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_AfterUnfocused_0200, TestSize.Level1
auto abilityImpl = std::make_shared<AbilityImpl>();
sptr<AbilityImpl::WindowLifeCycleImpl> impl =
new (std::nothrow) AbilityImpl::WindowLifeCycleImpl(token, abilityImpl);
ASSERT_NE(impl, nullptr);
impl->AfterUnfocused();
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_AfterUnfocused_0200 end";
}
@@ -3059,6 +3092,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_ForegroundFailed_0100, TestSize.Leve
auto abilityImpl = std::make_shared<AbilityImpl>();
sptr<AbilityImpl::WindowLifeCycleImpl> impl =
new (std::nothrow) AbilityImpl::WindowLifeCycleImpl(token, abilityImpl);
ASSERT_NE(impl, nullptr);
auto wmErrNoMem = 2;
impl->ForegroundFailed(wmErrNoMem);
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_ForegroundFailed_0100 end";
@@ -3075,6 +3109,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_ForegroundFailed_0200, TestSize.Leve
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
sptr<AbilityImpl::WindowLifeCycleImpl> impl =
new (std::nothrow) AbilityImpl::WindowLifeCycleImpl(token, nullptr);
ASSERT_NE(impl, nullptr);
auto wmErrInvalidWindowModeOrSize = 5;
impl->ForegroundFailed(wmErrInvalidWindowModeOrSize);
@@ -3099,6 +3134,7 @@ HWTEST_F(AbilityImplTest, AaFwk_AbilityImpl_ForegroundFailed_0300, TestSize.Leve
abilityImpl->isStageBasedModel_ = true;
sptr<AbilityImpl::WindowLifeCycleImpl> impl =
new (std::nothrow) AbilityImpl::WindowLifeCycleImpl(token, abilityImpl);
ASSERT_NE(impl, nullptr);
auto wmErrInvalidWindowModeOrSize = 5;
impl->ForegroundFailed(wmErrInvalidWindowModeOrSize);
GTEST_LOG_(INFO) << "AaFwk_AbilityImpl_ForegroundFailed_0300 end";
@@ -3114,6 +3150,7 @@ HWTEST_F(AbilityImplTest, AaFwk_InputEventConsumerImpl_0100, TestSize.Level1)
GTEST_LOG_(INFO) << "AaFwk_InputEventConsumerImpl_0100 start";
auto abilityImpl = std::make_shared<AbilityImpl>();
auto impl = std::make_shared<AbilityImpl::InputEventConsumerImpl>(abilityImpl);
ASSERT_NE(impl, nullptr);
auto keyEvent = MMI::KeyEvent::Create();
impl->OnInputEvent(keyEvent);
GTEST_LOG_(INFO) << "AaFwk_InputEventConsumerImpl_0100 end";
@@ -3129,6 +3166,7 @@ HWTEST_F(AbilityImplTest, AaFwk_InputEventConsumerImpl_0200, TestSize.Level1)
GTEST_LOG_(INFO) << "AaFwk_InputEventConsumerImpl_0200 start";
auto abilityImpl = std::make_shared<AbilityImpl>();
auto impl = std::make_shared<AbilityImpl::InputEventConsumerImpl>(abilityImpl);
ASSERT_NE(impl, nullptr);
std::shared_ptr<MMI::PointerEvent> pointerEvent;
impl->OnInputEvent(pointerEvent);
GTEST_LOG_(INFO) << "AaFwk_InputEventConsumerImpl_0200 end";
@@ -77,6 +77,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_GetLifecycleState_0100, Function | Mediu
HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_AddObserver_0100, Function | MediumTest | Level3)
{
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_AddObserver_0100 start";
ASSERT_NE(lifeCycle_, nullptr);
lifeCycle_->AddObserver(nullptr);
@@ -93,6 +94,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_AddObserver_0200, Function | MediumTest
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_AddObserver_0200 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::ON_ACTIVE);
@@ -109,6 +111,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_RemoveObserver_0100, Function | MediumTe
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_RemoveObserver_0100 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::ON_ACTIVE);
lifeCycle_->RemoveObserver(nullptr);
@@ -126,6 +129,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_RemoveObserver_0200, Function | MediumTe
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_RemoveObserver_0200 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::ON_ACTIVE);
lifeCycle_->RemoveObserver(observer);
@@ -144,6 +148,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_DispatchLifecycle_event_want_0100, Funct
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_DispatchLifecycle_event_want_0100 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
Want want;
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::UNDEFINED, want);
@@ -161,6 +166,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_DispatchLifecycle_event_want_0200, Funct
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_DispatchLifecycle_event_want_0200 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
Want want;
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::ON_ACTIVE, want);
@@ -178,6 +184,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_DispatchLifecycle_event_want_0300, Funct
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_DispatchLifecycle_event_want_0300 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
Want want;
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::ON_BACKGROUND, want);
@@ -195,6 +202,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_DispatchLifecycle_event_want_0400, Funct
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_DispatchLifecycle_event_want_0400 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
Want want;
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::ON_FOREGROUND, want);
@@ -212,6 +220,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_DispatchLifecycle_event_want_0500, Funct
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_DispatchLifecycle_event_want_0500 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
Want want;
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::ON_INACTIVE, want);
@@ -229,6 +238,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_DispatchLifecycle_event_want_0600, Funct
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_DispatchLifecycle_event_want_0600 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
Want want;
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::ON_START, want);
@@ -246,6 +256,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_DispatchLifecycle_event_want_0700, Funct
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_DispatchLifecycle_event_want_0700 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
Want want;
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::ON_STOP, want);
@@ -263,6 +274,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_DispatchLifecycle_event_0100, Function |
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_DispatchLifecycle_event_0100 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::UNDEFINED);
@@ -279,6 +291,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_DispatchLifecycle_event_0200, Function |
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_DispatchLifecycle_event_0200 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::ON_ACTIVE);
@@ -295,6 +308,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_DispatchLifecycle_event_0300, Function |
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_DispatchLifecycle_event_0300 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::ON_BACKGROUND);
@@ -311,6 +325,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_DispatchLifecycle_event_0400, Function |
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_DispatchLifecycle_event_0400 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::ON_FOREGROUND);
@@ -327,6 +342,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_DispatchLifecycle_event_0500, Function |
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_DispatchLifecycle_event_0500 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::ON_INACTIVE);
@@ -343,6 +359,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_DispatchLifecycle_event_0600, Function |
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_DispatchLifecycle_event_0600 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::ON_START);
@@ -359,6 +376,7 @@ HWTEST_F(LifeCycleTest, AaFwk_LifeCycle_DispatchLifecycle_event_0700, Function |
GTEST_LOG_(INFO) << "AaFwk_LifeCycle_DispatchLifecycle_event_0700 start";
std::shared_ptr<MockLifecycleObserver> observer = std::make_shared<MockLifecycleObserver>();
ASSERT_NE(observer, nullptr);
lifeCycle_->AddObserver(observer);
lifeCycle_->DispatchLifecycle(LifeCycle::Event::ON_STOP);
@@ -123,6 +123,7 @@ HWTEST_F(AbilityWindowTest, Ability_Window_InitWindow_0200, TestSize.Level1)
HWTEST_F(AbilityWindowTest, Ability_Window_OnPostAbilityBackground_0100, TestSize.Level1)
{
GTEST_LOG_(INFO) << "Ability_Window_OnPostAbilityBackground_0100 start";
ASSERT_NE(abilityWindow_, nullptr);
abilityWindow_->windowScene_ = std::make_shared<WindowScene>();
uint32_t sceneFlag = 0;
abilityWindow_->OnPostAbilityBackground(sceneFlag);
@@ -137,6 +138,7 @@ HWTEST_F(AbilityWindowTest, Ability_Window_OnPostAbilityBackground_0100, TestSiz
HWTEST_F(AbilityWindowTest, Ability_Window_OnPostAbilityBackground_0200, TestSize.Level1)
{
GTEST_LOG_(INFO) << "Ability_Window_OnPostAbilityBackground_0200 start";
ASSERT_NE(abilityWindow_, nullptr);
abilityWindow_->isWindowAttached = true;
uint32_t sceneFlag = 0;
abilityWindow_->OnPostAbilityBackground(sceneFlag);
@@ -153,6 +155,7 @@ HWTEST_F(AbilityWindowTest, Ability_Window_OnPostAbilityBackground_0200, TestSiz
HWTEST_F(AbilityWindowTest, Ability_Window_OnPostAbilityForeground_0100, TestSize.Level1)
{
GTEST_LOG_(INFO) << "Ability_Window_OnPostAbilityForeground_0100 start";
ASSERT_NE(abilityWindow_, nullptr);
abilityWindow_->windowScene_ = std::make_shared<WindowScene>();
uint32_t sceneFlag = 0;
abilityWindow_->OnPostAbilityForeground(sceneFlag);
@@ -167,6 +170,7 @@ HWTEST_F(AbilityWindowTest, Ability_Window_OnPostAbilityForeground_0100, TestSiz
HWTEST_F(AbilityWindowTest, Ability_Window_OnPostAbilityForeground_0200, TestSize.Level1)
{
GTEST_LOG_(INFO) << "Ability_Window_OnPostAbilityForeground_0200 start";
ASSERT_NE(abilityWindow_, nullptr);
abilityWindow_->isWindowAttached = true;
uint32_t sceneFlag = 0;
abilityWindow_->OnPostAbilityForeground(sceneFlag);
@@ -905,8 +905,9 @@ HWTEST_F(DataAbilityOperationTest, DataAbilityOperationTest_0600, Level1)
{
GTEST_LOG_(INFO) << "DataAbilityOperationTest_0600 start";
Parcel parcel;
DataAbilityOperation dataAbilityOperation;
dataAbilityOperation.PutMap(parcel);
std::shared_ptr<DataAbilityOperation> dataAbilityOperation = std::make_shared<DataAbilityOperation>();
ASSERT_NE(dataAbilityOperation, nullptr);
dataAbilityOperation->PutMap(parcel);
GTEST_LOG_(INFO) << "DataAbilityOperationTest_0600 end";
}
} // namespace AppExecFwk
@@ -844,6 +844,7 @@ HWTEST_F(FormAbilityTest, AaFwk_Ability_NotifyInvisibleForms_0100, Function | Me
{
GTEST_LOG_(INFO) << "AaFwk_Ability_NotifyInvisibleForms_0100 start";
std::vector<int64_t> formIds;
ASSERT_NE(ability_, nullptr);
ability_->NotifyInvisibleForms(formIds);
GTEST_LOG_(INFO) << "AaFwk_Ability_NotifyInvisibleForms_0100 end";
}
@@ -859,6 +860,7 @@ HWTEST_F(FormAbilityTest, AaFwk_Ability_NotifyInvisibleForms_0200, Function | Me
std::vector<int64_t> formIds;
formIds.push_back(1);
FormMgr::SetRecoverStatus(Constants::IN_RECOVERING);
ASSERT_NE(ability_, nullptr);
ability_->NotifyInvisibleForms(formIds);
GTEST_LOG_(INFO) << "AaFwk_Ability_NotifyInvisibleForms_0200 end";
}
@@ -874,6 +876,7 @@ HWTEST_F(FormAbilityTest, AaFwk_Ability_NotifyInvisibleForms_0300, Function | Me
std::vector<int64_t> formIds;
formIds.push_back(1);
FormMgr::SetRecoverStatus(Constants::NOT_IN_RECOVERY);
ASSERT_NE(ability_, nullptr);
ability_->NotifyInvisibleForms(formIds);
GTEST_LOG_(INFO) << "AaFwk_Ability_NotifyInvisibleForms_0300 end";
}
@@ -890,6 +893,7 @@ HWTEST_F(FormAbilityTest, AaFwk_Ability_NotifyInvisibleForms_0400, Function | Me
formIds.push_back(1);
formIds.push_back(2);
FormMgr::SetRecoverStatus(Constants::NOT_IN_RECOVERY);
ASSERT_NE(ability_, nullptr);
ability_->NotifyInvisibleForms(formIds);
GTEST_LOG_(INFO) << "AaFwk_Ability_NotifyInvisibleForms_0400 end";
}
@@ -907,6 +911,7 @@ HWTEST_F(FormAbilityTest, AaFwk_Ability_NotifyVisibleForms_0100, Function | Medi
abilityInfo->type = AbilityType::PAGE;
std::shared_ptr<EventRunner> eventRunner = EventRunner::Create(abilityInfo->name);
std::shared_ptr<AbilityHandler> handler = std::make_shared<AbilityHandler>(eventRunner);
ASSERT_NE(ability_, nullptr);
ability_->Init(abilityInfo, nullptr, handler, nullptr);
@@ -931,6 +936,7 @@ HWTEST_F(FormAbilityTest, AaFwk_Ability_NotifyVisibleForms_0200, Function | Medi
abilityInfo->type = AbilityType::PAGE;
std::shared_ptr<EventRunner> eventRunner = EventRunner::Create(abilityInfo->name);
std::shared_ptr<AbilityHandler> handler = std::make_shared<AbilityHandler>(eventRunner);
ASSERT_NE(ability_, nullptr);
ability_->Init(abilityInfo, nullptr, handler, nullptr);
@@ -952,6 +958,7 @@ HWTEST_F(FormAbilityTest, AaFwk_Ability_NotifyVisibleForms_0300, Function | Medi
abilityInfo->type = AbilityType::PAGE;
std::shared_ptr<EventRunner> eventRunner = EventRunner::Create(abilityInfo->name);
std::shared_ptr<AbilityHandler> handler = std::make_shared<AbilityHandler>(eventRunner);
ASSERT_NE(ability_, nullptr);
ability_->Init(abilityInfo, nullptr, handler, nullptr);
@@ -977,6 +984,7 @@ HWTEST_F(FormAbilityTest, AaFwk_Ability_NotifyVisibleForms_0400, Function | Medi
abilityInfo->type = AbilityType::PAGE;
std::shared_ptr<EventRunner> eventRunner = EventRunner::Create(abilityInfo->name);
std::shared_ptr<AbilityHandler> handler = std::make_shared<AbilityHandler>(eventRunner);
ASSERT_NE(ability_, nullptr);
ability_->Init(abilityInfo, nullptr, handler, nullptr);
@@ -1002,6 +1010,7 @@ HWTEST_F(FormAbilityTest, AaFwk_Ability_FmsDeathCallback_OnDeathReceived_0100, F
abilityInfo->type = AbilityType::PAGE;
std::shared_ptr<EventRunner> eventRunner = EventRunner::Create(abilityInfo->name);
std::shared_ptr<AbilityHandler> handler = std::make_shared<AbilityHandler>(eventRunner);
ASSERT_NE(ability_, nullptr);
ability_->Init(abilityInfo, nullptr, handler, nullptr);
@@ -97,8 +97,10 @@ HWTEST_F(FormExtensionProviderClientTest, formExtensionProviderClient_0100, Func
int64_t formId = 723L;
const sptr<IRemoteObject> callerToken = nullptr;
AbilityRuntime::FormExtensionProviderClient formExtensionProviderClient;
formExtensionProviderClient.NotifyFormExtensionDelete(formId, want, callerToken);
std::shared_ptr<AbilityRuntime::FormExtensionProviderClient> formExtensionProviderClient =
std::make_shared<AbilityRuntime::FormExtensionProviderClient>();
ASSERT_NE(formExtensionProviderClient, nullptr);
formExtensionProviderClient->NotifyFormExtensionDelete(formId, want, callerToken);
GTEST_LOG_(INFO) << "formExtensionProviderClient_0100 end";
}
@@ -120,8 +122,10 @@ HWTEST_F(FormExtensionProviderClientTest, formExtensionProviderClient_0200, Func
want.SetParam(Constants::PARAM_FORM_HOST_TOKEN, callerToken);
int64_t formId = 723L;
AbilityRuntime::FormExtensionProviderClient formExtensionProviderClient;
formExtensionProviderClient.NotifyFormExtensionDelete(formId, want, callerToken);
std::shared_ptr<AbilityRuntime::FormExtensionProviderClient> formExtensionProviderClient =
std::make_shared<AbilityRuntime::FormExtensionProviderClient>();
ASSERT_NE(formExtensionProviderClient, nullptr);
formExtensionProviderClient->NotifyFormExtensionDelete(formId, want, callerToken);
GTEST_LOG_(INFO) << "formExtensionProviderClient_0200 end";
}
@@ -141,8 +145,10 @@ HWTEST_F(FormExtensionProviderClientTest, formExtensionProviderClient_0300, Func
int64_t formId = 723L;
const sptr<IRemoteObject> callerToken = nullptr;
AbilityRuntime::FormExtensionProviderClient formExtensionProviderClient;
formExtensionProviderClient.NotifyFormExtensionUpdate(formId, want, callerToken);
std::shared_ptr<AbilityRuntime::FormExtensionProviderClient> formExtensionProviderClient =
std::make_shared<AbilityRuntime::FormExtensionProviderClient>();
ASSERT_NE(formExtensionProviderClient, nullptr);
formExtensionProviderClient->NotifyFormExtensionUpdate(formId, want, callerToken);
GTEST_LOG_(INFO) << "formExtensionProviderClient_0300 end";
}
@@ -162,8 +168,10 @@ HWTEST_F(FormExtensionProviderClientTest, formExtensionProviderClient_0400, Func
int64_t formId = 723L;
const sptr<IRemoteObject> callerToken = nullptr;
AbilityRuntime::FormExtensionProviderClient formExtensionProviderClient;
formExtensionProviderClient.NotifyFormExtensionUpdate(formId, want, callerToken);
std::shared_ptr<AbilityRuntime::FormExtensionProviderClient> formExtensionProviderClient =
std::make_shared<AbilityRuntime::FormExtensionProviderClient>();
ASSERT_NE(formExtensionProviderClient, nullptr);
formExtensionProviderClient->NotifyFormExtensionUpdate(formId, want, callerToken);
GTEST_LOG_(INFO) << "formExtensionProviderClient_0400 end";
}
@@ -184,8 +192,10 @@ HWTEST_F(FormExtensionProviderClientTest, formExtensionProviderClient_0500, Func
int64_t formId = 723L;
std::string message = "event message";
const sptr<IRemoteObject> callerToken = nullptr;
AbilityRuntime::FormExtensionProviderClient formExtensionProviderClient;
formExtensionProviderClient.FireFormExtensionEvent(formId, message, want, callerToken);
std::shared_ptr<AbilityRuntime::FormExtensionProviderClient> formExtensionProviderClient =
std::make_shared<AbilityRuntime::FormExtensionProviderClient>();
ASSERT_NE(formExtensionProviderClient, nullptr);
formExtensionProviderClient->FireFormExtensionEvent(formId, message, want, callerToken);
GTEST_LOG_(INFO) << "formExtensionProviderClient_0500 end";
}
@@ -206,8 +216,10 @@ HWTEST_F(FormExtensionProviderClientTest, formExtensionProviderClient_0600, Func
int64_t formId = 723L;
std::string message = "event message";
const sptr<IRemoteObject> callerToken = nullptr;
AbilityRuntime::FormExtensionProviderClient formExtensionProviderClient;
formExtensionProviderClient.FireFormExtensionEvent(formId, message, want, callerToken);
std::shared_ptr<AbilityRuntime::FormExtensionProviderClient> formExtensionProviderClient =
std::make_shared<AbilityRuntime::FormExtensionProviderClient>();
ASSERT_NE(formExtensionProviderClient, nullptr);
formExtensionProviderClient->FireFormExtensionEvent(formId, message, want, callerToken);
GTEST_LOG_(INFO) << "formExtensionProviderClient_0600 end";
}
@@ -179,6 +179,7 @@ HWTEST_F(FormExtensionTest, AaFwk_Form_Extension_0700, Function | MediumTest | L
GTEST_LOG_(INFO) << "AaFwk_Form_Extension_0700 start";
AbilityRuntime::Runtime::Options options;
std::unique_ptr<AbilityRuntime::Runtime> runtime = AbilityRuntime::Runtime::Create(options);
ASSERT_NE(runtime, nullptr);
auto formExtension = AbilityRuntime::FormExtension::Create(runtime);
int64_t formId = 0;
formExtension->OnDestroy(formId);
@@ -195,6 +196,7 @@ HWTEST_F(FormExtensionTest, AaFwk_Form_Extension_0800, Function | MediumTest | L
GTEST_LOG_(INFO) << "AaFwk_Form_Extension_0800 start";
AbilityRuntime::Runtime::Options options;
std::unique_ptr<AbilityRuntime::Runtime> runtime = AbilityRuntime::Runtime::Create(options);
ASSERT_NE(runtime, nullptr);
auto formExtension = AbilityRuntime::FormExtension::Create(runtime);
int64_t formId = 0;
std::string message;
@@ -212,6 +214,7 @@ HWTEST_F(FormExtensionTest, AaFwk_Form_Extension_0900, Function | MediumTest | L
GTEST_LOG_(INFO) << "AaFwk_Form_Extension_0900 start";
AbilityRuntime::Runtime::Options options;
std::unique_ptr<AbilityRuntime::Runtime> runtime = AbilityRuntime::Runtime::Create(options);
ASSERT_NE(runtime, nullptr);
auto formExtension = AbilityRuntime::FormExtension::Create(runtime);
int64_t formId = 0;
formExtension->OnUpdate(formId);
@@ -228,6 +231,7 @@ HWTEST_F(FormExtensionTest, AaFwk_Form_Extension_1000, Function | MediumTest | L
GTEST_LOG_(INFO) << "AaFwk_Form_Extension_1000 start";
AbilityRuntime::Runtime::Options options;
std::unique_ptr<AbilityRuntime::Runtime> runtime = AbilityRuntime::Runtime::Create(options);
ASSERT_NE(runtime, nullptr);
auto formExtension = AbilityRuntime::FormExtension::Create(runtime);
int64_t formId = 0;
formExtension->OnCastToNormal(formId);
@@ -244,6 +248,7 @@ HWTEST_F(FormExtensionTest, AaFwk_Form_Extension_1100, Function | MediumTest | L
GTEST_LOG_(INFO) << "AaFwk_Form_Extension_1100 start";
AbilityRuntime::Runtime::Options options;
std::unique_ptr<AbilityRuntime::Runtime> runtime = AbilityRuntime::Runtime::Create(options);
ASSERT_NE(runtime, nullptr);
auto formExtension = AbilityRuntime::FormExtension::Create(runtime);
std::map<int64_t, int32_t> formEventsMap;
formExtension->OnVisibilityChange(formEventsMap);
@@ -16,7 +16,9 @@
#include <gtest/gtest.h>
#include "form_callback_interface.h"
#define private public
#include "form_host_client.h"
#undef private
namespace OHOS {
namespace AppExecFwk {
@@ -76,6 +78,7 @@ HWTEST_F(FormHostClientTest, AaFwk_formHostClientAddForm_0100, Function | Medium
{
GTEST_LOG_(INFO) << "AaFwk_FormHostClient_AddForm_0100 start";
std::shared_ptr<FormCallbackInterfaceTest> callback = std::make_shared<FormCallbackInterfaceTest>();
ASSERT_NE(callback, nullptr);
FormJsInfo formJsInfo;
formJsInfo.formId = 0;
instance_->AddForm(callback, formJsInfo);
@@ -96,6 +99,7 @@ HWTEST_F(FormHostClientTest, AaFwk_FormHostClient_RemoveForm_0100, Function | Me
{
GTEST_LOG_(INFO) << "AaFwk_FormHostClient_RemoveForm_0100 start";
std::shared_ptr<FormCallbackInterfaceTest> callback = std::make_shared<FormCallbackInterfaceTest>();
ASSERT_NE(callback, nullptr);
FormJsInfo formJsInfo;
formJsInfo.formId = 0;
instance_->RemoveForm(callback, formJsInfo.formId);
@@ -116,6 +120,7 @@ HWTEST_F(FormHostClientTest, AaFwk_FormHostClient_ContainsForm_0100, Function |
int64_t formId = 0;
EXPECT_EQ(false, instance_->ContainsForm(formId));
std::shared_ptr<FormCallbackInterfaceTest> callback = std::make_shared<FormCallbackInterfaceTest>();
ASSERT_NE(callback, nullptr);
FormJsInfo formJsInfo;
formJsInfo.formId = 1;
instance_->AddForm(callback, formJsInfo);
@@ -137,6 +142,7 @@ HWTEST_F(FormHostClientTest, AaFwk_FormHostClient_OnAcquired_0100, Function | Me
instance_->OnAcquired(formInfo, nullptr);
formInfo.formId = -1;
std::shared_ptr<FormCallbackInterfaceTest> callback = std::make_shared<FormCallbackInterfaceTest>();
ASSERT_NE(callback, nullptr);
instance_->AddForm(callback, formInfo);
formInfo.formId = 1;
formInfo.jsFormCodePath = "/data/test";
@@ -159,6 +165,7 @@ HWTEST_F(FormHostClientTest, AaFwk_FormHostClient_OnUpdate_0100, Function | Medi
instance_->OnUpdate(formInfo);
formInfo.formId = 1;
std::shared_ptr<FormCallbackInterfaceTest> callback = std::make_shared<FormCallbackInterfaceTest>();
ASSERT_NE(callback, nullptr);
instance_->AddForm(callback, formInfo);
formInfo.formId = 1;
instance_->OnUpdate(formInfo);
@@ -203,8 +210,10 @@ HWTEST_F(FormHostClientTest, AaFwk_FormHostClient_RemoveShareFormCallback_0100,
GTEST_LOG_(INFO) << "AaFwk_FormHostClient_RemoveShareFormCallback_0100 start";
std::shared_ptr<ShareFormCallBack> shareFormCallback;
FormHostClient formhostclient;
formhostclient.shareFormCallbackMap_.clear();
formhostclient.AddShareFormCallback(shareFormCallback, 0);
formhostclient.AddShareFormCallback(shareFormCallback, 1);
EXPECT_EQ(formhostclient.shareFormCallbackMap_.size(), 2);
formhostclient.RemoveShareFormCallback(1);
formhostclient.RemoveShareFormCallback(0);
GTEST_LOG_(INFO) << "AaFwk_FormHostClient_RemoveShareFormCallback_0100 end";
@@ -83,6 +83,7 @@ HWTEST_F(FormProviderClientTest, AaFwk_FormProviderClient_AcquireProviderFormInf
GTEST_LOG_(INFO) << "AaFwk_FormProviderClient_AcquireProviderFormInfo_0100 start";
const std::shared_ptr<Ability> ability = std::make_shared<Ability>();
ASSERT_NE(ability, nullptr);
instance_->SetOwner(ability);
const sptr<IRemoteObject> callerToken = MockFormSupplyCallback::GetInstance();
@@ -111,6 +112,7 @@ HWTEST_F(FormProviderClientTest, AaFwk_FormProviderClient_AcquireProviderFormInf
instance_->SetOwner(nullptr);
const sptr<IRemoteObject> callerToken = MockFormSupplyCallback::GetInstance();
ASSERT_NE(callerToken, nullptr);
Want want;
want.SetParam(Constants::PARAM_FORM_MANAGER_SERVICE_BUNDLENAME_KEY, FORM_MANAGER_SERVICE_BUNDLE_NAME)
.SetParam(Constants::ACQUIRE_TYPE, 200)
@@ -135,6 +137,7 @@ HWTEST_F(FormProviderClientTest, AaFwk_FormProviderClient_AcquireProviderFormInf
GTEST_LOG_(INFO) << "AaFwk_FormProviderClient_AcquireProviderFormInfo_0300 start";
const std::shared_ptr<Ability> ability = std::make_shared<Ability>();
ASSERT_NE(ability, nullptr);
instance_->SetOwner(ability);
const sptr<IRemoteObject> callerToken = MockFormSupplyCallback::GetInstance();
@@ -161,6 +164,7 @@ HWTEST_F(FormProviderClientTest, AaFwk_FormProviderClient_AcquireProviderFormInf
GTEST_LOG_(INFO) << "AaFwk_FormProviderClient_AcquireProviderFormInfo_0400 start";
const std::shared_ptr<Ability> ability = std::make_shared<Ability>();
ASSERT_NE(ability, nullptr);
instance_->SetOwner(ability);
instance_->ClearOwner(ability);
@@ -911,6 +911,7 @@ HWTEST_F(PacMapTest, AppExecFwk_PacMap_InnerPutObject_0100, Function | MediumTes
std::shared_ptr<UserObjectBase> value = nullptr;
PacMapList mapList;
std::string key = "this is key";
ASSERT_NE(pacmap_, nullptr);
pacmap_->InnerPutObject(mapList, key, value);
GTEST_LOG_(INFO) << "AppExecFwk_PacMap_InnerPutObject_0100 end";
@@ -1108,6 +1109,7 @@ HWTEST_F(PacMapTest, AppExecFwk_PacMap_GetPacMap_0100, Function | MediumTest | L
GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetPacMap_0100 start";
std::string key = "this is key";
ASSERT_NE(pacmap_, nullptr);
pacmap_->GetPacMap(key);
std::string key1 = "";
pacmap_->GetPacMap(key1);
@@ -103,6 +103,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_DoKeyDown_0200, Function | M
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_DoKeyDown_0200 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -134,6 +135,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_DoKeyUp_0100, Function | Med
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_DoKeyUp_0100 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -166,6 +168,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_DoKeyUp_0200, Function | Med
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_DoKeyUp_0200 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -198,6 +201,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_DoTouchEvent_0100, Function
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_DoTouchEvent_0100 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -230,6 +234,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_DoTouchEvent_0200, Function
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_DoTouchEvent_0200 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -296,6 +301,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_HandleAbilityTransaction_020
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_HandleAbilityTransaction_0200 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -327,6 +333,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_HandleAbilityTransaction_030
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_HandleAbilityTransaction_0300 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -358,6 +365,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_HandleAbilityTransaction_040
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_HandleAbilityTransaction_0400 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -389,6 +397,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_HandleAbilityTransaction_050
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_HandleAbilityTransaction_0500 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -422,6 +431,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_HandleAbilityTransaction_060
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_HandleAbilityTransaction_0600 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -456,6 +466,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_HandleAbilityTransaction_070
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_HandleAbilityTransaction_0700 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -492,6 +503,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_HandleAbilityTransaction_080
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_HandleAbilityTransaction_0800 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -527,6 +539,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_HandleAbilityTransaction_090
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_HandleAbilityTransaction_0900 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -564,6 +577,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_DispatchSaveAbilityState_010
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_DispatchSaveAbilityState_0100 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -594,6 +608,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_DispatchRestoreAbilityState_
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_DispatchRestoreAbilityState_0100 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -623,6 +638,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_SendResult_0100, Function |
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_SendResult_0100 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -654,6 +670,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_NewWant_0100, Function | Med
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_NewWant_0100 start";
std::shared_ptr<OHOSApplication> application = std::make_shared<OHOSApplication>();
ASSERT_NE(application, nullptr);
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = "pageAbility";
sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
@@ -914,6 +931,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_DoKeyDown_0300, Function | M
{
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_DoKeyDown_0300 start";
auto keyEvent = MMI::KeyEvent::Create();
ASSERT_NE(pageAbilityImpl_, nullptr);
pageAbilityImpl_->ability_ = nullptr;
pageAbilityImpl_->DoKeyDown(keyEvent);
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_DoKeyDown_0300 end";
@@ -928,6 +946,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_DoKeyUp_0300, Function | Med
{
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_DoKeyUp_0300 start";
auto keyEvent = MMI::KeyEvent::Create();
ASSERT_NE(pageAbilityImpl_, nullptr);
pageAbilityImpl_->ability_ = nullptr;
pageAbilityImpl_->DoKeyUp(keyEvent);
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_DoKeyUp_0300 end";
@@ -942,6 +961,7 @@ HWTEST_F(PageAbilityImplTest, AaFwk_PageAbilityImpl_DoTouchEvent_0300, Function
{
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_DoTouchEvent_0300 start";
auto pointerEvent = MMI::PointerEvent::Create();
ASSERT_NE(pageAbilityImpl_, nullptr);
pageAbilityImpl_->ability_ = nullptr;
pageAbilityImpl_->DoPointerEvent(pointerEvent);
GTEST_LOG_(INFO) << "AaFwk_PageAbilityImpl_DoTouchEvent_0300 end";
@@ -765,6 +765,7 @@ HWTEST_F(ContextContainerTest, VerifySelfPermission_0200, Function | MediumTest
*/
HWTEST_F(ContextContainerTest, UnauthUriPermission_0100, Function | MediumTest | Level1)
{
ASSERT_NE(context_, nullptr);
context_->AttachBaseContext(contextDeal_);
std::string permission = "test_permission";
Uri uri("");
@@ -779,6 +780,7 @@ HWTEST_F(ContextContainerTest, UnauthUriPermission_0100, Function | MediumTest |
*/
HWTEST_F(ContextContainerTest, UnauthUriPermission_0200, Function | MediumTest | Level1)
{
ASSERT_NE(context_, nullptr);
context_->AttachBaseContext(nullptr);
std::string permission = "test_permission";
Uri uri("");
@@ -843,6 +845,7 @@ HWTEST_F(ContextContainerTest, GetDistributedDir_0200, Function | MediumTest | L
*/
HWTEST_F(ContextContainerTest, SetPattern_0100, Function | MediumTest | Level1)
{
ASSERT_NE(context_, nullptr);
context_->AttachBaseContext(contextDeal_);
int patternId = 0;
context_->SetPattern(patternId);
@@ -855,6 +858,7 @@ HWTEST_F(ContextContainerTest, SetPattern_0100, Function | MediumTest | Level1)
*/
HWTEST_F(ContextContainerTest, SetPattern_0200, Function | MediumTest | Level1)
{
ASSERT_NE(context_, nullptr);
context_->AttachBaseContext(nullptr);
int patternId = 0;
context_->SetPattern(patternId);
@@ -889,6 +893,7 @@ HWTEST_F(ContextContainerTest, GetAbilityPackageContext_0200, Function | MediumT
*/
HWTEST_F(ContextContainerTest, RequestPermissionsFromUser_0100, Function | MediumTest | Level1)
{
ASSERT_NE(context_, nullptr);
context_->AttachBaseContext(contextDeal_);
std::vector<std::string> permissions;
std::vector<int> permissionsState;
@@ -903,6 +908,7 @@ HWTEST_F(ContextContainerTest, RequestPermissionsFromUser_0100, Function | Mediu
*/
HWTEST_F(ContextContainerTest, RequestPermissionsFromUser_0200, Function | MediumTest | Level1)
{
ASSERT_NE(context_, nullptr);
context_->AttachBaseContext(nullptr);
std::vector<std::string> permissions;
std::vector<int> permissionsState;
@@ -1047,6 +1053,7 @@ HWTEST_F(ContextContainerTest, GetTheme_0200, Function | MediumTest | Level1)
*/
HWTEST_F(ContextContainerTest, SetTheme_0100, Function | MediumTest | Level1)
{
ASSERT_NE(context_, nullptr);
context_->AttachBaseContext(contextDeal_);
context_->SetTheme(1);
}
@@ -1058,6 +1065,7 @@ HWTEST_F(ContextContainerTest, SetTheme_0100, Function | MediumTest | Level1)
*/
HWTEST_F(ContextContainerTest, SetTheme_0200, Function | MediumTest | Level1)
{
ASSERT_NE(context_, nullptr);
context_->AttachBaseContext(nullptr);
context_->SetTheme(1);
}
@@ -1157,6 +1165,7 @@ HWTEST_F(ContextContainerTest, GetPreferencesDir_0200, Function | MediumTest | L
*/
HWTEST_F(ContextContainerTest, SetColorMode_0100, Function | MediumTest | Level1)
{
ASSERT_NE(context_, nullptr);
context_->AttachBaseContext(contextDeal_);
context_->SetColorMode(1);
}
@@ -1168,6 +1177,7 @@ HWTEST_F(ContextContainerTest, SetColorMode_0100, Function | MediumTest | Level1
*/
HWTEST_F(ContextContainerTest, SetColorMode_0200, Function | MediumTest | Level1)
{
ASSERT_NE(context_, nullptr);
context_->AttachBaseContext(nullptr);
context_->SetColorMode(1);
}
@@ -1406,6 +1416,7 @@ HWTEST_F(ContextContainerTest, AppExecFwk_ContextContainer_UnauthUriPermission_0
{
std::shared_ptr<Ability> ability = std::make_shared<Ability>();
std::shared_ptr<Context> context(ability);
ASSERT_NE(context, nullptr);
contextDeal_->SetContext(context);
context_->AttachBaseContext(contextDeal_);
@@ -1420,6 +1431,7 @@ HWTEST_F(ContextContainerTest, AppExecFwk_ContextContainer_UnauthUriPermission_0
*/
HWTEST_F(ContextContainerTest, AppExecFwk_ContextContainer_UnauthUriPermission_0200, Function | MediumTest | Level3)
{
ASSERT_NE(context_, nullptr);
Uri urivalue("");
context_->UnauthUriPermission("permission", urivalue, 0);
}
@@ -1658,6 +1670,7 @@ HWTEST_F(ContextContainerTest, AppExecFwk_ContextContainer_SetTheme_0100, Functi
{
std::shared_ptr<Ability> ability = std::make_shared<Ability>();
std::shared_ptr<Context> context(ability);
ASSERT_NE(context, nullptr);
contextDeal_->SetContext(context);
context_->AttachBaseContext(contextDeal_);
context_->SetTheme(0);
@@ -1670,6 +1683,7 @@ HWTEST_F(ContextContainerTest, AppExecFwk_ContextContainer_SetTheme_0100, Functi
*/
HWTEST_F(ContextContainerTest, AppExecFwk_ContextContainer_SetTheme_0200, Function | MediumTest | Level3)
{
ASSERT_NE(context_, nullptr);
context_->SetTheme(0);
}
@@ -1711,6 +1725,7 @@ HWTEST_F(ContextContainerTest, AppExecFwk_ContextContainer_SetPattern_0100, Func
{
std::shared_ptr<Ability> ability = std::make_shared<Ability>();
std::shared_ptr<Context> context(ability);
ASSERT_NE(context, nullptr);
contextDeal_->SetContext(context);
context_->AttachBaseContext(contextDeal_);
@@ -1724,6 +1739,7 @@ HWTEST_F(ContextContainerTest, AppExecFwk_ContextContainer_SetPattern_0100, Func
*/
HWTEST_F(ContextContainerTest, AppExecFwk_ContextContainer_SetPattern_0200, Function | MediumTest | Level3)
{
ASSERT_NE(context_, nullptr);
context_->SetPattern(0);
}
@@ -1737,6 +1753,7 @@ HWTEST_F(ContextContainerTest, AppExecFwk_ContextContainer_GetColor_0100, Functi
{
std::shared_ptr<Ability> ability = std::make_shared<Ability>();
std::shared_ptr<Context> context(ability);
ASSERT_NE(context, nullptr);
contextDeal_->SetContext(context);
context_->AttachBaseContext(contextDeal_);
@@ -1764,6 +1781,7 @@ HWTEST_F(ContextContainerTest, AppExecFwk_ContextContainer_GetThemeId_0100, Func
{
std::shared_ptr<Ability> ability = std::make_shared<Ability>();
std::shared_ptr<Context> context(ability);
ASSERT_NE(context, nullptr);
contextDeal_->SetContext(context);
context_->AttachBaseContext(contextDeal_);
@@ -128,6 +128,7 @@ HWTEST_F(ContextDealInterfaceTest, AppExecFwk_ContextDeal_SetTheme_0100, Functio
{"Pattern1", "PatternA"}, {"Pattern2", "PatternB"}, {"Pattern3", "PatternC"} };
std::shared_ptr<Global::Resource::ResourceManager2> resourceManager(Global::Resource::CreateResourceManager2());
std::shared_ptr<ContextDeal> contextDeal = std::make_shared<ContextDeal>();
ASSERT_NE(contextDeal, nullptr);
resourceManager->SetThemeById(testValue, testList);
contextDeal->initResourceManager(resourceManager);
contextDeal->SetTheme(testValue);
@@ -144,6 +145,7 @@ HWTEST_F(ContextDealInterfaceTest, AppExecFwk_ContextDeal_SetTheme_0200, Functio
GTEST_LOG_(INFO) << "AppExecFwk_ContextDeal_SetTheme_0200 start";
int testValue = 1;
std::shared_ptr<ContextDeal> contextDeal = std::make_shared<ContextDeal>();
ASSERT_NE(contextDeal, nullptr);
contextDeal->SetTheme(testValue);
GTEST_LOG_(INFO) << "AppExecFwk_ContextDeal_SetTheme_0200 end";
}
@@ -243,6 +245,7 @@ HWTEST_F(ContextDealInterfaceTest, AppExecFwk_ContextDeal_GetTheme_0100, Functio
std::map<std::string, std::string> testList = { {"Theme1", "ThemeA"}, {"Theme2", "ThemeB"}, {"Theme3", "ThemeC"} };
std::shared_ptr<Global::Resource::ResourceManager2> resourceManager(Global::Resource::CreateResourceManager2());
std::shared_ptr<ContextDeal> contextDeal = std::make_shared<ContextDeal>();
ASSERT_NE(contextDeal, nullptr);
resourceManager->SetThemeById(testValue, testList);
contextDeal->initResourceManager(resourceManager);
std::map<std::string, std::string> retVal = contextDeal->GetTheme();
@@ -268,17 +271,6 @@ HWTEST_F(ContextDealInterfaceTest, AppExecFwk_ContextDeal_GetString_ById_0100, F
GTEST_LOG_(INFO) << "AppExecFwk_ContextDeal_GetString_ById_0100 end";
}
/**
* @tc.number: AppExecFwk_ContextDeal_GetString_ByIdAndFormat_0100
* @tc.name: GetString
* @tc.desc: Test the attachbasecontext call to verify that the return value of GetString is correct.
*/
HWTEST_F(ContextDealInterfaceTest, AppExecFwk_ContextDeal_GetString_ByIdAndFormat_0100, Function | MediumTest | Level1)
{
GTEST_LOG_(INFO) << "AppExecFwk_ContextDeal_GetString_ByIdAndFormat_0100 start";
GTEST_LOG_(INFO) << "AppExecFwk_ContextDeal_GetString_ByIdAndFormat_0100 end";
}
/**
* @tc.number: AppExecFwk_ContextDeal_GetStringArray_0100
* @tc.name: GetStringArray
@@ -393,17 +385,6 @@ HWTEST_F(ContextDealInterfaceTest, AppExecFwk_ContextDeal_GetColor_0200, Functio
GTEST_LOG_(INFO) << "AppExecFwk_ContextDeal_GetColor_0200 end";
}
/**
* @tc.number: AppExecFwk_ContextDeal_GetThemeId_0100
* @tc.name: GetThemeId
* @tc.desc: Test the attachbasecontext call to verify that the return value of GetThemeId is correct.
*/
HWTEST_F(ContextDealInterfaceTest, AppExecFwk_ContextDeal_GetThemeId_0100, Function | MediumTest | Level1)
{
GTEST_LOG_(INFO) << "AppExecFwk_ContextDeal_GetThemeId_0100 start";
GTEST_LOG_(INFO) << "AppExecFwk_ContextDeal_GetThemeId_0100 end";
}
/**
* @tc.number: AppExecFwk_ContextDeal_GetDisplayOrientation_0100
* @tc.name: GetDisplayOrientation
@@ -837,6 +837,7 @@ HWTEST_F(MissionListTest, mission_list_handle_uninstall_app_001, TestSize.Level1
abilityRecord->SetAbilityState(AbilityState::INITIAL);
auto mission = std::make_shared<Mission>(1, abilityRecord, "name");
auto missionList = std::make_shared<MissionList>();
ASSERT_NE(missionList, nullptr);
missionList->missions_.push_front(mission);
missionList->HandleUnInstallApp("bundle", 0);
}
@@ -919,6 +920,7 @@ HWTEST_F(MissionListTest, mission_list_dump_state_by_record_id_001, TestSize.Lev
auto mission1 = std::make_shared<Mission>(1, abilityRecord, "name");
auto mission2 = std::make_shared<Mission>(1, nullptr, "name");
auto missionList = std::make_shared<MissionList>();
ASSERT_NE(missionList, nullptr);
std::vector<std::string> info;
bool isClient = false;
int32_t abilityRecordId = 1;
@@ -941,6 +943,7 @@ HWTEST_F(MissionListTest, mission_list_dump_list_001, TestSize.Level1)
{
auto mission = std::make_shared<Mission>(1, nullptr, "name");
auto missionList = std::make_shared<MissionList>();
ASSERT_NE(missionList, nullptr);
std::vector<std::string> info;
bool isClient = false;
missionList->missions_.push_front(nullptr);
@@ -967,6 +970,7 @@ HWTEST_F(MissionListTest, mission_block_ability_by_record_id_001, TestSize.Level
auto mission1 = std::make_shared<Mission>(1, abilityRecord, "name");
auto mission2 = std::make_shared<Mission>(1, nullptr, "name");
auto missionList = std::make_shared<MissionList>();
ASSERT_NE(missionList, nullptr);
std::vector<std::string> info;
bool isClient = false;
std::vector<std::string> params;
@@ -55,6 +55,7 @@ void UriPermissionImplTest::TearDown() {}
HWTEST_F(UriPermissionImplTest, Upms_GrantUriPermission_001, TestSize.Level1)
{
auto upms = std::make_shared<UriPermissionManagerStubImpl>();
ASSERT_NE(upms, nullptr);
auto uriStr = "file://com.example.test/data/storage/el2/base/haps/entry/files/test_A.txt";
Uri uri(uriStr);
unsigned int flag = 0;
@@ -72,6 +73,7 @@ HWTEST_F(UriPermissionImplTest, Upms_GrantUriPermission_001, TestSize.Level1)
HWTEST_F(UriPermissionImplTest, Upms_GrantUriPermission_002, TestSize.Level1)
{
auto upms = std::make_shared<UriPermissionManagerStubImpl>();
ASSERT_NE(upms, nullptr);
auto uriStr = "file://com.example.test/data/storage/el2/base/haps/entry/files/test_A.txt";
Uri uri(uriStr);
unsigned int flag = 1;
@@ -89,6 +91,7 @@ HWTEST_F(UriPermissionImplTest, Upms_GrantUriPermission_002, TestSize.Level1)
HWTEST_F(UriPermissionImplTest, Upms_GrantUriPermission_003, TestSize.Level1)
{
auto upms = std::make_shared<UriPermissionManagerStubImpl>();
ASSERT_NE(upms, nullptr);
auto uriStr = "file://com.example.test/data/storage/el2/base/haps/entry/files/test_A.txt";
Uri uri(uriStr);
unsigned int flag = 2;
@@ -108,6 +111,7 @@ HWTEST_F(UriPermissionImplTest, Upms_GrantUriPermission_003, TestSize.Level1)
HWTEST_F(UriPermissionImplTest, Upms_GrantUriPermission_004, TestSize.Level1)
{
auto upms = std::make_shared<UriPermissionManagerStubImpl>();
ASSERT_NE(upms, nullptr);
auto uriStr = "file://com.example.test/data/storage/el2/base/haps/entry/files/test_A.txt";
Uri uri(uriStr);
unsigned int flag = 2;
@@ -129,6 +133,7 @@ HWTEST_F(UriPermissionImplTest, Upms_GrantUriPermission_004, TestSize.Level1)
HWTEST_F(UriPermissionImplTest, Upms_GrantUriPermission_005, TestSize.Level1)
{
auto upms = std::make_shared<UriPermissionManagerStubImpl>();
ASSERT_NE(upms, nullptr);
unsigned int tmpFlag = 1;
uint32_t fromTokenId = 2;
uint32_t targetTokenId = 3;
@@ -153,6 +158,7 @@ HWTEST_F(UriPermissionImplTest, Upms_GrantUriPermission_005, TestSize.Level1)
HWTEST_F(UriPermissionImplTest, Upms_GrantUriPermission_006, TestSize.Level1)
{
auto upms = std::make_shared<UriPermissionManagerStubImpl>();
ASSERT_NE(upms, nullptr);
unsigned int tmpFlag = 1;
uint32_t fromTokenId = 2;
uint32_t targetTokenId = 3;
@@ -178,6 +184,7 @@ HWTEST_F(UriPermissionImplTest, Upms_GrantUriPermission_006, TestSize.Level1)
HWTEST_F(UriPermissionImplTest, Upms_GrantUriPermission_007, TestSize.Level1)
{
auto upms = std::make_shared<UriPermissionManagerStubImpl>();
ASSERT_NE(upms, nullptr);
unsigned int tmpFlag = 1;
uint32_t fromTokenId = 2;
uint32_t targetTokenId = 3;
@@ -203,6 +210,7 @@ HWTEST_F(UriPermissionImplTest, Upms_GrantUriPermission_007, TestSize.Level1)
HWTEST_F(UriPermissionImplTest, Upms_RevokeUriPermission_001, TestSize.Level1)
{
auto upms = std::make_shared<UriPermissionManagerStubImpl>();
ASSERT_NE(upms, nullptr);
unsigned int tmpFlag = 1;
uint32_t fromTokenId = 2;
uint32_t targetTokenId = 3;
@@ -222,6 +230,7 @@ HWTEST_F(UriPermissionImplTest, Upms_RevokeUriPermission_001, TestSize.Level1)
HWTEST_F(UriPermissionImplTest, Upms_RevokeUriPermission_002, TestSize.Level1)
{
auto upms = std::make_shared<UriPermissionManagerStubImpl>();
ASSERT_NE(upms, nullptr);
unsigned int tmpFlag = 1;
uint32_t fromTokenId = 2;
uint32_t targetTokenId = 3;
@@ -242,6 +251,7 @@ HWTEST_F(UriPermissionImplTest, Upms_RevokeUriPermission_002, TestSize.Level1)
HWTEST_F(UriPermissionImplTest, Upms_ConnectBundleManager_001, TestSize.Level1)
{
auto upms = std::make_shared<UriPermissionManagerStubImpl>();
ASSERT_NE(upms, nullptr);
SystemAbilityManagerClient::nullptrFlag = true;
(void)upms->ConnectBundleManager();
SystemAbilityManagerClient::nullptrFlag = false;
@@ -256,6 +266,7 @@ HWTEST_F(UriPermissionImplTest, Upms_ConnectBundleManager_001, TestSize.Level1)
HWTEST_F(UriPermissionImplTest, Upms_ConnectBundleManager_002, TestSize.Level1)
{
auto upms = std::make_shared<UriPermissionManagerStubImpl>();
ASSERT_NE(upms, nullptr);
(void)upms->ConnectBundleManager();
}
@@ -268,6 +279,7 @@ HWTEST_F(UriPermissionImplTest, Upms_ConnectBundleManager_002, TestSize.Level1)
HWTEST_F(UriPermissionImplTest, Upms_ConnectStorageManager_001, TestSize.Level1)
{
auto upms = std::make_shared<UriPermissionManagerStubImpl>();
ASSERT_NE(upms, nullptr);
SystemAbilityManagerClient::nullptrFlag = true;
(void)upms->ConnectStorageManager();
SystemAbilityManagerClient::nullptrFlag = false;
@@ -282,6 +294,7 @@ HWTEST_F(UriPermissionImplTest, Upms_ConnectStorageManager_001, TestSize.Level1)
HWTEST_F(UriPermissionImplTest, Upms_ConnectStorageManager_002, TestSize.Level1)
{
auto upms = std::make_shared<UriPermissionManagerStubImpl>();
ASSERT_NE(upms, nullptr);
(void)upms->ConnectStorageManager();
}
} // namespace AAFwk
@@ -86,6 +86,7 @@ HWTEST_F(ShellCommandExecutorTest, ShellCommandExecutor_DoWork_0300, TestSize.Le
{
GTEST_LOG_(INFO) << "ShellCommandExecutor_DoWork_0300 start";
std::shared_ptr<AppExecFwk::EventHandler> handler_ = std::make_shared<AppExecFwk::EventHandler>();
ASSERT_NE(handler_, nullptr);
auto task = []() { GTEST_LOG_(INFO) << "ShellCommandExecutor_DoWork_0300 task called"; };
handler_->PostTask(task, 1000);
Command_->cmd_ = CMD;
@@ -102,6 +103,7 @@ HWTEST_F(ShellCommandExecutorTest, ShellCommandExecutor_DoWork_0400, TestSize.Le
{
GTEST_LOG_(INFO) << "ShellCommandExecutor_DoWork_0400 start";
std::shared_ptr<AppExecFwk::EventHandler> handler_ = std::make_shared<AppExecFwk::EventHandler>();
ASSERT_NE(handler_, nullptr);
auto task = []() { GTEST_LOG_(INFO) << "ShellCommandExecutor_DoWork_0400 task called"; };
handler_->PostTask(task, 1000);
Command_->cmd_ = "CMD12";
@@ -144,6 +144,7 @@ HWTEST_F(TestObserverProxyTest, Test_Observer_Proxy_Test_0200, TestSize.Level1)
{
HILOG_INFO("Test_Observer_Proxy_Test_0200 start");
OHOS::sptr<OHOS::IRemoteObject> object = new OHOS::MockIRemoteObject();
ASSERT_NE(object, nullptr);
TestObserverProxy testObserverProxy(object);
testObserverProxy.TestStatus(CMD.c_str(), 0);
HILOG_INFO("Test_Observer_Proxy_Test_0200 end");
@@ -158,6 +159,7 @@ HWTEST_F(TestObserverProxyTest, Test_Observer_Proxy_Test_0300, TestSize.Level1)
{
HILOG_INFO("Test_Observer_Proxy_Test_0300 start");
OHOS::sptr<OHOS::IRemoteObject> object = new OHOS::MockIRemoteObject();
ASSERT_NE(object, nullptr);
TestObserverProxy testObserverProxy(object);
testObserverProxy.TestFinished(CMD.c_str(), 0);
HILOG_INFO("Test_Observer_Proxy_Test_0300 end");
@@ -133,6 +133,7 @@ HWTEST_F(TestObserverTest, Test_Observer_Test_0400, Function | MediumTest | Leve
HWTEST_F(TestObserverTest, Test_Observer_Test_0500, Function | MediumTest | Level1)
{
HILOG_INFO("Test_Observer_Test_0500 is called");
TestObserver observer;
observer.TestStatus(MSG.c_str(), RESULT_CODE);
std::shared_ptr<TestObserver> observer = std::make_shared<TestObserver>();
ASSERT_NE(observer, nullptr);
observer->TestStatus(MSG.c_str(), RESULT_CODE);
}