mirror of
https://gitee.com/openharmony/telephony_cellular_data
synced 2024-11-23 07:49:51 +00:00
commit
a47979ba15
@ -518,6 +518,48 @@ HWTEST_F(ApnManagerTest, GetRilAttachApn_001, Function | MediumTest | Level1)
|
||||
ASSERT_EQ(apnManager->GetRilAttachApn(), nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number GetRilAttachApn_002
|
||||
* @tc.name test function branch
|
||||
* @tc.desc Function test
|
||||
*/
|
||||
HWTEST_F(ApnManagerTest, GetRilAttachApn_002, Function | MediumTest | Level1)
|
||||
{
|
||||
std::vector<sptr<ApnItem>> allApnItem;
|
||||
sptr<ApnItem> defaultApnItem = ApnItem::MakeDefaultApn(DATA_CONTEXT_ROLE_DEFAULT);
|
||||
allApnItem.push_back(defaultApnItem);
|
||||
apnManager->allApnItem_ = allApnItem;
|
||||
ASSERT_NE(apnManager->GetRilAttachApn(), nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number GetRilAttachApn_003
|
||||
* @tc.name test function branch
|
||||
* @tc.desc Function test
|
||||
*/
|
||||
HWTEST_F(ApnManagerTest, GetRilAttachApn_003, Function | MediumTest | Level1)
|
||||
{
|
||||
std::vector<sptr<ApnItem>> allApnItem;
|
||||
sptr<ApnItem> apnItem = ApnItem::MakeDefaultApn(DATA_CONTEXT_ROLE_IA);
|
||||
allApnItem.push_back(apnItem);
|
||||
apnManager->allApnItem_ = allApnItem;
|
||||
ASSERT_NE(apnManager->GetRilAttachApn(), nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number GetRilAttachApn_004
|
||||
* @tc.name test function branch
|
||||
* @tc.desc Function test
|
||||
*/
|
||||
HWTEST_F(ApnManagerTest, GetRilAttachApn_004, Function | MediumTest | Level1)
|
||||
{
|
||||
std::vector<sptr<ApnItem>> allApnItem;
|
||||
sptr<ApnItem> apnItem = ApnItem::MakeDefaultApn(DATA_CONTEXT_ROLE_MMS);
|
||||
allApnItem.push_back(apnItem);
|
||||
apnManager->allApnItem_ = allApnItem;
|
||||
ASSERT_NE(apnManager->GetRilAttachApn(), nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number ReleaseDataConnection_001
|
||||
* @tc.name test function branch
|
||||
@ -1001,5 +1043,68 @@ HWTEST_F(ApnManagerTest, UpdateDefaultCellularDataSlotId_001, TestSize.Level0)
|
||||
int32_t result = CellularDataClient::GetInstance().UpdateDefaultCellularDataSlotId();
|
||||
EXPECT_EQ(result, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name : ApnItem_CanDealWithType_001
|
||||
* @tc.number: ApnItemTest_001
|
||||
* @tc.desc : Test when the type matches with the apnTypes_ then CanDealWithType returns true
|
||||
*/
|
||||
HWTEST_F(ApnManagerTest, ApnItem_CanDealWithType_001, TestSize.Level0)
|
||||
{
|
||||
ApnItem apnItem;
|
||||
apnItem.apnTypes_.push_back("default");
|
||||
EXPECT_TRUE(apnItem.CanDealWithType("default"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name : ApnItem_CanDealWithType_002
|
||||
* @tc.number: ApnItemTest_002
|
||||
* @tc.desc : Test when the type is DATA_CONTEXT_ROLE_INTERNAL_DEFAULT
|
||||
* and apnTypes_ contains DATA_CONTEXT_ROLE_DEFAULT then CanDealWithType returns true
|
||||
*/
|
||||
HWTEST_F(ApnManagerTest, ApnItem_CanDealWithType_002, TestSize.Level0)
|
||||
{
|
||||
ApnItem apnItem;
|
||||
apnItem.apnTypes_.push_back(DATA_CONTEXT_ROLE_DEFAULT);
|
||||
EXPECT_TRUE(apnItem.CanDealWithType(DATA_CONTEXT_ROLE_INTERNAL_DEFAULT));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name : ApnItem_CanDealWithType_003
|
||||
* @tc.number: ApnItemTest_003
|
||||
* @tc.desc : Test when the type is not DATA_CONTEXT_ROLE_IA and
|
||||
* apnTypes_ contains DATA_CONTEXT_ROLE_ALL then CanDealWithType returns true
|
||||
*/
|
||||
HWTEST_F(ApnManagerTest, ApnItem_CanDealWithType_003, TestSize.Level0)
|
||||
{
|
||||
ApnItem apnItem;
|
||||
apnItem.apnTypes_.push_back(DATA_CONTEXT_ROLE_ALL);
|
||||
EXPECT_TRUE(apnItem.CanDealWithType("not_ia"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name : ApnItem_CanDealWithType_004
|
||||
* @tc.number: ApnItemTest_004
|
||||
* @tc.desc : Test when the type does not match with the apnTypes_ then CanDealWithType returns false
|
||||
*/
|
||||
HWTEST_F(ApnManagerTest, ApnItem_CanDealWithType_004, TestSize.Level0)
|
||||
{
|
||||
ApnItem apnItem;
|
||||
apnItem.apnTypes_.push_back("default");
|
||||
EXPECT_FALSE(apnItem.CanDealWithType("other"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name : ApnManager_FindApnHolderById_001
|
||||
* @tc.number: ApnItemTest_004
|
||||
* @tc.desc : Test when the type does not match with the apnTypes_ then CanDealWithType returns false
|
||||
*/
|
||||
HWTEST_F(ApnManagerTest, ApnManager_FindApnHolderById_001, TestSize.Level0)
|
||||
{
|
||||
apnManager->apnIdApnHolderMap_.clear();
|
||||
EXPECT_EQ(apnManager->FindApnHolderById(0), nullptr);
|
||||
apnManager->AddApnHolder("default", 10);
|
||||
EXPECT_EQ(apnManager->FindApnTypeByApnName("abc"), static_cast<uint64_t>(ApnTypes::NONETYPE));
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
@ -224,5 +224,15 @@ HWTEST_F(CellularDataClientTest, GetSupplierRegisterState_001, TestSize.Level0)
|
||||
EXPECT_EQ(result, TELEPHONY_ERR_PERMISSION_ERR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number OnInitCellularDataController_001
|
||||
* @tc.name test function branch
|
||||
* @tc.desc Function test
|
||||
*/
|
||||
HWTEST_F(CellularDataClientTest, OnInitCellularDataController_001, TestSize.Level0)
|
||||
{
|
||||
int32_t result = CellularDataClient::GetInstance().InitCellularDataController(0);
|
||||
EXPECT_EQ(result, TELEPHONY_ERR_PERMISSION_ERR);
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
Loading…
Reference in New Issue
Block a user