UT modify

Signed-off-by: fangJinliang1 <fangjinliang1@huawei.com>
Change-Id: Iee7918cfc57abccb131e515c4f01d69165147933
This commit is contained in:
fangJinliang1 2022-04-06 12:28:42 +08:00 committed by FangJinliang
parent 114a14d703
commit 9fb9926e0f

View File

@ -434,8 +434,16 @@ HWTEST_F(PendingWantTest, PendingWant_1800, Function | MediumTest | Level1)
*/
HWTEST_F(PendingWantTest, PendingWant_1900, Function | MediumTest | Level1)
{
sptr<AAFwk::IWantSender> target(new (std::nothrow) WantSender());
std::shared_ptr<PendingWant> pendingWant = std::make_shared<PendingWant>(target);
int requestCode = 10;
std::shared_ptr<Want> want = std::make_shared<Want>();
ElementName element("device", "bundleName", "abilityName");
want->SetElement(element);
unsigned int flags = 1;
flags |= FLAG_NO_CREATE;
WantAgentConstant::OperationType type = WantAgentConstant::OperationType::START_FOREGROUND_SERVICE;
std::shared_ptr<PendingWant> pendingWant =
PendingWant::BuildServicePendingWant(nullptr, requestCode, want, flags, type);
sptr<AAFwk::IWantSender> target2(nullptr);
std::shared_ptr<PendingWant> pendingWant2 = std::make_shared<PendingWant>(target2);
EXPECT_EQ(pendingWant->Equals(pendingWant, pendingWant2), false);
@ -477,19 +485,6 @@ HWTEST_F(PendingWantTest, PendingWant_2100, Function | MediumTest | Level1)
pendingWant.SendAndReturnResult(requestCode, want, nullptr, "Permission", nullptr, nullptr));
}
/*
* @tc.number : PendingWant_2300
* @tc.name : PendingWant Equals
* @tc.desc : Equals
*/
HWTEST_F(PendingWantTest, PendingWant_2300, Function | MediumTest | Level1)
{
sptr<AAFwk::IWantSender> target(new (std::nothrow) WantSender());
std::shared_ptr<PendingWant> pendingWant = std::make_shared<PendingWant>(target);
std::shared_ptr<PendingWant> pendingWant2 = std::make_shared<PendingWant>(target);
EXPECT_EQ(pendingWant->Equals(pendingWant, pendingWant2), true);
}
/*
* @tc.number : PendingWant_2400
* @tc.name : PendingWant GetTarget