From e7ade03d52bcefacd0f0be80a465067194dccfd8 Mon Sep 17 00:00:00 2001 From: lishuo Date: Tue, 22 Apr 2025 11:28:27 +0000 Subject: [PATCH 01/16] =?UTF-8?q?dt=E7=94=A8=E4=BE=8B=E8=A7=84=E8=8C=83?= =?UTF-8?q?=EF=BC=8C=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- test/unittest/imstest/ims1_test.cpp | 723 +++++++++++++--------------- 1 file changed, 347 insertions(+), 376 deletions(-) diff --git a/test/unittest/imstest/ims1_test.cpp b/test/unittest/imstest/ims1_test.cpp index 8ab35429..24eb3a44 100644 --- a/test/unittest/imstest/ims1_test.cpp +++ b/test/unittest/imstest/ims1_test.cpp @@ -161,16 +161,15 @@ HWTEST_F(Ims1Test, cellular_call_ims_test_001, Function | MediumTest | Level0) HWTEST_F(Ims1Test, cellular_call_DialCall_0001, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -182,16 +181,15 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0001, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -203,16 +201,15 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0002, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0003, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -224,16 +221,15 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0003, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0004, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -245,16 +241,15 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0004, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0005, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -266,16 +261,15 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0005, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0006, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -287,16 +281,15 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0006, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0007, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -308,16 +301,15 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0007, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0008, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -329,16 +321,15 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0008, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0009, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -350,16 +341,15 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0009, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0010, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -371,16 +361,15 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0010, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0011, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -392,16 +381,15 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0011, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0012, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -413,16 +401,15 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0012, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0013, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -434,16 +421,15 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0013, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0014, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -455,20 +441,19 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0014, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0015, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = TestDialCallByIms(SIM1_SLOTID, "*#4@3#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = TestDialCallByIms(SIM2_SLOTID, "*#4@3#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = TestDialCallByIms(SIM1_SLOTID, "*#4@3#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = TestDialCallByIms(SIM2_SLOTID, "*#4@3#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -486,26 +471,25 @@ HWTEST_F(Ims1Test, cellular_call_HangUpCall_0001, Function | MediumTest | Level2 ASSERT_TRUE(hangUpCallRemote != nullptr); auto telephonyService = iface_cast(hangUpCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_DEFAULT); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_DEFAULT); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_DEFAULT); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_DEFAULT); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -523,22 +507,21 @@ HWTEST_F(Ims1Test, cellular_call_AnswerCall_0001, Function | MediumTest | Level2 ASSERT_TRUE(answerCallRemote != nullptr); auto telephonyService = iface_cast(answerCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Answer(callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Answer(callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Answer(callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Answer(callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } } } @@ -556,22 +539,21 @@ HWTEST_F(Ims1Test, cellular_call_RejectCall_0001, Function | MediumTest | Level2 ASSERT_TRUE(rejectCallRemote != nullptr); auto telephonyService = iface_cast(rejectCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Reject(callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Reject(callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Reject(callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Reject(callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } } } @@ -589,22 +571,21 @@ HWTEST_F(Ims1Test, cellular_call_HoldCall_0001, Function | MediumTest | Level2) ASSERT_TRUE(holdCallRemote != nullptr); auto telephonyService = iface_cast(holdCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HoldCall(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HoldCall(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HoldCall(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HoldCall(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -622,22 +603,21 @@ HWTEST_F(Ims1Test, cellular_call_UnHoldCall_0001, Function | MediumTest | Level2 ASSERT_TRUE(unHoldCallRemote != nullptr); auto telephonyService = iface_cast(unHoldCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->UnHoldCall(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->UnHoldCall(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->UnHoldCall(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->UnHoldCall(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -655,22 +635,21 @@ HWTEST_F(Ims1Test, cellular_call_SwitchCall_0001, Function | MediumTest | Level2 ASSERT_TRUE(switchCallRemote != nullptr); auto telephonyService = iface_cast(switchCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SwitchCall(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SwitchCall(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SwitchCall(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SwitchCall(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -688,22 +667,21 @@ HWTEST_F(Ims1Test, cellular_call_CombineConference_0001, Function | MediumTest | ASSERT_TRUE(combineRemote != nullptr); auto telephonyService = iface_cast(combineRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->CombineConference(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->CombineConference(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->CombineConference(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->CombineConference(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -721,22 +699,21 @@ HWTEST_F(Ims1Test, cellular_call_SeparateConference_0001, Function | MediumTest ASSERT_TRUE(separateRemote != nullptr); auto telephonyService = iface_cast(separateRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SeparateConference(callInfo); - EXPECT_EQ(ret, TELEPHONY_ERR_ARGUMENT_INVALID); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SeparateConference(callInfo); - EXPECT_EQ(ret, TELEPHONY_ERR_ARGUMENT_INVALID); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SeparateConference(callInfo); + EXPECT_EQ(ret, TELEPHONY_ERR_ARGUMENT_INVALID); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SeparateConference(callInfo); + EXPECT_EQ(ret, TELEPHONY_ERR_ARGUMENT_INVALID); + } } } @@ -754,22 +731,21 @@ HWTEST_F(Ims1Test, cellular_call_KickOutFromConference_0001, Function | MediumTe ASSERT_TRUE(kickOutRemote != nullptr); auto telephonyService = iface_cast(kickOutRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->KickOutFromConference(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->KickOutFromConference(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->KickOutFromConference(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->KickOutFromConference(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -787,24 +763,23 @@ HWTEST_F(Ims1Test, cellular_call_StartDtmf_0001, Function | MediumTest | Level2) ASSERT_TRUE(startDtmfRemote != nullptr); auto telephonyService = iface_cast(startDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->StartDtmf(code, callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->StartDtmf(code, callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->StartDtmf(code, callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->StartDtmf(code, callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } } } @@ -822,22 +797,21 @@ HWTEST_F(Ims1Test, cellular_call_StopDtmf_0001, Function | MediumTest | Level2) ASSERT_TRUE(stopDtmfRemote != nullptr); auto telephonyService = iface_cast(stopDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->StopDtmf(callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->StopDtmf(callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->StopDtmf(callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->StopDtmf(callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } } } @@ -855,24 +829,23 @@ HWTEST_F(Ims1Test, cellular_call_SendDtmf_0001, Function | MediumTest | Level2) ASSERT_TRUE(sendDtmfRemote != nullptr); auto telephonyService = iface_cast(sendDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->SendDtmf(code, callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->SendDtmf(code, callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->SendDtmf(code, callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->SendDtmf(code, callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } } } @@ -890,18 +863,17 @@ HWTEST_F(Ims1Test, cellular_call_CanSetCallTransferTime_0001, Function | MediumT ASSERT_TRUE(transferRemote != nullptr); auto telephonyService = iface_cast(transferRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - bool result; - int32_t ret = telephonyService->CanSetCallTransferTime(SIM1_SLOTID, result); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - bool result; - int32_t ret = telephonyService->CanSetCallTransferTime(SIM2_SLOTID, result); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + bool result; + int32_t ret = telephonyService->CanSetCallTransferTime(SIM1_SLOTID, result); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + bool result; + int32_t ret = telephonyService->CanSetCallTransferTime(SIM2_SLOTID, result); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -920,16 +892,15 @@ HWTEST_F(Ims1Test, cellular_call_SetVoNRState_0001, Function | MediumTest | Leve ASSERT_TRUE(setVoNRRemote != nullptr); auto telephonyService = iface_cast(setVoNRRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = telephonyService->SetVoNRState(SIM1_SLOTID, 1); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = telephonyService->SetVoNRState(SIM2_SLOTID, 1); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = telephonyService->SetVoNRState(SIM1_SLOTID, 1); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = telephonyService->SetVoNRState(SIM2_SLOTID, 1); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } } // namespace Telephony -- Gitee From 3d307fb6f09804dbce247bbe4ad43301a78984b7 Mon Sep 17 00:00:00 2001 From: lishuo Date: Wed, 23 Apr 2025 01:40:08 +0000 Subject: [PATCH 02/16] =?UTF-8?q?dt=E7=94=A8=E4=BE=8B=E8=A7=84=E8=8C=83?= =?UTF-8?q?=EF=BC=8C=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- test/unittest/imstest/ims2_test.cpp | 617 ++++++++++++++-------------- 1 file changed, 298 insertions(+), 319 deletions(-) diff --git a/test/unittest/imstest/ims2_test.cpp b/test/unittest/imstest/ims2_test.cpp index a4ccfdb2..2685c332 100644 --- a/test/unittest/imstest/ims2_test.cpp +++ b/test/unittest/imstest/ims2_test.cpp @@ -142,22 +142,21 @@ void Ims2Test::TearDown(void) HWTEST_F(Ims2Test, cellular_call_SetVoNRState_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto setVoNRRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(setVoNRRemote != nullptr); - auto telephonyService = iface_cast(setVoNRRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = telephonyService->SetVoNRState(SIM1_SLOTID, 0); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = telephonyService->SetVoNRState(SIM2_SLOTID, 0); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto setVoNRRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(setVoNRRemote != nullptr); + auto telephonyService = iface_cast(setVoNRRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = telephonyService->SetVoNRState(SIM1_SLOTID, 0); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = telephonyService->SetVoNRState(SIM2_SLOTID, 0); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -175,18 +174,17 @@ HWTEST_F(Ims2Test, cellular_call_GetVoNRState_0001, Function | MediumTest | Leve ASSERT_TRUE(getVoNRRemote != nullptr); auto telephonyService = iface_cast(getVoNRRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t result; - int32_t ret = telephonyService->GetVoNRState(SIM1_SLOTID, result); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t result; - int32_t ret = telephonyService->GetVoNRState(SIM2_SLOTID, result); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID)) { + int32_t result; + int32_t ret = telephonyService->GetVoNRState(SIM1_SLOTID, result); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t result; + int32_t ret = telephonyService->GetVoNRState(SIM2_SLOTID, result); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -204,16 +202,15 @@ HWTEST_F(Ims2Test, cellular_call_StartRtt_0001, Function | MediumTest | Level2) ASSERT_TRUE(startRttRemote != nullptr); auto telephonyService = iface_cast(startRttRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - int32_t ret = telephonyService->StartRtt(SIM1_SLOTID, PHONE_NUMBER); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - int32_t ret = telephonyService->StartRtt(SIM2_SLOTID, PHONE_NUMBER); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + int32_t ret = telephonyService->StartRtt(SIM1_SLOTID, PHONE_NUMBER); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + int32_t ret = telephonyService->StartRtt(SIM2_SLOTID, PHONE_NUMBER); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -231,16 +228,15 @@ HWTEST_F(Ims2Test, cellular_call_StopRtt_0001, Function | MediumTest | Level2) ASSERT_TRUE(stopRttRemote != nullptr); auto telephonyService = iface_cast(stopRttRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - int32_t ret = telephonyService->StopRtt(SIM1_SLOTID); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - int32_t ret = telephonyService->StopRtt(SIM2_SLOTID); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + int32_t ret = telephonyService->StopRtt(SIM1_SLOTID); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + int32_t ret = telephonyService->StopRtt(SIM2_SLOTID); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -258,18 +254,17 @@ HWTEST_F(Ims2Test, cellular_call_SetDomainPreferenceMode_0001, Function | Medium ASSERT_TRUE(domainPrefModeRemote != nullptr); auto telephonyService = iface_cast(domainPrefModeRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - int32_t mode = -1; - int32_t ret = telephonyService->SetDomainPreferenceMode(SIM1_SLOTID, mode); - EXPECT_EQ(ret, CALL_ERR_PARAMETER_OUT_OF_RANGE); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - int32_t mode = -1; - int32_t ret = telephonyService->SetDomainPreferenceMode(SIM2_SLOTID, mode); - EXPECT_EQ(ret, CALL_ERR_PARAMETER_OUT_OF_RANGE); + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + int32_t mode = -1; + int32_t ret = telephonyService->SetDomainPreferenceMode(SIM1_SLOTID, mode); + EXPECT_EQ(ret, CALL_ERR_PARAMETER_OUT_OF_RANGE); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + int32_t mode = -1; + int32_t ret = telephonyService->SetDomainPreferenceMode(SIM2_SLOTID, mode); + EXPECT_EQ(ret, CALL_ERR_PARAMETER_OUT_OF_RANGE); + } } } @@ -287,18 +282,17 @@ HWTEST_F(Ims2Test, cellular_call_GetImsConfig_0001, Function | MediumTest | Leve ASSERT_TRUE(getImsConfigRemote != nullptr); auto telephonyService = iface_cast(getImsConfigRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - ImsConfigItem mode = ITEM_IMS_SWITCH_STATUS; - int32_t ret = telephonyService->GetImsConfig(SIM1_SLOTID, mode); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - ImsConfigItem mode = ITEM_IMS_SWITCH_STATUS; - int32_t ret = telephonyService->GetImsConfig(SIM2_SLOTID, mode); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + ImsConfigItem mode = ITEM_IMS_SWITCH_STATUS; + int32_t ret = telephonyService->GetImsConfig(SIM1_SLOTID, mode); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + ImsConfigItem mode = ITEM_IMS_SWITCH_STATUS; + int32_t ret = telephonyService->GetImsConfig(SIM2_SLOTID, mode); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -316,18 +310,17 @@ HWTEST_F(Ims2Test, cellular_call_GetImsFeatureValue_0001, Function | MediumTest ASSERT_TRUE(getImsFeatureRemote != nullptr); auto telephonyService = iface_cast(getImsFeatureRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - FeatureType mode = TYPE_VOICE_OVER_LTE; - int32_t ret = telephonyService->GetImsFeatureValue(SIM1_SLOTID, mode); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - FeatureType mode = TYPE_VOICE_OVER_LTE; - int32_t ret = telephonyService->GetImsFeatureValue(SIM2_SLOTID, mode); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + FeatureType mode = TYPE_VOICE_OVER_LTE; + int32_t ret = telephonyService->GetImsFeatureValue(SIM1_SLOTID, mode); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + FeatureType mode = TYPE_VOICE_OVER_LTE; + int32_t ret = telephonyService->GetImsFeatureValue(SIM2_SLOTID, mode); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -345,18 +338,17 @@ HWTEST_F(Ims2Test, cellular_call_SetMute_0001, Function | MediumTest | Level2) ASSERT_TRUE(setMuteRemote != nullptr); auto telephonyService = iface_cast(setMuteRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - int32_t mode = 0; - int32_t ret = telephonyService->SetMute(SIM1_SLOTID, mode); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - int32_t mode = 0; - int32_t ret = telephonyService->SetMute(SIM2_SLOTID, mode); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + int32_t mode = 0; + int32_t ret = telephonyService->SetMute(SIM1_SLOTID, mode); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + int32_t mode = 0; + int32_t ret = telephonyService->SetMute(SIM2_SLOTID, mode); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -374,18 +366,17 @@ HWTEST_F(Ims2Test, cellular_call_SetCallWaiting_0001, Function | MediumTest | Le ASSERT_TRUE(SetCWRemote != nullptr); auto telephonyService = iface_cast(SetCWRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - bool act = true; - int32_t ret = telephonyService->SetCallWaiting(SIM1_SLOTID, act); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - bool act = true; - int32_t ret = telephonyService->SetCallWaiting(SIM2_SLOTID, act); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + bool act = true; + int32_t ret = telephonyService->SetCallWaiting(SIM1_SLOTID, act); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + bool act = true; + int32_t ret = telephonyService->SetCallWaiting(SIM2_SLOTID, act); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -403,16 +394,15 @@ HWTEST_F(Ims2Test, cellular_call_GetCallWaiting_0001, Function | MediumTest | Le ASSERT_TRUE(getCWRemote != nullptr); auto telephonyService = iface_cast(getCWRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = telephonyService->GetCallWaiting(SIM1_SLOTID); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = telephonyService->GetCallWaiting(SIM2_SLOTID); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = telephonyService->GetCallWaiting(SIM1_SLOTID); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = telephonyService->GetCallWaiting(SIM2_SLOTID); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -430,18 +420,17 @@ HWTEST_F(Ims2Test, cellular_call_SetCallRestriction_0001, Function | MediumTest ASSERT_TRUE(setCRRemote != nullptr); auto telephonyService = iface_cast(setCRRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - CallRestrictionInfo crInfo; - int32_t ret = telephonyService->SetCallRestriction(SIM1_SLOTID, crInfo); - EXPECT_NE(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - CallRestrictionInfo crInfo; - int32_t ret = telephonyService->SetCallRestriction(SIM2_SLOTID, crInfo); - EXPECT_NE(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + CallRestrictionInfo crInfo; + int32_t ret = telephonyService->SetCallRestriction(SIM1_SLOTID, crInfo); + EXPECT_NE(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + CallRestrictionInfo crInfo; + int32_t ret = telephonyService->SetCallRestriction(SIM2_SLOTID, crInfo); + EXPECT_NE(ret, TELEPHONY_SUCCESS); + } } } @@ -459,18 +448,17 @@ HWTEST_F(Ims2Test, cellular_call_GetCallRestriction_0001, Function | MediumTest ASSERT_TRUE(getCRRemote != nullptr); auto telephonyService = iface_cast(getCRRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - CallRestrictionType facType = CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING; - int32_t ret = telephonyService->GetCallRestriction(SIM1_SLOTID, facType); - EXPECT_NE(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - CallRestrictionType facType = CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING; - int32_t ret = telephonyService->GetCallRestriction(SIM2_SLOTID, facType); - EXPECT_NE(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + CallRestrictionType facType = CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING; + int32_t ret = telephonyService->GetCallRestriction(SIM1_SLOTID, facType); + EXPECT_NE(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + CallRestrictionType facType = CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING; + int32_t ret = telephonyService->GetCallRestriction(SIM2_SLOTID, facType); + EXPECT_NE(ret, TELEPHONY_SUCCESS); + } } } @@ -488,18 +476,17 @@ HWTEST_F(Ims2Test, cellular_call_SetCallTransferInfo_0001, Function | MediumTest ASSERT_TRUE(setTransferRemote != nullptr); auto telephonyService = iface_cast(setTransferRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - CallTransferInfo ctInfo; - int32_t ret = telephonyService->SetCallTransferInfo(SIM1_SLOTID, ctInfo); - EXPECT_NE(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - CallTransferInfo ctInfo; - int32_t ret = telephonyService->SetCallTransferInfo(SIM2_SLOTID, ctInfo); - EXPECT_NE(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + CallTransferInfo ctInfo; + int32_t ret = telephonyService->SetCallTransferInfo(SIM1_SLOTID, ctInfo); + EXPECT_NE(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + CallTransferInfo ctInfo; + int32_t ret = telephonyService->SetCallTransferInfo(SIM2_SLOTID, ctInfo); + EXPECT_NE(ret, TELEPHONY_SUCCESS); + } } } @@ -517,18 +504,17 @@ HWTEST_F(Ims2Test, cellular_call_GetCallTransferInfo_0001, Function | MediumTest ASSERT_TRUE(getTransferRemote != nullptr); auto telephonyService = iface_cast(getTransferRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - CallTransferType type = CallTransferType::TRANSFER_TYPE_UNCONDITIONAL; - int32_t ret = telephonyService->GetCallTransferInfo(SIM1_SLOTID, type); - EXPECT_NE(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - CallTransferType type = CallTransferType::TRANSFER_TYPE_UNCONDITIONAL; - int32_t ret = telephonyService->GetCallTransferInfo(SIM2_SLOTID, type); - EXPECT_NE(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + CallTransferType type = CallTransferType::TRANSFER_TYPE_UNCONDITIONAL; + int32_t ret = telephonyService->GetCallTransferInfo(SIM1_SLOTID, type); + EXPECT_NE(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + CallTransferType type = CallTransferType::TRANSFER_TYPE_UNCONDITIONAL; + int32_t ret = telephonyService->GetCallTransferInfo(SIM2_SLOTID, type); + EXPECT_NE(ret, TELEPHONY_SUCCESS); + } } } @@ -544,42 +530,41 @@ HWTEST_F(Ims2Test, cellular_call_ImsControl_0001, Function | MediumTest | Level3 ASSERT_TRUE(systemAbilityMgr != nullptr); auto imsControlRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); ASSERT_TRUE(imsControlRemote != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto imsControl = std::make_shared(); - CellularCallInfo cellularCallInfo; - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId) || !CanUseImsService(slotId, ImsServiceType::TYPE_VOICE)) { - continue; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + auto imsControl = std::make_shared(); + CellularCallInfo cellularCallInfo; + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId) || !CanUseImsService(slotId, ImsServiceType::TYPE_VOICE)) { + continue; + } + EXPECT_NE(imsControl->Answer(cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_NE(imsControl->Reject(cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER, cellularCallInfo), TELEPHONY_SUCCESS); + bool enabled = false; + EXPECT_EQ(imsControl->Dial(cellularCallInfo, enabled), CALL_ERR_GET_RADIO_STATE_FAILED); + CLIRMode mode = CLIRMode::DEFAULT; + EXPECT_EQ(imsControl->DialJudgment(slotId, PHONE_NUMBER_SECOND, mode, 0), TELEPHONY_SUCCESS); + EXPECT_EQ(imsControl->DialJudgment(slotId, PHONE_NUMBER_THIRD, mode, 0), TELEPHONY_SUCCESS); + EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_SECOND, cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_NE(imsControl->Answer(cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_THIRD, cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_NE(imsControl->Answer(cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_FOUR, cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_NE(imsControl->Answer(cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_NE(imsControl->Reject(cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_EQ(imsControl->HoldCall(slotId), TELEPHONY_SUCCESS); + std::vector numberList; + EXPECT_EQ(imsControl->KickOutFromConference(slotId, PHONE_NUMBER, cellularCallInfo.index), TELEPHONY_SUCCESS); + EXPECT_EQ(imsControl->InviteToConference(slotId, numberList), TELEPHONY_SUCCESS); + EXPECT_EQ(imsControl->StartRtt(slotId, PHONE_NUMBER), TELEPHONY_SUCCESS); + EXPECT_EQ(imsControl->StopRtt(slotId), TELEPHONY_SUCCESS); + EXPECT_NE(imsControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_DEFAULT), TELEPHONY_SUCCESS); + EXPECT_EQ(imsControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE), + CALL_ERR_RESOURCE_UNAVAILABLE); + EXPECT_EQ(imsControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ALL), TELEPHONY_SUCCESS); + EXPECT_EQ(imsControl->HangUp(cellularCallInfo, static_cast(INVALID_HANG_UP_TYPE)), + TELEPHONY_ERR_ARGUMENT_INVALID); } - EXPECT_NE(imsControl->Answer(cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_NE(imsControl->Reject(cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER, cellularCallInfo), TELEPHONY_SUCCESS); - bool enabled = false; - EXPECT_EQ(imsControl->Dial(cellularCallInfo, enabled), CALL_ERR_GET_RADIO_STATE_FAILED); - CLIRMode mode = CLIRMode::DEFAULT; - EXPECT_EQ(imsControl->DialJudgment(slotId, PHONE_NUMBER_SECOND, mode, 0), TELEPHONY_SUCCESS); - EXPECT_EQ(imsControl->DialJudgment(slotId, PHONE_NUMBER_THIRD, mode, 0), TELEPHONY_SUCCESS); - EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_SECOND, cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_NE(imsControl->Answer(cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_THIRD, cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_NE(imsControl->Answer(cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_FOUR, cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_NE(imsControl->Answer(cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_NE(imsControl->Reject(cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_EQ(imsControl->HoldCall(slotId), TELEPHONY_SUCCESS); - std::vector numberList; - EXPECT_EQ(imsControl->KickOutFromConference(slotId, PHONE_NUMBER, cellularCallInfo.index), TELEPHONY_SUCCESS); - EXPECT_EQ(imsControl->InviteToConference(slotId, numberList), TELEPHONY_SUCCESS); - EXPECT_EQ(imsControl->StartRtt(slotId, PHONE_NUMBER), TELEPHONY_SUCCESS); - EXPECT_EQ(imsControl->StopRtt(slotId), TELEPHONY_SUCCESS); - EXPECT_NE(imsControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_DEFAULT), TELEPHONY_SUCCESS); - EXPECT_EQ(imsControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE), - CALL_ERR_RESOURCE_UNAVAILABLE); - EXPECT_EQ(imsControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ALL), TELEPHONY_SUCCESS); - EXPECT_EQ(imsControl->HangUp(cellularCallInfo, static_cast(INVALID_HANG_UP_TYPE)), - TELEPHONY_ERR_ARGUMENT_INVALID); } } @@ -646,26 +631,25 @@ HWTEST_F(Ims2Test, cellular_call_CellularCallConnectionIMS_0001, Function | Medi ASSERT_TRUE(systemAbilityMgr != nullptr); auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); ASSERT_TRUE(remote != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId) || !CanUseImsService(slotId, ImsServiceType::TYPE_VOICE)) { - continue; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId) || !CanUseImsService(slotId, ImsServiceType::TYPE_VOICE)) { + continue; + } + CellularCallConnectionIMS imsConnection; + EXPECT_EQ(imsConnection.SendDtmfRequest(slotId, '1', 1), TELEPHONY_SUCCESS); + EXPECT_EQ(imsConnection.StartDtmfRequest(slotId, '1', 1), TELEPHONY_SUCCESS); + EXPECT_EQ(imsConnection.StopDtmfRequest(slotId, 1), TELEPHONY_SUCCESS); + EXPECT_EQ(imsConnection.GetImsCallsDataRequest(slotId, 1), TELEPHONY_SUCCESS); + EXPECT_EQ(imsConnection.GetCallFailReasonRequest(slotId), TELEPHONY_SUCCESS); + EXPECT_EQ(imsConnection.AnswerRequest(slotId, PHONE_NUMBER, 0, slotId), TELEPHONY_SUCCESS); + ImsDialInfoStruct imsDialInfo; + imsDialInfo.phoneNum = PHONE_NUMBER_SECOND; + EXPECT_EQ(imsConnection.DialRequest(slotId, imsDialInfo), TELEPHONY_SUCCESS); + EXPECT_EQ(imsConnection.HangUpRequest(slotId, PHONE_NUMBER_SECOND, slotId), TELEPHONY_SUCCESS); + EXPECT_EQ(imsConnection.StartRttRequest(slotId, PHONE_NUMBER_THIRD), TELEPHONY_SUCCESS); + EXPECT_EQ(imsConnection.StopRttRequest(slotId), TELEPHONY_SUCCESS); } - CellularCallConnectionIMS imsConnection; - EXPECT_EQ(imsConnection.SendDtmfRequest(slotId, '1', 1), TELEPHONY_SUCCESS); - EXPECT_EQ(imsConnection.StartDtmfRequest(slotId, '1', 1), TELEPHONY_SUCCESS); - EXPECT_EQ(imsConnection.StopDtmfRequest(slotId, 1), TELEPHONY_SUCCESS); - EXPECT_EQ(imsConnection.GetImsCallsDataRequest(slotId, 1), TELEPHONY_SUCCESS); - EXPECT_EQ(imsConnection.GetCallFailReasonRequest(slotId), TELEPHONY_SUCCESS); - EXPECT_EQ(imsConnection.AnswerRequest(slotId, PHONE_NUMBER, 0, slotId), TELEPHONY_SUCCESS); - ImsDialInfoStruct imsDialInfo; - imsDialInfo.phoneNum = PHONE_NUMBER_SECOND; - EXPECT_EQ(imsConnection.DialRequest(slotId, imsDialInfo), TELEPHONY_SUCCESS); - EXPECT_EQ(imsConnection.HangUpRequest(slotId, PHONE_NUMBER_SECOND, slotId), TELEPHONY_SUCCESS); - EXPECT_EQ(imsConnection.StartRttRequest(slotId, PHONE_NUMBER_THIRD), TELEPHONY_SUCCESS); - EXPECT_EQ(imsConnection.StopRttRequest(slotId), TELEPHONY_SUCCESS); } } @@ -680,28 +664,27 @@ HWTEST_F(Ims2Test, cellular_call_CellularCallRegister_0001, Function | MediumTes ASSERT_TRUE(systemAbilityMgr != nullptr); auto registerRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); ASSERT_TRUE(registerRemote != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + auto callRegister = DelayedSingleton::GetInstance(); + ASSERT_TRUE(callRegister != nullptr); + GetImsConfigResponse imsConfigResponse; + callRegister->ReportGetImsConfigResult(imsConfigResponse); + callRegister->ReportSetImsConfigResult(RESULT); + GetImsFeatureValueResponse imsFeatureValueResponse; + callRegister->ReportGetImsFeatureResult(imsFeatureValueResponse); + callRegister->ReportSetImsFeatureResult(RESULT); + ImsCallModeReceiveInfo callModeInfo; + callRegister->ReceiveUpdateCallMediaModeRequest(-1, callModeInfo); + callRegister->ReceiveUpdateCallMediaModeResponse(-1, callModeInfo); + ImsCallSessionEventInfo callSessionEventInfo; + callRegister->HandleCallSessionEventChanged(callSessionEventInfo); + ImsCallPeerDimensionsInfo callPeerDimensionsInfo; + callRegister->HandlePeerDimensionsChanged(callPeerDimensionsInfo); + ImsCallDataUsageInfo callDataUsageInfo; + callRegister->HandleCallDataUsageChanged(callDataUsageInfo); + CameraCapabilitiesInfo cameraCapabilitiesInfo; + callRegister->HandleCameraCapabilitiesChanged(cameraCapabilitiesInfo); } - auto callRegister = DelayedSingleton::GetInstance(); - ASSERT_TRUE(callRegister != nullptr); - GetImsConfigResponse imsConfigResponse; - callRegister->ReportGetImsConfigResult(imsConfigResponse); - callRegister->ReportSetImsConfigResult(RESULT); - GetImsFeatureValueResponse imsFeatureValueResponse; - callRegister->ReportGetImsFeatureResult(imsFeatureValueResponse); - callRegister->ReportSetImsFeatureResult(RESULT); - ImsCallModeReceiveInfo callModeInfo; - callRegister->ReceiveUpdateCallMediaModeRequest(-1, callModeInfo); - callRegister->ReceiveUpdateCallMediaModeResponse(-1, callModeInfo); - ImsCallSessionEventInfo callSessionEventInfo; - callRegister->HandleCallSessionEventChanged(callSessionEventInfo); - ImsCallPeerDimensionsInfo callPeerDimensionsInfo; - callRegister->HandlePeerDimensionsChanged(callPeerDimensionsInfo); - ImsCallDataUsageInfo callDataUsageInfo; - callRegister->HandleCallDataUsageChanged(callDataUsageInfo); - CameraCapabilitiesInfo cameraCapabilitiesInfo; - callRegister->HandleCameraCapabilitiesChanged(cameraCapabilitiesInfo); } /** @@ -743,39 +726,37 @@ HWTEST_F(Ims2Test, cellular_call_CellularCallRegister_0002, Function | MediumTes */ HWTEST_F(Ims2Test, cellular_call_CellularCallConfig_0001, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + CellularCallConfig cellularCallConfig; + ASSERT_TRUE(cellularCallConfig.GetImsSwitchOnByDefaultConfig(INVALID_SLOTID)); + ASSERT_TRUE(cellularCallConfig.GetImsSwitchOnByDefaultConfig(slotId)); + ASSERT_FALSE(cellularCallConfig.GethideImsSwitchConfig(INVALID_SLOTID)); + ASSERT_FALSE(cellularCallConfig.GethideImsSwitchConfig(slotId)); + ASSERT_FALSE(cellularCallConfig.GetvolteSupportedConfig(INVALID_SLOTID)); + ASSERT_FALSE(cellularCallConfig.GetvolteSupportedConfig(slotId)); + cellularCallConfig.GetNrModeSupportedListConfig(INVALID_SLOTID); + cellularCallConfig.GetNrModeSupportedListConfig(slotId); + ASSERT_FALSE(cellularCallConfig.GetVolteProvisioningSupportedConfig(INVALID_SLOTID)); + ASSERT_FALSE(cellularCallConfig.GetVolteProvisioningSupportedConfig(slotId)); + ASSERT_FALSE(cellularCallConfig.GetSsOverUtSupportedConfig(INVALID_SLOTID)); + ASSERT_FALSE(cellularCallConfig.GetSsOverUtSupportedConfig(slotId)); + ASSERT_FALSE(cellularCallConfig.GetImsGbaRequiredConfig(INVALID_SLOTID)); + ASSERT_FALSE(cellularCallConfig.GetImsGbaRequiredConfig(slotId)); + ASSERT_FALSE(cellularCallConfig.GetUtProvisioningSupportedConfig(INVALID_SLOTID)); + ASSERT_FALSE(cellularCallConfig.GetUtProvisioningSupportedConfig(slotId)); + ASSERT_TRUE(cellularCallConfig.GetImsPreferForEmergencyConfig(INVALID_SLOTID)); + ASSERT_TRUE(cellularCallConfig.GetImsPreferForEmergencyConfig(slotId)); + cellularCallConfig.GetCallWaitingServiceClassConfig(INVALID_SLOTID); + cellularCallConfig.GetCallWaitingServiceClassConfig(slotId); + cellularCallConfig.GetImsCallDisconnectResoninfoMappingConfig(INVALID_SLOTID); + cellularCallConfig.GetImsCallDisconnectResoninfoMappingConfig(slotId); + ASSERT_FALSE(cellularCallConfig.GetForceVolteSwitchOnConfig(INVALID_SLOTID)); + ASSERT_FALSE(cellularCallConfig.GetForceVolteSwitchOnConfig(slotId)); } - CellularCallConfig cellularCallConfig; - ASSERT_TRUE(cellularCallConfig.GetImsSwitchOnByDefaultConfig(INVALID_SLOTID)); - ASSERT_TRUE(cellularCallConfig.GetImsSwitchOnByDefaultConfig(slotId)); - ASSERT_FALSE(cellularCallConfig.GethideImsSwitchConfig(INVALID_SLOTID)); - ASSERT_FALSE(cellularCallConfig.GethideImsSwitchConfig(slotId)); - ASSERT_FALSE(cellularCallConfig.GetvolteSupportedConfig(INVALID_SLOTID)); - ASSERT_FALSE(cellularCallConfig.GetvolteSupportedConfig(slotId)); - cellularCallConfig.GetNrModeSupportedListConfig(INVALID_SLOTID); - cellularCallConfig.GetNrModeSupportedListConfig(slotId); - ASSERT_FALSE(cellularCallConfig.GetVolteProvisioningSupportedConfig(INVALID_SLOTID)); - ASSERT_FALSE(cellularCallConfig.GetVolteProvisioningSupportedConfig(slotId)); - ASSERT_FALSE(cellularCallConfig.GetSsOverUtSupportedConfig(INVALID_SLOTID)); - ASSERT_FALSE(cellularCallConfig.GetSsOverUtSupportedConfig(slotId)); - ASSERT_FALSE(cellularCallConfig.GetImsGbaRequiredConfig(INVALID_SLOTID)); - ASSERT_FALSE(cellularCallConfig.GetImsGbaRequiredConfig(slotId)); - ASSERT_FALSE(cellularCallConfig.GetUtProvisioningSupportedConfig(INVALID_SLOTID)); - ASSERT_FALSE(cellularCallConfig.GetUtProvisioningSupportedConfig(slotId)); - ASSERT_TRUE(cellularCallConfig.GetImsPreferForEmergencyConfig(INVALID_SLOTID)); - ASSERT_TRUE(cellularCallConfig.GetImsPreferForEmergencyConfig(slotId)); - cellularCallConfig.GetCallWaitingServiceClassConfig(INVALID_SLOTID); - cellularCallConfig.GetCallWaitingServiceClassConfig(slotId); - cellularCallConfig.GetImsCallDisconnectResoninfoMappingConfig(INVALID_SLOTID); - cellularCallConfig.GetImsCallDisconnectResoninfoMappingConfig(slotId); - ASSERT_FALSE(cellularCallConfig.GetForceVolteSwitchOnConfig(INVALID_SLOTID)); - ASSERT_FALSE(cellularCallConfig.GetForceVolteSwitchOnConfig(slotId)); } } @@ -826,38 +807,37 @@ HWTEST_F(Ims2Test, cellular_call_CellularCallHandler_0001, Function | MediumTest matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED); EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills); CellularCallHandler handler { subscriberInfo }; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; - } - handler.SetSlotId(slotId); - auto event = AppExecFwk::InnerEvent::Get(0); - handler.GetImsCallsDataResponse(event); - handler.GetImsCallsDataRequest(event); - auto rilRadioResponse = std::make_shared(); - rilRadioResponse->error = ErrType::ERR_GENERIC_FAILURE; - auto responseEvent = AppExecFwk::InnerEvent::Get(0, rilRadioResponse); - handler.SetDomainPreferenceModeResponse(responseEvent); - handler.GetDomainPreferenceModeResponse(event); - handler.SetDomainPreferenceModeResponse(event); - handler.SetVoNRSwitchStatusResponse(responseEvent); - handler.NvCfgFinishedIndication(responseEvent); - handler.GetImsCapabilities(slotId); - handler.GetImsCapResponse(responseEvent); - ASSERT_EQ(handler.GetSlotId(), slotId); - handler.OnRilAdapterHostDied(event); - auto serviceInstance = DelayedSingleton::GetInstance(); - if (serviceInstance != nullptr) { - std::shared_ptr csControl; - serviceInstance->SetCsControl(slotId, csControl); - std::shared_ptr imsControl; - serviceInstance->SetImsControl(slotId, imsControl); + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + handler.SetSlotId(slotId); + auto event = AppExecFwk::InnerEvent::Get(0); + handler.GetImsCallsDataResponse(event); + handler.GetImsCallsDataRequest(event); + auto rilRadioResponse = std::make_shared(); + rilRadioResponse->error = ErrType::ERR_GENERIC_FAILURE; + auto responseEvent = AppExecFwk::InnerEvent::Get(0, rilRadioResponse); + handler.SetDomainPreferenceModeResponse(responseEvent); + handler.GetDomainPreferenceModeResponse(event); + handler.SetDomainPreferenceModeResponse(event); + handler.SetVoNRSwitchStatusResponse(responseEvent); + handler.NvCfgFinishedIndication(responseEvent); + handler.GetImsCapabilities(slotId); + handler.GetImsCapResponse(responseEvent); + ASSERT_EQ(handler.GetSlotId(), slotId); handler.OnRilAdapterHostDied(event); - ASSERT_TRUE(serviceInstance->GetCsControl(slotId) == nullptr); - ASSERT_TRUE(serviceInstance->GetCsControl(slotId) == nullptr); + auto serviceInstance = DelayedSingleton::GetInstance(); + if (serviceInstance != nullptr) { + std::shared_ptr csControl; + serviceInstance->SetCsControl(slotId, csControl); + std::shared_ptr imsControl; + serviceInstance->SetImsControl(slotId, imsControl); + handler.OnRilAdapterHostDied(event); + ASSERT_TRUE(serviceInstance->GetCsControl(slotId) == nullptr); + ASSERT_TRUE(serviceInstance->GetCsControl(slotId) == nullptr); + } } } } @@ -873,22 +853,21 @@ HWTEST_F(Ims2Test, cellular_call_CellularCallHandler_0002, Function | MediumTest matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED); EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills); CellularCallHandler handler { subscriberInfo }; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + handler.SetSlotId(slotId); + auto event = AppExecFwk::InnerEvent::Get(0); + handler.ReceiveUpdateCallMediaModeRequest(event); + handler.ReceiveUpdateCallMediaModeResponse(event); + handler.HandleCallSessionEventChanged(event); + handler.HandlePeerDimensionsChanged(event); + handler.HandleCallDataUsageChanged(event); + handler.HandleCameraCapabilitiesChanged(event); + EXPECT_TRUE(event != nullptr); } - handler.SetSlotId(slotId); - auto event = AppExecFwk::InnerEvent::Get(0); - handler.ReceiveUpdateCallMediaModeRequest(event); - handler.ReceiveUpdateCallMediaModeResponse(event); - handler.HandleCallSessionEventChanged(event); - handler.HandlePeerDimensionsChanged(event); - handler.HandleCallDataUsageChanged(event); - handler.HandleCameraCapabilitiesChanged(event); - EXPECT_TRUE(event != nullptr); } } -- Gitee From ab9fc4fc1b51f1600d6fb6ad97c93bf0783e4431 Mon Sep 17 00:00:00 2001 From: lishuo Date: Wed, 23 Apr 2025 01:48:59 +0000 Subject: [PATCH 03/16] =?UTF-8?q?dt=E7=94=A8=E4=BE=8B=E8=A7=84=E8=8C=83?= =?UTF-8?q?=EF=BC=8C=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- .../imstest/ims_callback_stub_test.cpp | 970 +++++++++--------- 1 file changed, 478 insertions(+), 492 deletions(-) diff --git a/test/unittest/imstest/ims_callback_stub_test.cpp b/test/unittest/imstest/ims_callback_stub_test.cpp index 2d7328e7..481ab1b3 100644 --- a/test/unittest/imstest/ims_callback_stub_test.cpp +++ b/test/unittest/imstest/ims_callback_stub_test.cpp @@ -139,50 +139,49 @@ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0001, Function | { sptr stub = (std::make_unique()).release(); ASSERT_TRUE(stub != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + RadioResponseInfo rilRadioResponse; + rilRadioResponse.error = ErrType::ERR_GENERIC_FAILURE; + MessageParcel answerData; + MessageParcel answerReply; + ASSERT_TRUE(answerData.WriteInt32(slotId)); + ASSERT_TRUE(answerData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stub->OnAnswerResponseInner(answerData, answerReply), TELEPHONY_SUCCESS); + + MessageParcel dialData; + MessageParcel dialReply; + ASSERT_TRUE(dialData.WriteInt32(slotId)); + ASSERT_TRUE(dialData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stub->OnDialResponseInner(dialData, dialReply), TELEPHONY_SUCCESS); + + MessageParcel imsCallsData; + MessageParcel imsCallsReply; + ASSERT_TRUE(imsCallsData.WriteInt32(slotId)); + ASSERT_TRUE(imsCallsData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stub->OnGetImsCallsDataResponseInner(imsCallsData, imsCallsReply), TELEPHONY_SUCCESS); + + MessageParcel hangupData; + MessageParcel hangupReply; + ASSERT_TRUE(hangupData.WriteInt32(slotId)); + ASSERT_TRUE(hangupData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stub->OnHangUpResponseInner(hangupData, hangupReply), TELEPHONY_SUCCESS); + + MessageParcel holdCallData; + MessageParcel holdCallReply; + ASSERT_TRUE(holdCallData.WriteInt32(slotId)); + ASSERT_TRUE(holdCallData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stub->OnHoldCallResponseInner(holdCallData, holdCallReply), TELEPHONY_SUCCESS); + + MessageParcel rejectData; + MessageParcel rejectReply; + ASSERT_TRUE(rejectData.WriteInt32(slotId)); + ASSERT_TRUE(rejectData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stub->OnRejectResponseInner(rejectData, rejectReply), TELEPHONY_SUCCESS); } - RadioResponseInfo rilRadioResponse; - rilRadioResponse.error = ErrType::ERR_GENERIC_FAILURE; - MessageParcel answerData; - MessageParcel answerReply; - ASSERT_TRUE(answerData.WriteInt32(slotId)); - ASSERT_TRUE(answerData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stub->OnAnswerResponseInner(answerData, answerReply), TELEPHONY_SUCCESS); - - MessageParcel dialData; - MessageParcel dialReply; - ASSERT_TRUE(dialData.WriteInt32(slotId)); - ASSERT_TRUE(dialData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stub->OnDialResponseInner(dialData, dialReply), TELEPHONY_SUCCESS); - - MessageParcel imsCallsData; - MessageParcel imsCallsReply; - ASSERT_TRUE(imsCallsData.WriteInt32(slotId)); - ASSERT_TRUE(imsCallsData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stub->OnGetImsCallsDataResponseInner(imsCallsData, imsCallsReply), TELEPHONY_SUCCESS); - - MessageParcel hangupData; - MessageParcel hangupReply; - ASSERT_TRUE(hangupData.WriteInt32(slotId)); - ASSERT_TRUE(hangupData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stub->OnHangUpResponseInner(hangupData, hangupReply), TELEPHONY_SUCCESS); - - MessageParcel holdCallData; - MessageParcel holdCallReply; - ASSERT_TRUE(holdCallData.WriteInt32(slotId)); - ASSERT_TRUE(holdCallData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stub->OnHoldCallResponseInner(holdCallData, holdCallReply), TELEPHONY_SUCCESS); - - MessageParcel rejectData; - MessageParcel rejectReply; - ASSERT_TRUE(rejectData.WriteInt32(slotId)); - ASSERT_TRUE(rejectData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stub->OnRejectResponseInner(rejectData, rejectReply), TELEPHONY_SUCCESS); } } @@ -193,58 +192,57 @@ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0001, Function | */ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0002, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - sptr stubTestTwo = (std::make_unique()).release(); - ASSERT_TRUE(stubTestTwo != nullptr); - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + sptr stubTestTwo = (std::make_unique()).release(); + ASSERT_TRUE(stubTestTwo != nullptr); + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + RadioResponseInfo rilRadioResponse; + rilRadioResponse.error = ErrType::ERR_GENERIC_FAILURE; + MessageParcel sendDtmfData; + MessageParcel sendDtmfReply; + ASSERT_TRUE(sendDtmfData.WriteInt32(slotId)); + ASSERT_TRUE(sendDtmfData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_GE(stubTestTwo->OnSendDtmfResponseInner(sendDtmfData, sendDtmfReply), TELEPHONY_SUCCESS); + + MessageParcel setImsSwitchData; + MessageParcel setImsSwitchReply; + ASSERT_TRUE(setImsSwitchData.WriteInt32(slotId)); + ASSERT_TRUE(setImsSwitchData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stubTestTwo->OnSetImsSwitchResponseInner(setImsSwitchData, setImsSwitchReply), TELEPHONY_SUCCESS); + + MessageParcel startDtmfData; + MessageParcel startDtmfReply; + ASSERT_TRUE(startDtmfData.WriteInt32(slotId)); + ASSERT_TRUE(startDtmfData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stubTestTwo->OnStartDtmfResponseInner(startDtmfData, startDtmfReply), TELEPHONY_SUCCESS); + + MessageParcel stopDtmfData; + MessageParcel stopDtmfReply; + ASSERT_TRUE(stopDtmfData.WriteInt32(slotId)); + ASSERT_TRUE(stopDtmfData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stubTestTwo->OnStopDtmfResponseInner(stopDtmfData, stopDtmfReply), TELEPHONY_SUCCESS); + + MessageParcel switchCallData; + MessageParcel switchCallReply; + ASSERT_TRUE(switchCallData.WriteInt32(slotId)); + ASSERT_TRUE(switchCallData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stubTestTwo->OnSwitchCallResponseInner(switchCallData, switchCallReply), TELEPHONY_SUCCESS); + + MessageParcel unholdData; + MessageParcel unholdReply; + ASSERT_TRUE(unholdData.WriteInt32(slotId)); + ASSERT_TRUE(unholdData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stubTestTwo->OnUnHoldCallResponseInner(unholdData, unholdReply), TELEPHONY_SUCCESS); + + MessageParcel getImsSwitchData; + MessageParcel getImsSwitchReply; + ASSERT_TRUE(getImsSwitchData.WriteInt32(slotId)); + ASSERT_TRUE(getImsSwitchData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stubTestTwo->OnGetImsSwitchResponseInner(getImsSwitchData, getImsSwitchReply), TELEPHONY_SUCCESS); } - RadioResponseInfo rilRadioResponse; - rilRadioResponse.error = ErrType::ERR_GENERIC_FAILURE; - MessageParcel sendDtmfData; - MessageParcel sendDtmfReply; - ASSERT_TRUE(sendDtmfData.WriteInt32(slotId)); - ASSERT_TRUE(sendDtmfData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_GE(stubTestTwo->OnSendDtmfResponseInner(sendDtmfData, sendDtmfReply), TELEPHONY_SUCCESS); - - MessageParcel setImsSwitchData; - MessageParcel setImsSwitchReply; - ASSERT_TRUE(setImsSwitchData.WriteInt32(slotId)); - ASSERT_TRUE(setImsSwitchData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stubTestTwo->OnSetImsSwitchResponseInner(setImsSwitchData, setImsSwitchReply), TELEPHONY_SUCCESS); - - MessageParcel startDtmfData; - MessageParcel startDtmfReply; - ASSERT_TRUE(startDtmfData.WriteInt32(slotId)); - ASSERT_TRUE(startDtmfData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stubTestTwo->OnStartDtmfResponseInner(startDtmfData, startDtmfReply), TELEPHONY_SUCCESS); - - MessageParcel stopDtmfData; - MessageParcel stopDtmfReply; - ASSERT_TRUE(stopDtmfData.WriteInt32(slotId)); - ASSERT_TRUE(stopDtmfData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stubTestTwo->OnStopDtmfResponseInner(stopDtmfData, stopDtmfReply), TELEPHONY_SUCCESS); - - MessageParcel switchCallData; - MessageParcel switchCallReply; - ASSERT_TRUE(switchCallData.WriteInt32(slotId)); - ASSERT_TRUE(switchCallData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stubTestTwo->OnSwitchCallResponseInner(switchCallData, switchCallReply), TELEPHONY_SUCCESS); - - MessageParcel unholdData; - MessageParcel unholdReply; - ASSERT_TRUE(unholdData.WriteInt32(slotId)); - ASSERT_TRUE(unholdData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stubTestTwo->OnUnHoldCallResponseInner(unholdData, unholdReply), TELEPHONY_SUCCESS); - - MessageParcel getImsSwitchData; - MessageParcel getImsSwitchReply; - ASSERT_TRUE(getImsSwitchData.WriteInt32(slotId)); - ASSERT_TRUE(getImsSwitchData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stubTestTwo->OnGetImsSwitchResponseInner(getImsSwitchData, getImsSwitchReply), TELEPHONY_SUCCESS); } } @@ -255,41 +253,39 @@ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0002, Function | */ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0003, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - - sptr stubTestThree = (std::make_unique()).release(); - ASSERT_TRUE(stubTestThree != nullptr); - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + sptr stubTestThree = (std::make_unique()).release(); + ASSERT_TRUE(stubTestThree != nullptr); + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + MessageParcel data; + MessageParcel reply; + ASSERT_TRUE(data.WriteInt32(slotId)); + ASSERT_NE(stubTestThree->OnAnswerResponseInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnCallRingBackReportInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnDialResponseInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnHangUpResponseInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnHoldCallResponseInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnRejectResponseInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnSendDtmfResponseInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnSetImsSwitchResponseInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnStartDtmfResponseInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnStopDtmfResponseInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnSwitchCallResponseInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnUnHoldCallResponseInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnSetMuteResponseInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnCombineConferenceResponseInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnInviteToConferenceResponseInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnReceiveUpdateCallMediaModeRequestInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnReceiveUpdateCallMediaModeResponseInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnCallSessionEventChangedInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnPeerDimensionsChangedInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnCallDataUsageChangedInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnCameraCapabilitiesChangedInner(data, reply), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestThree->OnGetImsCapResponseInner(data, reply), TELEPHONY_SUCCESS); } - MessageParcel data; - MessageParcel reply; - ASSERT_TRUE(data.WriteInt32(slotId)); - ASSERT_NE(stubTestThree->OnAnswerResponseInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnCallRingBackReportInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnDialResponseInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnHangUpResponseInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnHoldCallResponseInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnRejectResponseInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnSendDtmfResponseInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnSetImsSwitchResponseInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnStartDtmfResponseInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnStopDtmfResponseInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnSwitchCallResponseInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnUnHoldCallResponseInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnSetMuteResponseInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnCombineConferenceResponseInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnInviteToConferenceResponseInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnReceiveUpdateCallMediaModeRequestInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnReceiveUpdateCallMediaModeResponseInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnCallSessionEventChangedInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnPeerDimensionsChangedInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnCallDataUsageChangedInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnCameraCapabilitiesChangedInner(data, reply), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestThree->OnGetImsCapResponseInner(data, reply), TELEPHONY_SUCCESS); } } @@ -300,52 +296,51 @@ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0003, Function | */ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0004, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - sptr stubTestFour = (std::make_unique()).release(); - ASSERT_TRUE(stubTestFour != nullptr); - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + sptr stubTestFour = (std::make_unique()).release(); + ASSERT_TRUE(stubTestFour != nullptr); + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + SsBaseResult normalResult; + normalResult.index = DEFAULT_INDEX; + MessageParcel crData; + MessageParcel crReply; + ASSERT_TRUE(crData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsBaseResult(crData, normalResult), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestFour->OnSetCallRestrictionResponseInner(crData, crReply), TELEPHONY_SUCCESS); + MessageParcel ctData; + MessageParcel ctReply; + ASSERT_TRUE(ctData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsBaseResult(ctData, normalResult), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestFour->OnSetCallTransferResponseInner(ctData, ctReply), TELEPHONY_SUCCESS); + MessageParcel cwData; + MessageParcel cwReply; + ASSERT_TRUE(cwData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsBaseResult(cwData, normalResult), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestFour->OnSetCallWaitingResponseInner(cwData, cwReply), TELEPHONY_SUCCESS); + MessageParcel clipData; + MessageParcel clipReply; + ASSERT_TRUE(clipData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsBaseResult(clipData, normalResult), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestFour->OnSetClipResponseInner(clipData, clipReply), TELEPHONY_SUCCESS); + MessageParcel clirData; + MessageParcel clirReply; + ASSERT_TRUE(clirData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsBaseResult(clirData, normalResult), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestFour->OnSetClirResponseInner(clirData, clirReply), TELEPHONY_SUCCESS); + MessageParcel colpData; + MessageParcel colpReply; + ASSERT_TRUE(colpData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsBaseResult(colpData, normalResult), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestFour->OnSetColpResponseInner(colpData, colpReply), TELEPHONY_SUCCESS); + MessageParcel colrData; + MessageParcel colrReply; + ASSERT_TRUE(colrData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsBaseResult(colrData, normalResult), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestFour->OnSetColrResponseInner(colrData, colrReply), TELEPHONY_SUCCESS); } - SsBaseResult normalResult; - normalResult.index = DEFAULT_INDEX; - MessageParcel crData; - MessageParcel crReply; - ASSERT_TRUE(crData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsBaseResult(crData, normalResult), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestFour->OnSetCallRestrictionResponseInner(crData, crReply), TELEPHONY_SUCCESS); - MessageParcel ctData; - MessageParcel ctReply; - ASSERT_TRUE(ctData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsBaseResult(ctData, normalResult), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestFour->OnSetCallTransferResponseInner(ctData, ctReply), TELEPHONY_SUCCESS); - MessageParcel cwData; - MessageParcel cwReply; - ASSERT_TRUE(cwData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsBaseResult(cwData, normalResult), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestFour->OnSetCallWaitingResponseInner(cwData, cwReply), TELEPHONY_SUCCESS); - MessageParcel clipData; - MessageParcel clipReply; - ASSERT_TRUE(clipData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsBaseResult(clipData, normalResult), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestFour->OnSetClipResponseInner(clipData, clipReply), TELEPHONY_SUCCESS); - MessageParcel clirData; - MessageParcel clirReply; - ASSERT_TRUE(clirData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsBaseResult(clirData, normalResult), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestFour->OnSetClirResponseInner(clirData, clirReply), TELEPHONY_SUCCESS); - MessageParcel colpData; - MessageParcel colpReply; - ASSERT_TRUE(colpData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsBaseResult(colpData, normalResult), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestFour->OnSetColpResponseInner(colpData, colpReply), TELEPHONY_SUCCESS); - MessageParcel colrData; - MessageParcel colrReply; - ASSERT_TRUE(colrData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsBaseResult(colrData, normalResult), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestFour->OnSetColrResponseInner(colrData, colrReply), TELEPHONY_SUCCESS); } } @@ -356,52 +351,51 @@ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0004, Function | */ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0005, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - sptr stubTestFive = (std::make_unique()).release(); - ASSERT_TRUE(stubTestFive != nullptr); - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + sptr stubTestFive = (std::make_unique()).release(); + ASSERT_TRUE(stubTestFive != nullptr); + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + SsBaseResult normalResult; + normalResult.index = INVALID_INDEX; + MessageParcel crData; + MessageParcel crReply; + ASSERT_TRUE(crData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsBaseResult(crData, normalResult), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestFive->OnSetCallRestrictionResponseInner(crData, crReply), TELEPHONY_SUCCESS); + MessageParcel ctData; + MessageParcel ctReply; + ASSERT_TRUE(ctData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsBaseResult(ctData, normalResult), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestFive->OnSetCallTransferResponseInner(ctData, ctReply), TELEPHONY_SUCCESS); + MessageParcel cwData; + MessageParcel cwReply; + ASSERT_TRUE(cwData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsBaseResult(cwData, normalResult), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestFive->OnSetCallWaitingResponseInner(cwData, cwReply), TELEPHONY_SUCCESS); + MessageParcel clipData; + MessageParcel clipReply; + ASSERT_TRUE(clipData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsBaseResult(clipData, normalResult), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestFive->OnSetClipResponseInner(clipData, clipReply), TELEPHONY_SUCCESS); + MessageParcel clirData; + MessageParcel clirReply; + ASSERT_TRUE(clirData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsBaseResult(clirData, normalResult), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestFive->OnSetClirResponseInner(clirData, clirReply), TELEPHONY_SUCCESS); + MessageParcel colpData; + MessageParcel colpReply; + ASSERT_TRUE(colpData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsBaseResult(colpData, normalResult), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestFive->OnSetColpResponseInner(colpData, colpReply), TELEPHONY_SUCCESS); + MessageParcel colrData; + MessageParcel colrReply; + ASSERT_TRUE(colrData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsBaseResult(colrData, normalResult), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestFive->OnSetColrResponseInner(colrData, colrReply), TELEPHONY_SUCCESS); } - SsBaseResult normalResult; - normalResult.index = INVALID_INDEX; - MessageParcel crData; - MessageParcel crReply; - ASSERT_TRUE(crData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsBaseResult(crData, normalResult), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestFive->OnSetCallRestrictionResponseInner(crData, crReply), TELEPHONY_SUCCESS); - MessageParcel ctData; - MessageParcel ctReply; - ASSERT_TRUE(ctData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsBaseResult(ctData, normalResult), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestFive->OnSetCallTransferResponseInner(ctData, ctReply), TELEPHONY_SUCCESS); - MessageParcel cwData; - MessageParcel cwReply; - ASSERT_TRUE(cwData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsBaseResult(cwData, normalResult), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestFive->OnSetCallWaitingResponseInner(cwData, cwReply), TELEPHONY_SUCCESS); - MessageParcel clipData; - MessageParcel clipReply; - ASSERT_TRUE(clipData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsBaseResult(clipData, normalResult), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestFive->OnSetClipResponseInner(clipData, clipReply), TELEPHONY_SUCCESS); - MessageParcel clirData; - MessageParcel clirReply; - ASSERT_TRUE(clirData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsBaseResult(clirData, normalResult), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestFive->OnSetClirResponseInner(clirData, clirReply), TELEPHONY_SUCCESS); - MessageParcel colpData; - MessageParcel colpReply; - ASSERT_TRUE(colpData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsBaseResult(colpData, normalResult), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestFive->OnSetColpResponseInner(colpData, colpReply), TELEPHONY_SUCCESS); - MessageParcel colrData; - MessageParcel colrReply; - ASSERT_TRUE(colrData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsBaseResult(colrData, normalResult), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestFive->OnSetColrResponseInner(colrData, colrReply), TELEPHONY_SUCCESS); } } @@ -414,39 +408,38 @@ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0006, Function | { sptr stubTestSix = (std::make_unique()).release(); ASSERT_TRUE(stubTestSix != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + SsBaseResult ssBaseResult; + ssBaseResult.index = DEFAULT_INDEX; + ssBaseResult.result = IMS_ERROR_UT_CS_FALLBACK; + ASSERT_NE(stubTestSix->SetCallRestrictionResponse(slotId, ssBaseResult), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestSix->SetCallTransferResponse(slotId, ssBaseResult), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestSix->SetCallWaitingResponse(slotId, ssBaseResult), TELEPHONY_SUCCESS); + ASSERT_NE(stubTestSix->SetClirResponse(slotId, ssBaseResult), TELEPHONY_SUCCESS); + MessageParcel muteData; + MessageParcel muteReply; + MuteControlResponse muteResponse; + ASSERT_TRUE(muteData.WriteInt32(slotId)); + ASSERT_TRUE(muteData.WriteRawData((const void *)&muteResponse, sizeof(MuteControlResponse))); + ASSERT_EQ(stubTestSix->OnSetMuteResponseInner(muteData, muteReply), TELEPHONY_SUCCESS); + MessageParcel ringData; + MessageParcel ringReply; + RingbackVoice ringback; + ASSERT_TRUE(ringData.WriteInt32(slotId)); + ASSERT_TRUE(ringData.WriteRawData((const void *)&ringback, sizeof(RingbackVoice))); + ASSERT_EQ(stubTestSix->OnCallRingBackReportInner(ringData, ringReply), TELEPHONY_SUCCESS); + MessageParcel failData; + MessageParcel failReply; + DisconnectedDetails details; + ASSERT_TRUE(failData.WriteInt32(slotId)); + ASSERT_TRUE(failData.WriteInt32(static_cast(details.reason))); + ASSERT_TRUE(failData.WriteString(details.message)); + ASSERT_EQ(stubTestSix->OnLastCallFailReasonResponseInner(failData, failReply), TELEPHONY_SUCCESS); } - SsBaseResult ssBaseResult; - ssBaseResult.index = DEFAULT_INDEX; - ssBaseResult.result = IMS_ERROR_UT_CS_FALLBACK; - ASSERT_NE(stubTestSix->SetCallRestrictionResponse(slotId, ssBaseResult), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestSix->SetCallTransferResponse(slotId, ssBaseResult), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestSix->SetCallWaitingResponse(slotId, ssBaseResult), TELEPHONY_SUCCESS); - ASSERT_NE(stubTestSix->SetClirResponse(slotId, ssBaseResult), TELEPHONY_SUCCESS); - MessageParcel muteData; - MessageParcel muteReply; - MuteControlResponse muteResponse; - ASSERT_TRUE(muteData.WriteInt32(slotId)); - ASSERT_TRUE(muteData.WriteRawData((const void *)&muteResponse, sizeof(MuteControlResponse))); - ASSERT_EQ(stubTestSix->OnSetMuteResponseInner(muteData, muteReply), TELEPHONY_SUCCESS); - MessageParcel ringData; - MessageParcel ringReply; - RingbackVoice ringback; - ASSERT_TRUE(ringData.WriteInt32(slotId)); - ASSERT_TRUE(ringData.WriteRawData((const void *)&ringback, sizeof(RingbackVoice))); - ASSERT_EQ(stubTestSix->OnCallRingBackReportInner(ringData, ringReply), TELEPHONY_SUCCESS); - MessageParcel failData; - MessageParcel failReply; - DisconnectedDetails details; - ASSERT_TRUE(failData.WriteInt32(slotId)); - ASSERT_TRUE(failData.WriteInt32(static_cast(details.reason))); - ASSERT_TRUE(failData.WriteString(details.message)); - ASSERT_EQ(stubTestSix->OnLastCallFailReasonResponseInner(failData, failReply), TELEPHONY_SUCCESS); } } @@ -457,48 +450,47 @@ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0006, Function | */ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0007, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - sptr stubTestSeven = (std::make_unique()).release(); - ASSERT_TRUE(stubTestSeven != nullptr); - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + sptr stubTestSeven = (std::make_unique()).release(); + ASSERT_TRUE(stubTestSeven != nullptr); + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + CallRestrictionResult crResult; + crResult.result.index = INVALID_INDEX; + MessageParcel crErrorData; + MessageParcel crErrorReply; + ASSERT_TRUE(crErrorData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsResult(crErrorData, crResult.result, crResult.status, crResult.classCw), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestSeven->OnGetCallRestrictionResponseInner(crErrorData, crErrorReply), TELEPHONY_SUCCESS); + + crResult.result.index = DEFAULT_INDEX; + MessageParcel crData; + MessageParcel crReply; + ASSERT_TRUE(crData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsResult(crData, crResult.result, crResult.status, crResult.classCw), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestSeven->OnGetCallRestrictionResponseInner(crData, crReply), TELEPHONY_SUCCESS); + crResult.result.result = IMS_ERROR_UT_CS_FALLBACK; + ASSERT_NE(stubTestSeven->GetCallRestrictionResponse(slotId, crResult), TELEPHONY_SUCCESS); + + CallForwardQueryInfoList callList; + callList.result.index = INVALID_INDEX; + MessageParcel ctErrorData; + MessageParcel ctErrorReply; + ASSERT_TRUE(ctErrorData.WriteInt32(slotId)); + ASSERT_EQ(WriteCallForwardResult(ctErrorData, callList), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestSeven->OnGetCallTransferResponseInner(ctErrorData, ctErrorReply), TELEPHONY_SUCCESS); + + callList.result.index = DEFAULT_INDEX; + MessageParcel ctData; + MessageParcel ctReply; + ASSERT_TRUE(ctData.WriteInt32(slotId)); + ASSERT_EQ(WriteCallForwardResult(ctData, callList), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestSeven->OnGetCallTransferResponseInner(ctData, ctReply), TELEPHONY_SUCCESS); + callList.result.result = IMS_ERROR_UT_CS_FALLBACK; + ASSERT_NE(stubTestSeven->GetCallTransferResponse(slotId, callList), TELEPHONY_SUCCESS); } - CallRestrictionResult crResult; - crResult.result.index = INVALID_INDEX; - MessageParcel crErrorData; - MessageParcel crErrorReply; - ASSERT_TRUE(crErrorData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsResult(crErrorData, crResult.result, crResult.status, crResult.classCw), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestSeven->OnGetCallRestrictionResponseInner(crErrorData, crErrorReply), TELEPHONY_SUCCESS); - - crResult.result.index = DEFAULT_INDEX; - MessageParcel crData; - MessageParcel crReply; - ASSERT_TRUE(crData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsResult(crData, crResult.result, crResult.status, crResult.classCw), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestSeven->OnGetCallRestrictionResponseInner(crData, crReply), TELEPHONY_SUCCESS); - crResult.result.result = IMS_ERROR_UT_CS_FALLBACK; - ASSERT_NE(stubTestSeven->GetCallRestrictionResponse(slotId, crResult), TELEPHONY_SUCCESS); - - CallForwardQueryInfoList callList; - callList.result.index = INVALID_INDEX; - MessageParcel ctErrorData; - MessageParcel ctErrorReply; - ASSERT_TRUE(ctErrorData.WriteInt32(slotId)); - ASSERT_EQ(WriteCallForwardResult(ctErrorData, callList), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestSeven->OnGetCallTransferResponseInner(ctErrorData, ctErrorReply), TELEPHONY_SUCCESS); - - callList.result.index = DEFAULT_INDEX; - MessageParcel ctData; - MessageParcel ctReply; - ASSERT_TRUE(ctData.WriteInt32(slotId)); - ASSERT_EQ(WriteCallForwardResult(ctData, callList), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestSeven->OnGetCallTransferResponseInner(ctData, ctReply), TELEPHONY_SUCCESS); - callList.result.result = IMS_ERROR_UT_CS_FALLBACK; - ASSERT_NE(stubTestSeven->GetCallTransferResponse(slotId, callList), TELEPHONY_SUCCESS); } } @@ -509,50 +501,49 @@ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0007, Function | */ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0008, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - sptr stubTestEigth = (std::make_unique()).release(); - ASSERT_TRUE(stubTestEigth != nullptr); - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + sptr stubTestEigth = (std::make_unique()).release(); + ASSERT_TRUE(stubTestEigth != nullptr); + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + CallWaitResult cwResult; + cwResult.result.index = INVALID_INDEX; + MessageParcel cwErrorData; + MessageParcel cwErrorReply; + ASSERT_TRUE(cwErrorData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsResult(cwErrorData, cwResult.result, cwResult.status, cwResult.classCw), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestEigth->OnGetCallWaitingResponseInner(cwErrorData, cwErrorReply), TELEPHONY_SUCCESS); + + cwResult.result.index = DEFAULT_INDEX; + MessageParcel cwData; + MessageParcel cwReply; + ASSERT_TRUE(cwData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsResult(cwData, cwResult.result, cwResult.status, cwResult.classCw), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestEigth->OnGetCallWaitingResponseInner(cwData, cwReply), TELEPHONY_SUCCESS); + cwResult.result.result = IMS_ERROR_UT_CS_FALLBACK; + ASSERT_NE(stubTestEigth->GetCallWaitingResponse(slotId, cwResult), TELEPHONY_SUCCESS); + + GetClipResult clipResult; + clipResult.result.index = INVALID_INDEX; + MessageParcel clipErrorData; + MessageParcel clipErrorReply; + ASSERT_TRUE(clipErrorData.WriteInt32(slotId)); + ASSERT_EQ( + WriteSsResult(clipErrorData, clipResult.result, clipResult.action, clipResult.clipStat), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestEigth->OnGetClipResponseInner(clipErrorData, clipErrorReply), TELEPHONY_SUCCESS); + + clipResult.result.index = DEFAULT_INDEX; + MessageParcel clipData; + MessageParcel clipReply; + ASSERT_TRUE(clipData.WriteInt32(slotId)); + ASSERT_EQ( + WriteSsResult(clipData, clipResult.result, clipResult.action, clipResult.clipStat), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestEigth->OnGetClipResponseInner(clipData, clipReply), TELEPHONY_SUCCESS); + clipResult.result.result = IMS_ERROR_UT_CS_FALLBACK; + ASSERT_NE(stubTestEigth->GetClipResponse(slotId, clipResult), TELEPHONY_SUCCESS); } - CallWaitResult cwResult; - cwResult.result.index = INVALID_INDEX; - MessageParcel cwErrorData; - MessageParcel cwErrorReply; - ASSERT_TRUE(cwErrorData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsResult(cwErrorData, cwResult.result, cwResult.status, cwResult.classCw), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestEigth->OnGetCallWaitingResponseInner(cwErrorData, cwErrorReply), TELEPHONY_SUCCESS); - - cwResult.result.index = DEFAULT_INDEX; - MessageParcel cwData; - MessageParcel cwReply; - ASSERT_TRUE(cwData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsResult(cwData, cwResult.result, cwResult.status, cwResult.classCw), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestEigth->OnGetCallWaitingResponseInner(cwData, cwReply), TELEPHONY_SUCCESS); - cwResult.result.result = IMS_ERROR_UT_CS_FALLBACK; - ASSERT_NE(stubTestEigth->GetCallWaitingResponse(slotId, cwResult), TELEPHONY_SUCCESS); - - GetClipResult clipResult; - clipResult.result.index = INVALID_INDEX; - MessageParcel clipErrorData; - MessageParcel clipErrorReply; - ASSERT_TRUE(clipErrorData.WriteInt32(slotId)); - ASSERT_EQ( - WriteSsResult(clipErrorData, clipResult.result, clipResult.action, clipResult.clipStat), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestEigth->OnGetClipResponseInner(clipErrorData, clipErrorReply), TELEPHONY_SUCCESS); - - clipResult.result.index = DEFAULT_INDEX; - MessageParcel clipData; - MessageParcel clipReply; - ASSERT_TRUE(clipData.WriteInt32(slotId)); - ASSERT_EQ( - WriteSsResult(clipData, clipResult.result, clipResult.action, clipResult.clipStat), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestEigth->OnGetClipResponseInner(clipData, clipReply), TELEPHONY_SUCCESS); - clipResult.result.result = IMS_ERROR_UT_CS_FALLBACK; - ASSERT_NE(stubTestEigth->GetClipResponse(slotId, clipResult), TELEPHONY_SUCCESS); } } @@ -563,50 +554,49 @@ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0008, Function | */ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0009, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - sptr stubTestNight = (std::make_unique()).release(); - ASSERT_TRUE(stubTestNight != nullptr); - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + sptr stubTestNight = (std::make_unique()).release(); + ASSERT_TRUE(stubTestNight != nullptr); + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + GetClirResult clirResult; + clirResult.result.index = INVALID_INDEX; + MessageParcel clirErrorData; + MessageParcel clirErrorReply; + ASSERT_TRUE(clirErrorData.WriteInt32(slotId)); + ASSERT_EQ( + WriteSsResult(clirErrorData, clirResult.result, clirResult.action, clirResult.clirStat), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestNight->OnGetClirResponseInner(clirErrorData, clirErrorReply), TELEPHONY_SUCCESS); + + clirResult.result.index = DEFAULT_INDEX; + MessageParcel clirData; + MessageParcel clirReply; + ASSERT_TRUE(clirData.WriteInt32(slotId)); + ASSERT_EQ( + WriteSsResult(clirData, clirResult.result, clirResult.action, clirResult.clirStat), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestNight->OnGetClirResponseInner(clirData, clirReply), TELEPHONY_SUCCESS); + clirResult.result.result = IMS_ERROR_UT_CS_FALLBACK; + ASSERT_NE(stubTestNight->GetClirResponse(slotId, clirResult), TELEPHONY_SUCCESS); + + GetColpResult colpResult; + colpResult.result.index = INVALID_INDEX; + MessageParcel colpErrorData; + MessageParcel colpErrorReply; + ASSERT_TRUE(colpErrorData.WriteInt32(slotId)); + ASSERT_EQ( + WriteSsResult(colpErrorData, colpResult.result, colpResult.action, colpResult.colpStat), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestNight->OnGetColpResponseInner(colpErrorData, colpErrorReply), TELEPHONY_SUCCESS); + + colpResult.result.index = DEFAULT_INDEX; + MessageParcel colpData; + MessageParcel colpReply; + ASSERT_TRUE(colpData.WriteInt32(slotId)); + ASSERT_EQ( + WriteSsResult(colpData, colpResult.result, colpResult.action, colpResult.colpStat), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestNight->OnGetColpResponseInner(colpData, colpReply), TELEPHONY_SUCCESS); } - GetClirResult clirResult; - clirResult.result.index = INVALID_INDEX; - MessageParcel clirErrorData; - MessageParcel clirErrorReply; - ASSERT_TRUE(clirErrorData.WriteInt32(slotId)); - ASSERT_EQ( - WriteSsResult(clirErrorData, clirResult.result, clirResult.action, clirResult.clirStat), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestNight->OnGetClirResponseInner(clirErrorData, clirErrorReply), TELEPHONY_SUCCESS); - - clirResult.result.index = DEFAULT_INDEX; - MessageParcel clirData; - MessageParcel clirReply; - ASSERT_TRUE(clirData.WriteInt32(slotId)); - ASSERT_EQ( - WriteSsResult(clirData, clirResult.result, clirResult.action, clirResult.clirStat), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestNight->OnGetClirResponseInner(clirData, clirReply), TELEPHONY_SUCCESS); - clirResult.result.result = IMS_ERROR_UT_CS_FALLBACK; - ASSERT_NE(stubTestNight->GetClirResponse(slotId, clirResult), TELEPHONY_SUCCESS); - - GetColpResult colpResult; - colpResult.result.index = INVALID_INDEX; - MessageParcel colpErrorData; - MessageParcel colpErrorReply; - ASSERT_TRUE(colpErrorData.WriteInt32(slotId)); - ASSERT_EQ( - WriteSsResult(colpErrorData, colpResult.result, colpResult.action, colpResult.colpStat), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestNight->OnGetColpResponseInner(colpErrorData, colpErrorReply), TELEPHONY_SUCCESS); - - colpResult.result.index = DEFAULT_INDEX; - MessageParcel colpData; - MessageParcel colpReply; - ASSERT_TRUE(colpData.WriteInt32(slotId)); - ASSERT_EQ( - WriteSsResult(colpData, colpResult.result, colpResult.action, colpResult.colpStat), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestNight->OnGetColpResponseInner(colpData, colpReply), TELEPHONY_SUCCESS); } } @@ -617,52 +607,50 @@ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0009, Function | */ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0010, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - - sptr stubTestTen = (std::make_unique()).release(); - ASSERT_TRUE(stubTestTen != nullptr); - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + sptr stubTestTen = (std::make_unique()).release(); + ASSERT_TRUE(stubTestTen != nullptr); + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + GetColrResult colrResult; + colrResult.result.index = INVALID_INDEX; + MessageParcel colrErrorData; + MessageParcel colrErrorReply; + ASSERT_TRUE(colrErrorData.WriteInt32(slotId)); + ASSERT_EQ( + WriteSsResult(colrErrorData, colrResult.result, colrResult.action, colrResult.colrStat), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestTen->OnGetColrResponseInner(colrErrorData, colrErrorReply), TELEPHONY_SUCCESS); + + colrResult.result.index = DEFAULT_INDEX; + MessageParcel colrData; + MessageParcel colrReply; + ASSERT_TRUE(colrData.WriteInt32(slotId)); + ASSERT_EQ( + WriteSsResult(colrData, colrResult.result, colrResult.action, colrResult.colrStat), TELEPHONY_SUCCESS); + ASSERT_EQ(stubTestTen->OnGetColrResponseInner(colrData, colrReply), TELEPHONY_SUCCESS); + + SsBaseResult normalResult; + normalResult.index = DEFAULT_INDEX; + MessageParcel ctErrorData; + MessageParcel ctReply; + ASSERT_TRUE(ctErrorData.WriteInt32(slotId)); + ASSERT_EQ(WriteSsBaseResult(ctErrorData, normalResult), TELEPHONY_SUCCESS); + ASSERT_TRUE(ctErrorData.WriteInt32(INVALID_INDEX)); + ASSERT_TRUE(ctErrorData.WriteInt32(INVALID_INDEX)); + ASSERT_TRUE(ctErrorData.WriteInt32(INVALID_INDEX)); + ASSERT_NE(stubTestTen->OnGetCallTransferResponseInner(ctErrorData, ctReply), TELEPHONY_SUCCESS); + + MessageParcel icErrorData; + MessageParcel icReply; + ASSERT_TRUE(icErrorData.WriteInt32(slotId)); + ASSERT_TRUE(icErrorData.WriteInt32(INVALID_INDEX)); + ASSERT_TRUE(icErrorData.WriteInt32(INVALID_INDEX)); + ASSERT_TRUE(icErrorData.WriteInt32(INVALID_INDEX)); + ASSERT_TRUE(icErrorData.WriteInt32(INVALID_INDEX)); + ASSERT_NE(stubTestTen->OnGetImsCallsDataResponseInner(icErrorData, icReply), TELEPHONY_SUCCESS); } - GetColrResult colrResult; - colrResult.result.index = INVALID_INDEX; - MessageParcel colrErrorData; - MessageParcel colrErrorReply; - ASSERT_TRUE(colrErrorData.WriteInt32(slotId)); - ASSERT_EQ( - WriteSsResult(colrErrorData, colrResult.result, colrResult.action, colrResult.colrStat), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestTen->OnGetColrResponseInner(colrErrorData, colrErrorReply), TELEPHONY_SUCCESS); - - colrResult.result.index = DEFAULT_INDEX; - MessageParcel colrData; - MessageParcel colrReply; - ASSERT_TRUE(colrData.WriteInt32(slotId)); - ASSERT_EQ( - WriteSsResult(colrData, colrResult.result, colrResult.action, colrResult.colrStat), TELEPHONY_SUCCESS); - ASSERT_EQ(stubTestTen->OnGetColrResponseInner(colrData, colrReply), TELEPHONY_SUCCESS); - - SsBaseResult normalResult; - normalResult.index = DEFAULT_INDEX; - MessageParcel ctErrorData; - MessageParcel ctReply; - ASSERT_TRUE(ctErrorData.WriteInt32(slotId)); - ASSERT_EQ(WriteSsBaseResult(ctErrorData, normalResult), TELEPHONY_SUCCESS); - ASSERT_TRUE(ctErrorData.WriteInt32(INVALID_INDEX)); - ASSERT_TRUE(ctErrorData.WriteInt32(INVALID_INDEX)); - ASSERT_TRUE(ctErrorData.WriteInt32(INVALID_INDEX)); - ASSERT_NE(stubTestTen->OnGetCallTransferResponseInner(ctErrorData, ctReply), TELEPHONY_SUCCESS); - - MessageParcel icErrorData; - MessageParcel icReply; - ASSERT_TRUE(icErrorData.WriteInt32(slotId)); - ASSERT_TRUE(icErrorData.WriteInt32(INVALID_INDEX)); - ASSERT_TRUE(icErrorData.WriteInt32(INVALID_INDEX)); - ASSERT_TRUE(icErrorData.WriteInt32(INVALID_INDEX)); - ASSERT_TRUE(icErrorData.WriteInt32(INVALID_INDEX)); - ASSERT_NE(stubTestTen->OnGetImsCallsDataResponseInner(icErrorData, icReply), TELEPHONY_SUCCESS); } } @@ -673,42 +661,41 @@ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0010, Function | */ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0011, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - sptr stubTestEleven = (std::make_unique()).release(); - ASSERT_TRUE(stubTestEleven != nullptr); - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + sptr stubTestEleven = (std::make_unique()).release(); + ASSERT_TRUE(stubTestEleven != nullptr); + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + MessageParcel callModeReceiveRequestData; + MessageParcel callModeReceiveRequestReply; + ImsCallModeReceiveInfo callModeReceiveRequesInfo; + callModeReceiveRequesInfo.callIndex = DEFAULT_INDEX; + ASSERT_TRUE(callModeReceiveRequestData.WriteInt32(slotId)); + ASSERT_TRUE(callModeReceiveRequestData.WriteRawData( + (const void *)&callModeReceiveRequesInfo, sizeof(ImsCallModeReceiveInfo))); + ASSERT_EQ(stubTestEleven->OnReceiveUpdateCallMediaModeRequestInner( + callModeReceiveRequestData, callModeReceiveRequestReply), TELEPHONY_SUCCESS); + MessageParcel callModeReceiveResponseData; + MessageParcel callModeReceiveResponseReply; + ImsCallModeReceiveInfo callModeReceiveResponseInfo; + callModeReceiveResponseInfo.callIndex = DEFAULT_INDEX; + ASSERT_TRUE(callModeReceiveResponseData.WriteInt32(slotId)); + ASSERT_TRUE(callModeReceiveResponseData.WriteRawData( + (const void *)&callModeReceiveResponseInfo, sizeof(ImsCallModeReceiveInfo))); + ASSERT_EQ(stubTestEleven->OnReceiveUpdateCallMediaModeResponseInner( + callModeReceiveResponseData, callModeReceiveResponseReply), TELEPHONY_SUCCESS); + MessageParcel callSessionEventInfoData; + MessageParcel callSessionEventInfoReply; + ImsCallSessionEventInfo callSessionEventInfo; + callSessionEventInfo.callIndex = DEFAULT_INDEX; + ASSERT_TRUE(callSessionEventInfoData.WriteInt32(slotId)); + ASSERT_TRUE(callSessionEventInfoData.WriteRawData( + (const void *)&callSessionEventInfo, sizeof(ImsCallSessionEventInfo))); + ASSERT_EQ(stubTestEleven->OnCallSessionEventChangedInner( + callSessionEventInfoData, callSessionEventInfoReply), TELEPHONY_SUCCESS); } - MessageParcel callModeReceiveRequestData; - MessageParcel callModeReceiveRequestReply; - ImsCallModeReceiveInfo callModeReceiveRequesInfo; - callModeReceiveRequesInfo.callIndex = DEFAULT_INDEX; - ASSERT_TRUE(callModeReceiveRequestData.WriteInt32(slotId)); - ASSERT_TRUE(callModeReceiveRequestData.WriteRawData( - (const void *)&callModeReceiveRequesInfo, sizeof(ImsCallModeReceiveInfo))); - ASSERT_EQ(stubTestEleven->OnReceiveUpdateCallMediaModeRequestInner( - callModeReceiveRequestData, callModeReceiveRequestReply), TELEPHONY_SUCCESS); - MessageParcel callModeReceiveResponseData; - MessageParcel callModeReceiveResponseReply; - ImsCallModeReceiveInfo callModeReceiveResponseInfo; - callModeReceiveResponseInfo.callIndex = DEFAULT_INDEX; - ASSERT_TRUE(callModeReceiveResponseData.WriteInt32(slotId)); - ASSERT_TRUE(callModeReceiveResponseData.WriteRawData( - (const void *)&callModeReceiveResponseInfo, sizeof(ImsCallModeReceiveInfo))); - ASSERT_EQ(stubTestEleven->OnReceiveUpdateCallMediaModeResponseInner( - callModeReceiveResponseData, callModeReceiveResponseReply), TELEPHONY_SUCCESS); - MessageParcel callSessionEventInfoData; - MessageParcel callSessionEventInfoReply; - ImsCallSessionEventInfo callSessionEventInfo; - callSessionEventInfo.callIndex = DEFAULT_INDEX; - ASSERT_TRUE(callSessionEventInfoData.WriteInt32(slotId)); - ASSERT_TRUE(callSessionEventInfoData.WriteRawData( - (const void *)&callSessionEventInfo, sizeof(ImsCallSessionEventInfo))); - ASSERT_EQ(stubTestEleven->OnCallSessionEventChangedInner( - callSessionEventInfoData, callSessionEventInfoReply), TELEPHONY_SUCCESS); } } @@ -719,42 +706,41 @@ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0011, Function | */ HWTEST_F(ImsCallbackStubTest, cellular_call_ImsCallCallbackStub_0012, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - sptr stubTestEleven = (std::make_unique()).release(); - ASSERT_TRUE(stubTestEleven != nullptr); - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + sptr stubTestEleven = (std::make_unique()).release(); + ASSERT_TRUE(stubTestEleven != nullptr); + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + MessageParcel callPeerDimensionsInfoData; + MessageParcel callPeerDimensionsInfoReply; + ImsCallPeerDimensionsInfo callPeerDimensionsInfo; + callPeerDimensionsInfo.callIndex = DEFAULT_INDEX; + ASSERT_TRUE(callPeerDimensionsInfoData.WriteInt32(slotId)); + ASSERT_TRUE(callPeerDimensionsInfoData.WriteRawData( + (const void *)&callPeerDimensionsInfo, sizeof(ImsCallPeerDimensionsInfo))); + ASSERT_EQ(stubTestEleven->OnPeerDimensionsChangedInner( + callPeerDimensionsInfoData, callPeerDimensionsInfoReply), TELEPHONY_SUCCESS); + MessageParcel callDataUsageInfoData; + MessageParcel callDataUsageInfoReply; + ImsCallDataUsageInfo callDataUsageInfo; + callDataUsageInfo.callIndex = DEFAULT_INDEX; + ASSERT_TRUE(callDataUsageInfoData.WriteInt32(slotId)); + ASSERT_TRUE(callDataUsageInfoData.WriteRawData( + (const void *)&callDataUsageInfo, sizeof(ImsCallDataUsageInfo))); + ASSERT_EQ(stubTestEleven->OnCallDataUsageChangedInner( + callDataUsageInfoData, callDataUsageInfoReply), TELEPHONY_SUCCESS); + MessageParcel cameraCapabilitiesInfoData; + MessageParcel cameraCapabilitiesInfoReply; + CameraCapabilitiesInfo cameraCapabilitiesInfo; + cameraCapabilitiesInfo.callIndex = DEFAULT_INDEX; + ASSERT_TRUE(cameraCapabilitiesInfoData.WriteInt32(slotId)); + ASSERT_TRUE(cameraCapabilitiesInfoData.WriteRawData( + (const void *)&cameraCapabilitiesInfo, sizeof(CameraCapabilitiesInfo))); + ASSERT_EQ(stubTestEleven->OnCameraCapabilitiesChangedInner( + cameraCapabilitiesInfoData, cameraCapabilitiesInfoReply), TELEPHONY_SUCCESS); } - MessageParcel callPeerDimensionsInfoData; - MessageParcel callPeerDimensionsInfoReply; - ImsCallPeerDimensionsInfo callPeerDimensionsInfo; - callPeerDimensionsInfo.callIndex = DEFAULT_INDEX; - ASSERT_TRUE(callPeerDimensionsInfoData.WriteInt32(slotId)); - ASSERT_TRUE(callPeerDimensionsInfoData.WriteRawData( - (const void *)&callPeerDimensionsInfo, sizeof(ImsCallPeerDimensionsInfo))); - ASSERT_EQ(stubTestEleven->OnPeerDimensionsChangedInner( - callPeerDimensionsInfoData, callPeerDimensionsInfoReply), TELEPHONY_SUCCESS); - MessageParcel callDataUsageInfoData; - MessageParcel callDataUsageInfoReply; - ImsCallDataUsageInfo callDataUsageInfo; - callDataUsageInfo.callIndex = DEFAULT_INDEX; - ASSERT_TRUE(callDataUsageInfoData.WriteInt32(slotId)); - ASSERT_TRUE(callDataUsageInfoData.WriteRawData( - (const void *)&callDataUsageInfo, sizeof(ImsCallDataUsageInfo))); - ASSERT_EQ(stubTestEleven->OnCallDataUsageChangedInner( - callDataUsageInfoData, callDataUsageInfoReply), TELEPHONY_SUCCESS); - MessageParcel cameraCapabilitiesInfoData; - MessageParcel cameraCapabilitiesInfoReply; - CameraCapabilitiesInfo cameraCapabilitiesInfo; - cameraCapabilitiesInfo.callIndex = DEFAULT_INDEX; - ASSERT_TRUE(cameraCapabilitiesInfoData.WriteInt32(slotId)); - ASSERT_TRUE(cameraCapabilitiesInfoData.WriteRawData( - (const void *)&cameraCapabilitiesInfo, sizeof(CameraCapabilitiesInfo))); - ASSERT_EQ(stubTestEleven->OnCameraCapabilitiesChangedInner( - cameraCapabilitiesInfoData, cameraCapabilitiesInfoReply), TELEPHONY_SUCCESS); } } /** -- Gitee From ba6accd8a5b1e98dafa05ee79053429eafdbf999 Mon Sep 17 00:00:00 2001 From: lishuo Date: Wed, 23 Apr 2025 02:13:30 +0000 Subject: [PATCH 04/16] =?UTF-8?q?dt=E7=94=A8=E4=BE=8B=E8=A7=84=E8=8C=83?= =?UTF-8?q?=EF=BC=8C=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- test/unittest/cstest/cs1_test.cpp | 936 ++++++++++++++---------------- 1 file changed, 450 insertions(+), 486 deletions(-) diff --git a/test/unittest/cstest/cs1_test.cpp b/test/unittest/cstest/cs1_test.cpp index fe1cb3d0..9c24dce5 100644 --- a/test/unittest/cstest/cs1_test.cpp +++ b/test/unittest/cstest/cs1_test.cpp @@ -120,38 +120,38 @@ void Cs1Test::JudgeIsEmergencyPhoneNumber() auto telephonyService = iface_cast(remote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - bool enabled = false; - int32_t successCode = 1; - if (HasSimCard(SIM1_SLOTID)) { - telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "499", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "443", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "356", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "975", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "783", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "350", enabled); - EXPECT_NE(enabled, successCode); - } - if (HasSimCard(SIM2_SLOTID)) { - telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "499", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "443", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "356", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "975", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "783", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "350", enabled); - EXPECT_NE(enabled, successCode); + + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { + bool enabled = false; + int32_t successCode = 1; + if (HasSimCard(SIM1_SLOTID)) { + telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "499", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "443", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "356", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "975", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "783", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "350", enabled); + EXPECT_NE(enabled, successCode); + } + if (HasSimCard(SIM2_SLOTID)) { + telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "499", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "443", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "356", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "975", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "783", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "350", enabled); + EXPECT_NE(enabled, successCode); + } } } @@ -223,35 +223,33 @@ HWTEST_F(Cs1Test, cellular_call_SetEmergencyCallList_0101, Function | MediumTest ASSERT_TRUE(telephonyService != nullptr); if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - - std::vector eccVec; - EmergencyCall temp0 = { "499", "460", EccType::TYPE_CATEGORY, SimpresentType::TYPE_NO_CARD, - AbnormalServiceType::TYPE_ALL }; - EmergencyCall temp1 = { "443", "460", EccType::TYPE_POLICE, SimpresentType::TYPE_NO_CARD, - AbnormalServiceType::TYPE_ALL }; - EmergencyCall temp2 = { "356", "460", EccType::TYPE_AMBULANCE, SimpresentType::TYPE_NO_CARD, - AbnormalServiceType::TYPE_ALL }; - EmergencyCall temp3 = { "783", "460", EccType::TYPE_FIRE, SimpresentType::TYPE_NO_CARD, - AbnormalServiceType::TYPE_ALL }; - EmergencyCall temp4 = { "975", "460", EccType::TYPE_SEA, SimpresentType::TYPE_HAS_CARD, - AbnormalServiceType::TYPE_ONLY_CS }; - EmergencyCall temp5 = { "350", "460", EccType::TYPE_MOUNTAIN, SimpresentType::TYPE_HAS_CARD, - AbnormalServiceType::TYPE_ALL }; - eccVec.push_back(temp0); - eccVec.push_back(temp1); - eccVec.push_back(temp2); - eccVec.push_back(temp3); - eccVec.push_back(temp4); - eccVec.push_back(temp5); - if (HasSimCard(SIM1_SLOTID)) { - EXPECT_EQ(telephonyService->SetEmergencyCallList(SIM1_SLOTID, eccVec), 0); - } - if (HasSimCard(SIM2_SLOTID)) { - EXPECT_EQ(telephonyService->SetEmergencyCallList(SIM2_SLOTID, eccVec), 0); + std::vector eccVec; + EmergencyCall temp0 = { "499", "460", EccType::TYPE_CATEGORY, SimpresentType::TYPE_NO_CARD, + AbnormalServiceType::TYPE_ALL }; + EmergencyCall temp1 = { "443", "460", EccType::TYPE_POLICE, SimpresentType::TYPE_NO_CARD, + AbnormalServiceType::TYPE_ALL }; + EmergencyCall temp2 = { "356", "460", EccType::TYPE_AMBULANCE, SimpresentType::TYPE_NO_CARD, + AbnormalServiceType::TYPE_ALL }; + EmergencyCall temp3 = { "783", "460", EccType::TYPE_FIRE, SimpresentType::TYPE_NO_CARD, + AbnormalServiceType::TYPE_ALL }; + EmergencyCall temp4 = { "975", "460", EccType::TYPE_SEA, SimpresentType::TYPE_HAS_CARD, + AbnormalServiceType::TYPE_ONLY_CS }; + EmergencyCall temp5 = { "350", "460", EccType::TYPE_MOUNTAIN, SimpresentType::TYPE_HAS_CARD, + AbnormalServiceType::TYPE_ALL }; + eccVec.push_back(temp0); + eccVec.push_back(temp1); + eccVec.push_back(temp2); + eccVec.push_back(temp3); + eccVec.push_back(temp4); + eccVec.push_back(temp5); + if (HasSimCard(SIM1_SLOTID)) { + EXPECT_EQ(telephonyService->SetEmergencyCallList(SIM1_SLOTID, eccVec), 0); + } + if (HasSimCard(SIM2_SLOTID)) { + EXPECT_EQ(telephonyService->SetEmergencyCallList(SIM2_SLOTID, eccVec), 0); + } + JudgeIsEmergencyPhoneNumber(); } - JudgeIsEmergencyPhoneNumber(); } HWTEST_F(Cs1Test, cellular_call_IsOperatorConfigEmergencyCallList_0001, Function | MediumTest | Level3) @@ -265,26 +263,25 @@ HWTEST_F(Cs1Test, cellular_call_IsOperatorConfigEmergencyCallList_0001, Function ASSERT_TRUE(telephonyService != nullptr); if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - OperatorConfig opc; - if (HasSimCard(SIM1_SLOTID)) { - DelayedRefSingleton::GetInstance().GetOperatorConfigs(SIM1_SLOTID, opc); - if (opc.stringArrayValue.find(KEY_EMERGENCY_CALL_STRING_ARRAY) != opc.stringArrayValue.end()) { - for (auto number : opc.stringArrayValue[KEY_EMERGENCY_CALL_STRING_ARRAY]) { - bool enabled = false; - int32_t errorCode = telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, number, enabled); - EXPECT_EQ(TELEPHONY_SUCCESS, errorCode); + OperatorConfig opc; + if (HasSimCard(SIM1_SLOTID)) { + DelayedRefSingleton::GetInstance().GetOperatorConfigs(SIM1_SLOTID, opc); + if (opc.stringArrayValue.find(KEY_EMERGENCY_CALL_STRING_ARRAY) != opc.stringArrayValue.end()) { + for (auto number : opc.stringArrayValue[KEY_EMERGENCY_CALL_STRING_ARRAY]) { + bool enabled = false; + int32_t errorCode = telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, number, enabled); + EXPECT_EQ(TELEPHONY_SUCCESS, errorCode); + } } } - } - if (HasSimCard(SIM2_SLOTID)) { - DelayedRefSingleton::GetInstance().GetOperatorConfigs(SIM2_SLOTID, opc); - if (opc.stringArrayValue.find(KEY_EMERGENCY_CALL_STRING_ARRAY) != opc.stringArrayValue.end()) { - for (auto number : opc.stringArrayValue[KEY_EMERGENCY_CALL_STRING_ARRAY]) { - bool enabled = false; - int32_t errorCode = telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, number, enabled); - EXPECT_EQ(TELEPHONY_SUCCESS, errorCode); + if (HasSimCard(SIM2_SLOTID)) { + DelayedRefSingleton::GetInstance().GetOperatorConfigs(SIM2_SLOTID, opc); + if (opc.stringArrayValue.find(KEY_EMERGENCY_CALL_STRING_ARRAY) != opc.stringArrayValue.end()) { + for (auto number : opc.stringArrayValue[KEY_EMERGENCY_CALL_STRING_ARRAY]) { + bool enabled = false; + int32_t errorCode = telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, number, enabled); + EXPECT_EQ(TELEPHONY_SUCCESS, errorCode); + } } } } @@ -298,15 +295,14 @@ HWTEST_F(Cs1Test, cellular_call_IsOperatorConfigEmergencyCallList_0001, Function HWTEST_F(Cs1Test, cellular_call_DialCall_0001, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -318,15 +314,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0001, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0002, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -338,15 +333,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0002, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0003, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -358,15 +352,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0003, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0004, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -378,15 +371,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0004, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0005, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -398,15 +390,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0005, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0006, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -418,15 +409,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0006, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0007, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -438,15 +428,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0007, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0008, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -458,15 +447,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0008, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0009, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -478,15 +466,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0009, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0010, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -498,15 +485,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0010, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0011, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -518,15 +504,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0011, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0012, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -538,15 +523,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0012, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0013, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -558,15 +542,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0013, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0014, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -578,15 +561,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0014, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0015, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -598,15 +580,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0015, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0016, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*04#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*04#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*04#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*04#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -618,15 +599,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0016, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0017, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*05#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*05#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*05#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*05#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -638,15 +618,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0017, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0018, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*042#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*042#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*042#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*042#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -658,15 +637,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0018, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0019, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*052#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*052#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*052#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*052#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -678,15 +656,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0019, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0020, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*4444#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*4444#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*4444#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*4444#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -698,15 +675,14 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0020, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_DialCall_0021, Function | MediumTest | Level2) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(INVALID_SLOTID, PHONE_NUMBER); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(INVALID_SLOTID, PHONE_NUMBER); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(INVALID_SLOTID, PHONE_NUMBER); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(INVALID_SLOTID, PHONE_NUMBER); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -725,24 +701,23 @@ HWTEST_F(Cs1Test, cellular_call_HangUpCall_0001, Function | MediumTest | Level2) auto telephonyService = iface_cast(hangUpCallRemote); ASSERT_TRUE(telephonyService != nullptr); if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - CellularCallInfo hangUpCallInfo; - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, hangUpCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, hangUpCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + CellularCallInfo hangUpCallInfo; + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, hangUpCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, hangUpCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -755,27 +730,26 @@ HWTEST_F(Cs1Test, cellular_call_HangUpCall_0002, Function | MediumTest | Level2) { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto hangUpCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(hangUpCallRemote != nullptr); - auto telephonyService = iface_cast(hangUpCallRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo hangUpCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, hangUpCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo hangUpCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, hangUpCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto hangUpCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(hangUpCallRemote != nullptr); + auto telephonyService = iface_cast(hangUpCallRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo hangUpCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, hangUpCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo hangUpCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, hangUpCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -794,21 +768,20 @@ HWTEST_F(Cs1Test, cellular_call_AnswerCall_0001, Function | MediumTest | Level2) auto telephonyService = iface_cast(answerCallRemote); ASSERT_TRUE(telephonyService != nullptr); if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo answerCallInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, answerCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Answer(answerCallInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo answerCallInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, answerCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Answer(answerCallInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo answerCallInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, answerCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Answer(answerCallInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo answerCallInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, answerCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Answer(answerCallInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } } } @@ -821,27 +794,26 @@ HWTEST_F(Cs1Test, cellular_call_AnswerCall_0002, Function | MediumTest | Level2) { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto answerCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(answerCallRemote != nullptr); - auto telephonyService = iface_cast(answerCallRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo answerCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, answerCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Answer(answerCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo answerCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, answerCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Answer(answerCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto answerCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(answerCallRemote != nullptr); + auto telephonyService = iface_cast(answerCallRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo answerCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, answerCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Answer(answerCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo answerCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, answerCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Answer(answerCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -860,21 +832,20 @@ HWTEST_F(Cs1Test, cellular_call_RejectCall_0001, Function | MediumTest | Level2) auto telephonyService = iface_cast(rejectCallRemote); ASSERT_TRUE(telephonyService != nullptr); if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo rejectCallInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, rejectCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Reject(rejectCallInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo rejectCallInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, rejectCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Reject(rejectCallInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo rejectCallInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, rejectCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Reject(rejectCallInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo rejectCallInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, rejectCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Reject(rejectCallInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } } } @@ -887,27 +858,26 @@ HWTEST_F(Cs1Test, cellular_call_RejectCall_0002, Function | MediumTest | Level2) { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto rejectCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(rejectCallRemote != nullptr); - auto telephonyService = iface_cast(rejectCallRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo rejectCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, rejectCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Reject(rejectCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo rejectCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, rejectCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Reject(rejectCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto rejectCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(rejectCallRemote != nullptr); + auto telephonyService = iface_cast(rejectCallRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo rejectCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, rejectCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Reject(rejectCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo rejectCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, rejectCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Reject(rejectCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -926,21 +896,20 @@ HWTEST_F(Cs1Test, cellular_call_HoldCall_0001, Function | MediumTest | Level2) auto telephonyService = iface_cast(holdCallRemote); ASSERT_TRUE(telephonyService != nullptr); if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo holdCallInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, holdCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HoldCall(holdCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo holdCallInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, holdCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HoldCall(holdCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo holdCallInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, holdCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HoldCall(holdCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo holdCallInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, holdCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HoldCall(holdCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -953,27 +922,26 @@ HWTEST_F(Cs1Test, cellular_call_HoldCall_0002, Function | MediumTest | Level2) { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto holdCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(holdCallRemote != nullptr); - auto telephonyService = iface_cast(holdCallRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo holdCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, holdCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HoldCall(holdCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo holdCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, holdCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HoldCall(holdCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto holdCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(holdCallRemote != nullptr); + auto telephonyService = iface_cast(holdCallRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo holdCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, holdCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HoldCall(holdCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo holdCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, holdCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HoldCall(holdCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -992,21 +960,20 @@ HWTEST_F(Cs1Test, cellular_call_UnHoldCall_0001, Function | MediumTest | Level2) auto telephonyService = iface_cast(unHoldCallRemote); ASSERT_TRUE(telephonyService != nullptr); if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo unHoldCallInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, unHoldCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->UnHoldCall(unHoldCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo unHoldCallInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, unHoldCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->UnHoldCall(unHoldCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo unHoldCallInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, unHoldCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->UnHoldCall(unHoldCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo unHoldCallInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, unHoldCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->UnHoldCall(unHoldCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -1019,27 +986,26 @@ HWTEST_F(Cs1Test, cellular_call_UnHoldCall_0002, Function | MediumTest | Level2) { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto unHoldCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(unHoldCallRemote != nullptr); - auto telephonyService = iface_cast(unHoldCallRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo unHoldCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, unHoldCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->UnHoldCall(unHoldCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo unHoldCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, unHoldCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->UnHoldCall(unHoldCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto unHoldCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(unHoldCallRemote != nullptr); + auto telephonyService = iface_cast(unHoldCallRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo unHoldCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, unHoldCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->UnHoldCall(unHoldCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo unHoldCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, unHoldCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->UnHoldCall(unHoldCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -1058,21 +1024,20 @@ HWTEST_F(Cs1Test, cellular_call_SwitchCall_0001, Function | MediumTest | Level2) auto telephonyService = iface_cast(switchCallRemote); ASSERT_TRUE(telephonyService != nullptr); if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo switchCallInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, switchCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SwitchCall(switchCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo switchCallInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, switchCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SwitchCall(switchCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo switchCallInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, switchCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SwitchCall(switchCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo switchCallInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, switchCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SwitchCall(switchCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -1085,27 +1050,26 @@ HWTEST_F(Cs1Test, cellular_call_SwitchCall_0002, Function | MediumTest | Level2) { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto switchCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(switchCallRemote != nullptr); - auto telephonyService = iface_cast(switchCallRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo switchCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, switchCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SwitchCall(switchCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo switchCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, switchCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SwitchCall(switchCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto switchCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(switchCallRemote != nullptr); + auto telephonyService = iface_cast(switchCallRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo switchCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, switchCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SwitchCall(switchCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo switchCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, switchCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SwitchCall(switchCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } } // namespace Telephony -- Gitee From 26a78999ecc7d2dbc2b4f79cb5ab3c2749bd56c7 Mon Sep 17 00:00:00 2001 From: lishuo Date: Wed, 23 Apr 2025 02:23:08 +0000 Subject: [PATCH 05/16] =?UTF-8?q?dt=E7=94=A8=E4=BE=8B=E8=A7=84=E8=8C=83?= =?UTF-8?q?=EF=BC=8C=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- test/unittest/cstest/cs2_test.cpp | 1013 ++++++++++++++--------------- 1 file changed, 484 insertions(+), 529 deletions(-) diff --git a/test/unittest/cstest/cs2_test.cpp b/test/unittest/cstest/cs2_test.cpp index 7d3d01a6..79b09985 100644 --- a/test/unittest/cstest/cs2_test.cpp +++ b/test/unittest/cstest/cs2_test.cpp @@ -149,9 +149,7 @@ HWTEST_F(Cs2Test, cellular_call_CombineConference_0001, Function | MediumTest | ASSERT_TRUE(combineRemote != nullptr); auto telephonyService = iface_cast(combineRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo conferenceCallInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, conferenceCallInfo); @@ -177,27 +175,26 @@ HWTEST_F(Cs2Test, cellular_call_CombineConference_0002, Function | MediumTest | { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto combineRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(combineRemote != nullptr); - auto telephonyService = iface_cast(combineRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo conferenceCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, conferenceCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->CombineConference(conferenceCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo conferenceCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, conferenceCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->CombineConference(conferenceCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto combineRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(combineRemote != nullptr); + auto telephonyService = iface_cast(combineRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo conferenceCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, conferenceCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->CombineConference(conferenceCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo conferenceCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, conferenceCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->CombineConference(conferenceCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -215,9 +212,7 @@ HWTEST_F(Cs2Test, cellular_call_SeparateConference_0001, Function | MediumTest | ASSERT_TRUE(separateRemote != nullptr); auto telephonyService = iface_cast(separateRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo callInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); @@ -243,27 +238,26 @@ HWTEST_F(Cs2Test, cellular_call_SeparateConference_0002, Function | MediumTest | { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto separateRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(separateRemote != nullptr); - auto telephonyService = iface_cast(separateRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo separateCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, separateCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SeparateConference(separateCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo separateCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, separateCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SeparateConference(separateCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto separateRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(separateRemote != nullptr); + auto telephonyService = iface_cast(separateRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo separateCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, separateCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SeparateConference(separateCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo separateCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, separateCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SeparateConference(separateCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -281,9 +275,7 @@ HWTEST_F(Cs2Test, cellular_call_KickOutFromConference_0001, Function | MediumTes ASSERT_TRUE(kickOutRemote != nullptr); auto telephonyService = iface_cast(kickOutRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo kickOutCallInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, kickOutCallInfo); @@ -309,27 +301,26 @@ HWTEST_F(Cs2Test, cellular_call_KickOutFromConference_0002, Function | MediumTes { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto kickOutRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(kickOutRemote != nullptr); - auto telephonyService = iface_cast(kickOutRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo kickOutCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, kickOutCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->KickOutFromConference(kickOutCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo kickOutCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, kickOutCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->KickOutFromConference(kickOutCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto kickOutRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(kickOutRemote != nullptr); + auto telephonyService = iface_cast(kickOutRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo kickOutCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, kickOutCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->KickOutFromConference(kickOutCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo kickOutCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, kickOutCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->KickOutFromConference(kickOutCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -347,9 +338,7 @@ HWTEST_F(Cs2Test, cellular_call_HangUpAllConnection_0001, Function | MediumTest ASSERT_TRUE(hangUpAllConRemote != nullptr); auto telephonyService = iface_cast(hangUpAllConRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { int32_t ret = telephonyService->HangUpAllConnection(); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -374,9 +363,7 @@ HWTEST_F(Cs2Test, cellular_call_StartDtmf_0001, Function | MediumTest | Level2) ASSERT_TRUE(startDtmfRemote != nullptr); auto telephonyService = iface_cast(startDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo callInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); @@ -404,28 +391,27 @@ HWTEST_F(Cs2Test, cellular_call_StartDtmf_0002, Function | MediumTest | Level2) { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto startDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(startDtmfRemote != nullptr); - auto telephonyService = iface_cast(startDtmfRemote); - ASSERT_TRUE(telephonyService != nullptr); - CellularCallInfo callInfo; - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->StartDtmf(code, callInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->StartDtmf(code, callInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto startDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(startDtmfRemote != nullptr); + auto telephonyService = iface_cast(startDtmfRemote); + ASSERT_TRUE(telephonyService != nullptr); + CellularCallInfo callInfo; + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->StartDtmf(code, callInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->StartDtmf(code, callInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -443,9 +429,7 @@ HWTEST_F(Cs2Test, cellular_call_StopDtmf_0001, Function | MediumTest | Level2) ASSERT_TRUE(stopDtmfRemote != nullptr); auto telephonyService = iface_cast(stopDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo callInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); @@ -471,27 +455,26 @@ HWTEST_F(Cs2Test, cellular_call_StopDtmf_0002, Function | MediumTest | Level2) { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto stopDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(stopDtmfRemote != nullptr); - auto telephonyService = iface_cast(stopDtmfRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo stopDtmfCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->StopDtmf(stopDtmfCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo stopDtmfCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->StopDtmf(stopDtmfCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto stopDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(stopDtmfRemote != nullptr); + auto telephonyService = iface_cast(stopDtmfRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo stopDtmfCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->StopDtmf(stopDtmfCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo stopDtmfCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->StopDtmf(stopDtmfCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -509,9 +492,7 @@ HWTEST_F(Cs2Test, cellular_call_SendDtmf_0001, Function | MediumTest | Level2) ASSERT_TRUE(sendDtmfRemote != nullptr); auto telephonyService = iface_cast(sendDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo sendDtmfCallInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); @@ -539,29 +520,28 @@ HWTEST_F(Cs2Test, cellular_call_SendDtmf_0002, Function | MediumTest | Level2) { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto sendDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(sendDtmfRemote != nullptr); - auto telephonyService = iface_cast(sendDtmfRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo sendDtmfCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->SendDtmf(code, sendDtmfCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo sendDtmfCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->SendDtmf(code, sendDtmfCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto sendDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(sendDtmfRemote != nullptr); + auto telephonyService = iface_cast(sendDtmfRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo sendDtmfCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->SendDtmf(code, sendDtmfCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo sendDtmfCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->SendDtmf(code, sendDtmfCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -579,9 +559,7 @@ HWTEST_F(Cs2Test, cellular_call_GetDomainPreferenceMode_0001, Function | MediumT ASSERT_TRUE(domainPrefModeRemote != nullptr); auto telephonyService = iface_cast(domainPrefModeRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { int32_t ret = telephonyService->GetDomainPreferenceMode(INVALID_SLOTID); EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); @@ -601,21 +579,20 @@ HWTEST_F(Cs2Test, cellular_call_GetDomainPreferenceMode_0002, Function | MediumT { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto domainPrefModeRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(domainPrefModeRemote != nullptr); - auto telephonyService = iface_cast(domainPrefModeRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = telephonyService->GetDomainPreferenceMode(SIM1_SLOTID); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = telephonyService->GetDomainPreferenceMode(SIM2_SLOTID); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto domainPrefModeRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(domainPrefModeRemote != nullptr); + auto telephonyService = iface_cast(domainPrefModeRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = telephonyService->GetDomainPreferenceMode(SIM1_SLOTID); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = telephonyService->GetDomainPreferenceMode(SIM2_SLOTID); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -633,9 +610,7 @@ HWTEST_F(Cs2Test, cellular_call_GetMute_0001, Function | MediumTest | Level3) ASSERT_TRUE(getMuteRemote != nullptr); auto telephonyService = iface_cast(getMuteRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { int32_t ret = telephonyService->GetMute(INVALID_SLOTID); EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); @@ -655,21 +630,20 @@ HWTEST_F(Cs2Test, cellular_call_GetMute_0002, Function | MediumTest | Level3) { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto getMuteRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(getMuteRemote != nullptr); - auto telephonyService = iface_cast(getMuteRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = telephonyService->GetMute(SIM1_SLOTID); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = telephonyService->GetMute(SIM2_SLOTID); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto getMuteRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(getMuteRemote != nullptr); + auto telephonyService = iface_cast(getMuteRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = telephonyService->GetMute(SIM1_SLOTID); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = telephonyService->GetMute(SIM2_SLOTID); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } } } @@ -685,46 +659,45 @@ HWTEST_F(Cs2Test, cellular_call_CsControl_0001, Function | MediumTest | Level3) auto csControlRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); ASSERT_TRUE(csControlRemote != nullptr); if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto csControl = std::make_shared(); - CellularCallInfo cellularCallInfo; - bool enabled = false; - EXPECT_EQ(InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_EQ(csControl->Dial(cellularCallInfo, enabled), CALL_ERR_GET_RADIO_STATE_FAILED); - EXPECT_EQ(InitCellularCallInfo(INVALID_SLOTID, "", cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_EQ(csControl->Dial(cellularCallInfo, enabled), CALL_ERR_PHONE_NUMBER_EMPTY); - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; - } - EXPECT_EQ(InitCellularCallInfo(slotId, "*30#", cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_EQ(csControl->DialCdma(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE); - EXPECT_EQ(csControl->DialGsm(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE); - EXPECT_EQ(InitCellularCallInfo(slotId, "#30#", cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_EQ(csControl->DialGsm(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE); - EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER, cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_EQ(csControl->DialCdma(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE); + auto csControl = std::make_shared(); + CellularCallInfo cellularCallInfo; + bool enabled = false; + EXPECT_EQ(InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, cellularCallInfo), TELEPHONY_SUCCESS); EXPECT_EQ(csControl->Dial(cellularCallInfo, enabled), CALL_ERR_GET_RADIO_STATE_FAILED); - ASSERT_FALSE(csControl->CalculateInternationalRoaming(slotId)); - EXPECT_NE(csControl->DialCdma(cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_EQ(csControl->DialGsm(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE); - EXPECT_NE(csControl->Answer(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE); - EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_SECOND, cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_NE(csControl->Answer(cellularCallInfo), CALL_ERR_CALL_STATE); - EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_THIRD, cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_NE(csControl->Answer(cellularCallInfo), CALL_ERR_CALL_STATE); - EXPECT_NE(csControl->Reject(cellularCallInfo), CALL_ERR_CALL_STATE); - EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER, cellularCallInfo), TELEPHONY_SUCCESS); - EXPECT_EQ(csControl->SeparateConference(slotId, PHONE_NUMBER, 1), CALL_ERR_RESOURCE_UNAVAILABLE); - EXPECT_EQ(csControl->SeparateConference(slotId, "", 1), CALL_ERR_RESOURCE_UNAVAILABLE); - EXPECT_NE(csControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_DEFAULT), CALL_ERR_RESOURCE_UNAVAILABLE); - EXPECT_EQ(csControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE), - CALL_ERR_RESOURCE_UNAVAILABLE); - EXPECT_EQ( - csControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ALL), CALL_ERR_RESOURCE_UNAVAILABLE); - EXPECT_EQ(csControl->HangUp(cellularCallInfo, static_cast(INVALID_HANG_UP_TYPE)), - TELEPHONY_ERR_ARGUMENT_INVALID); + EXPECT_EQ(InitCellularCallInfo(INVALID_SLOTID, "", cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_EQ(csControl->Dial(cellularCallInfo, enabled), CALL_ERR_PHONE_NUMBER_EMPTY); + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + EXPECT_EQ(InitCellularCallInfo(slotId, "*30#", cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_EQ(csControl->DialCdma(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE); + EXPECT_EQ(csControl->DialGsm(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE); + EXPECT_EQ(InitCellularCallInfo(slotId, "#30#", cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_EQ(csControl->DialGsm(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE); + EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER, cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_EQ(csControl->DialCdma(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE); + EXPECT_EQ(csControl->Dial(cellularCallInfo, enabled), CALL_ERR_GET_RADIO_STATE_FAILED); + ASSERT_FALSE(csControl->CalculateInternationalRoaming(slotId)); + EXPECT_NE(csControl->DialCdma(cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_EQ(csControl->DialGsm(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE); + EXPECT_NE(csControl->Answer(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE); + EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_SECOND, cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_NE(csControl->Answer(cellularCallInfo), CALL_ERR_CALL_STATE); + EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_THIRD, cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_NE(csControl->Answer(cellularCallInfo), CALL_ERR_CALL_STATE); + EXPECT_NE(csControl->Reject(cellularCallInfo), CALL_ERR_CALL_STATE); + EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER, cellularCallInfo), TELEPHONY_SUCCESS); + EXPECT_EQ(csControl->SeparateConference(slotId, PHONE_NUMBER, 1), CALL_ERR_RESOURCE_UNAVAILABLE); + EXPECT_EQ(csControl->SeparateConference(slotId, "", 1), CALL_ERR_RESOURCE_UNAVAILABLE); + EXPECT_NE(csControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_DEFAULT), CALL_ERR_RESOURCE_UNAVAILABLE); + EXPECT_EQ(csControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE), + CALL_ERR_RESOURCE_UNAVAILABLE); + EXPECT_EQ( + csControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ALL), CALL_ERR_RESOURCE_UNAVAILABLE); + EXPECT_EQ(csControl->HangUp(cellularCallInfo, static_cast(INVALID_HANG_UP_TYPE)), + TELEPHONY_ERR_ARGUMENT_INVALID); + } } } @@ -784,22 +757,20 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallConnectionCS_0001, Function | Medium auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); ASSERT_TRUE(remote != nullptr); if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + CellularCallConnectionCS csConnection; + EXPECT_EQ(csConnection.SendDtmfRequest(slotId, '1', 1), CALL_ERR_RESOURCE_UNAVAILABLE); + EXPECT_EQ(csConnection.StartDtmfRequest(slotId, '1', 1), CALL_ERR_RESOURCE_UNAVAILABLE); + EXPECT_EQ(csConnection.StopDtmfRequest(slotId, 1), CALL_ERR_RESOURCE_UNAVAILABLE); + EXPECT_EQ(csConnection.GetCsCallsDataRequest(slotId, 1), CALL_ERR_RESOURCE_UNAVAILABLE); + EXPECT_EQ(csConnection.GetCallFailReasonRequest(slotId), CALL_ERR_RESOURCE_UNAVAILABLE); + MMICodeUtils utils; + ASSERT_FALSE(utils.IsNeedExecuteMmi("", false)); + ASSERT_FALSE(utils.ExecuteMmiCode(slotId)); } - CellularCallConnectionCS csConnection; - EXPECT_EQ(csConnection.SendDtmfRequest(slotId, '1', 1), CALL_ERR_RESOURCE_UNAVAILABLE); - EXPECT_EQ(csConnection.StartDtmfRequest(slotId, '1', 1), CALL_ERR_RESOURCE_UNAVAILABLE); - EXPECT_EQ(csConnection.StopDtmfRequest(slotId, 1), CALL_ERR_RESOURCE_UNAVAILABLE); - EXPECT_EQ(csConnection.GetCsCallsDataRequest(slotId, 1), CALL_ERR_RESOURCE_UNAVAILABLE); - EXPECT_EQ(csConnection.GetCallFailReasonRequest(slotId), CALL_ERR_RESOURCE_UNAVAILABLE); - MMICodeUtils utils; - ASSERT_FALSE(utils.IsNeedExecuteMmi("", false)); - ASSERT_FALSE(utils.ExecuteMmiCode(slotId)); } } @@ -815,45 +786,44 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallRegister_0001, Function | MediumTest auto cellularCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); ASSERT_TRUE(cellularCallRemote != nullptr); if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; + auto callRegister = DelayedSingleton::GetInstance(); + ASSERT_TRUE(callRegister != nullptr); + CellularCallEventInfo callEvent; + callRegister->ReportEventResultInfo(callEvent); + CallWaitResponse waitResponse; + callRegister->ReportGetWaitingResult(waitResponse); + callRegister->ReportSetWaitingResult(ERROR_RESULT); + CallRestrictionResponse restrictionResponse; + callRegister->ReportGetRestrictionResult(restrictionResponse); + callRegister->ReportSetRestrictionResult(ERROR_RESULT); + callRegister->ReportSetBarringPasswordResult(ERROR_RESULT); + CallTransferResponse transferResponse; + callRegister->ReportGetTransferResult(transferResponse); + callRegister->ReportSetTransferResult(ERROR_RESULT); + ClipResponse clipResponse; + callRegister->ReportGetClipResult(clipResponse); + ClirResponse clirResponse; + callRegister->ReportGetClirResult(clirResponse); + callRegister->ReportSetClirResult(ERROR_RESULT); + callRegister->ReportCallRingBackResult(ERROR_RESULT); + DisconnectedDetails details; + callRegister->ReportCallFailReason(details); + MuteControlResponse muteResponse; + callRegister->ReportSetMuteResult(muteResponse); + callRegister->ReportGetMuteResult(muteResponse); + callRegister->ReportInviteToConferenceResult(ERROR_RESULT); + callRegister->ReportGetCallDataResult(ERROR_RESULT); + callRegister->ReportStartDtmfResult(ERROR_RESULT); + callRegister->ReportStopDtmfResult(ERROR_RESULT); + callRegister->ReportStartRttResult(ERROR_RESULT); + callRegister->ReportStopRttResult(ERROR_RESULT); + callRegister->ReportSendUssdResult(ERROR_RESULT); + SetEccListResponse eccListResponse; + callRegister->ReportSetEmergencyCallListResponse(eccListResponse); + MmiCodeInfo mmiInfo; + callRegister->ReportMmiCodeResult(mmiInfo); + ASSERT_FALSE(callRegister->IsCallManagerCallBackRegistered()); } - auto callRegister = DelayedSingleton::GetInstance(); - ASSERT_TRUE(callRegister != nullptr); - CellularCallEventInfo callEvent; - callRegister->ReportEventResultInfo(callEvent); - CallWaitResponse waitResponse; - callRegister->ReportGetWaitingResult(waitResponse); - callRegister->ReportSetWaitingResult(ERROR_RESULT); - CallRestrictionResponse restrictionResponse; - callRegister->ReportGetRestrictionResult(restrictionResponse); - callRegister->ReportSetRestrictionResult(ERROR_RESULT); - callRegister->ReportSetBarringPasswordResult(ERROR_RESULT); - CallTransferResponse transferResponse; - callRegister->ReportGetTransferResult(transferResponse); - callRegister->ReportSetTransferResult(ERROR_RESULT); - ClipResponse clipResponse; - callRegister->ReportGetClipResult(clipResponse); - ClirResponse clirResponse; - callRegister->ReportGetClirResult(clirResponse); - callRegister->ReportSetClirResult(ERROR_RESULT); - callRegister->ReportCallRingBackResult(ERROR_RESULT); - DisconnectedDetails details; - callRegister->ReportCallFailReason(details); - MuteControlResponse muteResponse; - callRegister->ReportSetMuteResult(muteResponse); - callRegister->ReportGetMuteResult(muteResponse); - callRegister->ReportInviteToConferenceResult(ERROR_RESULT); - callRegister->ReportGetCallDataResult(ERROR_RESULT); - callRegister->ReportStartDtmfResult(ERROR_RESULT); - callRegister->ReportStopDtmfResult(ERROR_RESULT); - callRegister->ReportStartRttResult(ERROR_RESULT); - callRegister->ReportStopRttResult(ERROR_RESULT); - callRegister->ReportSendUssdResult(ERROR_RESULT); - SetEccListResponse eccListResponse; - callRegister->ReportSetEmergencyCallListResponse(eccListResponse); - MmiCodeInfo mmiInfo; - callRegister->ReportMmiCodeResult(mmiInfo); - ASSERT_FALSE(callRegister->IsCallManagerCallBackRegistered()); } /** @@ -886,33 +856,31 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallRegister_0002, Function | MediumTest HWTEST_F(Cs2Test, cellular_call_SupplementRequestCs_0001, Function | MediumTest | Level3) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + SupplementRequestCs request; + std::string fac = "fac"; + std::string pw = "test"; + int32_t index = 1; + int32_t mode = 1; + int32_t classType = 1; + const char *oldPassword = "oldpwd"; + const char *newPassword = "newpwd"; + bool active = true; + CallTransferParam param; + EXPECT_NE(request.GetCallRestrictionRequest(slotId, fac, index), TELEPHONY_SUCCESS); + EXPECT_NE(request.SetCallRestrictionRequest(slotId, fac, mode, pw, index), TELEPHONY_SUCCESS); + EXPECT_NE(request.SetBarringPasswordRequest(slotId, fac, index, oldPassword, newPassword), TELEPHONY_SUCCESS); + EXPECT_NE(request.GetCallWaitingRequest(slotId, index), TELEPHONY_SUCCESS); + EXPECT_NE(request.SetCallWaitingRequest(slotId, active, classType, index), TELEPHONY_SUCCESS); + EXPECT_NE(request.GetClipRequest(slotId, index), TELEPHONY_SUCCESS); + EXPECT_NE(request.GetClirRequest(slotId, index), TELEPHONY_SUCCESS); + EXPECT_NE(request.SetClirRequest(slotId, mode, index), TELEPHONY_SUCCESS); + EXPECT_NE(request.GetCallTransferRequest(slotId, mode, index), TELEPHONY_SUCCESS); + EXPECT_NE(request.SetCallTransferRequest(slotId, param, index), TELEPHONY_SUCCESS); } - SupplementRequestCs request; - std::string fac = "fac"; - std::string pw = "test"; - int32_t index = 1; - int32_t mode = 1; - int32_t classType = 1; - const char *oldPassword = "oldpwd"; - const char *newPassword = "newpwd"; - bool active = true; - CallTransferParam param; - EXPECT_NE(request.GetCallRestrictionRequest(slotId, fac, index), TELEPHONY_SUCCESS); - EXPECT_NE(request.SetCallRestrictionRequest(slotId, fac, mode, pw, index), TELEPHONY_SUCCESS); - EXPECT_NE(request.SetBarringPasswordRequest(slotId, fac, index, oldPassword, newPassword), TELEPHONY_SUCCESS); - EXPECT_NE(request.GetCallWaitingRequest(slotId, index), TELEPHONY_SUCCESS); - EXPECT_NE(request.SetCallWaitingRequest(slotId, active, classType, index), TELEPHONY_SUCCESS); - EXPECT_NE(request.GetClipRequest(slotId, index), TELEPHONY_SUCCESS); - EXPECT_NE(request.GetClirRequest(slotId, index), TELEPHONY_SUCCESS); - EXPECT_NE(request.SetClirRequest(slotId, mode, index), TELEPHONY_SUCCESS); - EXPECT_NE(request.GetCallTransferRequest(slotId, mode, index), TELEPHONY_SUCCESS); - EXPECT_NE(request.SetCallTransferRequest(slotId, param, index), TELEPHONY_SUCCESS); } } @@ -924,19 +892,17 @@ HWTEST_F(Cs2Test, cellular_call_SupplementRequestCs_0001, Function | MediumTest HWTEST_F(Cs2Test, cellular_call_ConfigRequest_0001, Function | MediumTest | Level3) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + ConfigRequest config; + int32_t mode = 1; + EXPECT_NE(config.SetDomainPreferenceModeRequest(slotId, mode), TELEPHONY_SUCCESS); + EXPECT_NE(config.GetDomainPreferenceModeRequest(slotId), TELEPHONY_SUCCESS); + EXPECT_NE(config.SetMuteRequest(slotId, mode), TELEPHONY_SUCCESS); + EXPECT_NE(config.GetMuteRequest(slotId), TELEPHONY_SUCCESS); } - ConfigRequest config; - int32_t mode = 1; - EXPECT_NE(config.SetDomainPreferenceModeRequest(slotId, mode), TELEPHONY_SUCCESS); - EXPECT_NE(config.GetDomainPreferenceModeRequest(slotId), TELEPHONY_SUCCESS); - EXPECT_NE(config.SetMuteRequest(slotId, mode), TELEPHONY_SUCCESS); - EXPECT_NE(config.GetMuteRequest(slotId), TELEPHONY_SUCCESS); } } @@ -948,35 +914,33 @@ HWTEST_F(Cs2Test, cellular_call_ConfigRequest_0001, Function | MediumTest | Leve HWTEST_F(Cs2Test, cellular_call_CellularCallSupplement_0001, Function | MediumTest | Level3) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + MMIData mmiData; + CellularCallSupplement supplement; + mmiData.actionString = ""; + supplement.AlterPinPassword(slotId, mmiData); + supplement.AlterPin2Password(slotId, mmiData); + supplement.UnlockPuk(slotId, mmiData); + supplement.UnlockPuk2(slotId, mmiData); + mmiData.actionString = "test"; + mmiData.serviceInfoA = "infoA"; + mmiData.serviceInfoB = "infoB"; + mmiData.serviceInfoC = "infoC"; + supplement.AlterPinPassword(slotId, mmiData); + supplement.AlterPin2Password(slotId, mmiData); + supplement.UnlockPuk(slotId, mmiData); + supplement.UnlockPuk2(slotId, mmiData); + mmiData.serviceInfoC = "infoB"; + supplement.AlterPinPassword(slotId, mmiData); + supplement.AlterPin2Password(slotId, mmiData); + supplement.UnlockPuk(slotId, mmiData); + supplement.UnlockPuk2(slotId, mmiData); + ASSERT_FALSE(supplement.IsVaildPinOrPuk("B", "B")); + EXPECT_NE(supplement.SendUssd(slotId, "test"), TELEPHONY_SUCCESS); } - MMIData mmiData; - CellularCallSupplement supplement; - mmiData.actionString = ""; - supplement.AlterPinPassword(slotId, mmiData); - supplement.AlterPin2Password(slotId, mmiData); - supplement.UnlockPuk(slotId, mmiData); - supplement.UnlockPuk2(slotId, mmiData); - mmiData.actionString = "test"; - mmiData.serviceInfoA = "infoA"; - mmiData.serviceInfoB = "infoB"; - mmiData.serviceInfoC = "infoC"; - supplement.AlterPinPassword(slotId, mmiData); - supplement.AlterPin2Password(slotId, mmiData); - supplement.UnlockPuk(slotId, mmiData); - supplement.UnlockPuk2(slotId, mmiData); - mmiData.serviceInfoC = "infoB"; - supplement.AlterPinPassword(slotId, mmiData); - supplement.AlterPin2Password(slotId, mmiData); - supplement.UnlockPuk(slotId, mmiData); - supplement.UnlockPuk2(slotId, mmiData); - ASSERT_FALSE(supplement.IsVaildPinOrPuk("B", "B")); - EXPECT_NE(supplement.SendUssd(slotId, "test"), TELEPHONY_SUCCESS); } } @@ -988,43 +952,41 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallSupplement_0001, Function | MediumTe HWTEST_F(Cs2Test, cellular_call_CellularCallSupplement_0002, Function | MediumTest | Level3) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + CellularCallSupplement supplement; + supplement.ObtainBarringInstallation("33"); + supplement.ObtainBarringInstallation("331"); + supplement.ObtainBarringInstallation("332"); + supplement.ObtainBarringInstallation("351"); + supplement.ObtainBarringInstallation("35"); + supplement.ObtainBarringInstallation("330"); + supplement.ObtainBarringInstallation("333"); + supplement.ObtainBarringInstallation("353"); + supplement.ObtainBarringInstallation("1000"); - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; - } - CellularCallSupplement supplement; - supplement.ObtainBarringInstallation("33"); - supplement.ObtainBarringInstallation("331"); - supplement.ObtainBarringInstallation("332"); - supplement.ObtainBarringInstallation("351"); - supplement.ObtainBarringInstallation("35"); - supplement.ObtainBarringInstallation("330"); - supplement.ObtainBarringInstallation("333"); - supplement.ObtainBarringInstallation("353"); - supplement.ObtainBarringInstallation("1000"); + EXPECT_NE(supplement.ObtainServiceCode("10"), TELEPHONY_SUCCESS); + EXPECT_NE(supplement.ObtainServiceCode("11"), TELEPHONY_SUCCESS); + EXPECT_NE(supplement.ObtainServiceCode("12"), TELEPHONY_SUCCESS); + EXPECT_NE(supplement.ObtainServiceCode("13"), TELEPHONY_SUCCESS); + EXPECT_NE(supplement.ObtainServiceCode("16"), TELEPHONY_SUCCESS); + EXPECT_NE(supplement.ObtainServiceCode("19"), TELEPHONY_SUCCESS); + EXPECT_NE(supplement.ObtainServiceCode("20"), TELEPHONY_SUCCESS); + EXPECT_NE(supplement.ObtainServiceCode("21"), TELEPHONY_SUCCESS); + EXPECT_NE(supplement.ObtainServiceCode("22"), TELEPHONY_SUCCESS); + EXPECT_NE(supplement.ObtainServiceCode("24"), TELEPHONY_SUCCESS); + EXPECT_NE(supplement.ObtainServiceCode("25"), TELEPHONY_SUCCESS); + EXPECT_NE(supplement.ObtainServiceCode("99"), TELEPHONY_SUCCESS); + EXPECT_EQ(supplement.ObtainServiceCode("100"), TELEPHONY_SUCCESS); - EXPECT_NE(supplement.ObtainServiceCode("10"), TELEPHONY_SUCCESS); - EXPECT_NE(supplement.ObtainServiceCode("11"), TELEPHONY_SUCCESS); - EXPECT_NE(supplement.ObtainServiceCode("12"), TELEPHONY_SUCCESS); - EXPECT_NE(supplement.ObtainServiceCode("13"), TELEPHONY_SUCCESS); - EXPECT_NE(supplement.ObtainServiceCode("16"), TELEPHONY_SUCCESS); - EXPECT_NE(supplement.ObtainServiceCode("19"), TELEPHONY_SUCCESS); - EXPECT_NE(supplement.ObtainServiceCode("20"), TELEPHONY_SUCCESS); - EXPECT_NE(supplement.ObtainServiceCode("21"), TELEPHONY_SUCCESS); - EXPECT_NE(supplement.ObtainServiceCode("22"), TELEPHONY_SUCCESS); - EXPECT_NE(supplement.ObtainServiceCode("24"), TELEPHONY_SUCCESS); - EXPECT_NE(supplement.ObtainServiceCode("25"), TELEPHONY_SUCCESS); - EXPECT_NE(supplement.ObtainServiceCode("99"), TELEPHONY_SUCCESS); - EXPECT_EQ(supplement.ObtainServiceCode("100"), TELEPHONY_SUCCESS); - - EXPECT_EQ(supplement.ObtainCause("21"), TELEPHONY_SUCCESS); - EXPECT_NE(supplement.ObtainCause("61"), TELEPHONY_SUCCESS); - EXPECT_NE(supplement.ObtainCause("62"), TELEPHONY_SUCCESS); - EXPECT_NE(supplement.ObtainCause("67"), TELEPHONY_SUCCESS); - EXPECT_EQ(supplement.ObtainCause("99"), TELEPHONY_ERROR); + EXPECT_EQ(supplement.ObtainCause("21"), TELEPHONY_SUCCESS); + EXPECT_NE(supplement.ObtainCause("61"), TELEPHONY_SUCCESS); + EXPECT_NE(supplement.ObtainCause("62"), TELEPHONY_SUCCESS); + EXPECT_NE(supplement.ObtainCause("67"), TELEPHONY_SUCCESS); + EXPECT_EQ(supplement.ObtainCause("99"), TELEPHONY_ERROR); + } } } @@ -1036,27 +998,25 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallSupplement_0002, Function | MediumTe HWTEST_F(Cs2Test, cellular_call_CellularCallSupplement_0003, Function | MediumTest | Level3) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + CellularCallSupplement supplement; + std::string action = "*"; + std::string number = ""; + CallTransferSettingType type; + EXPECT_EQ(supplement.ObtainCallTrasferAction(action.c_str(), number, type), TELEPHONY_SUCCESS); + EXPECT_EQ(supplement.ObtainCallTrasferAction(action.c_str(), PHONE_NUMBER, type), TELEPHONY_SUCCESS); + action = "#"; + EXPECT_EQ(supplement.ObtainCallTrasferAction(action.c_str(), number, type), TELEPHONY_SUCCESS); + action = "**"; + EXPECT_EQ(supplement.ObtainCallTrasferAction(action.c_str(), number, type), TELEPHONY_SUCCESS); + action = "##"; + EXPECT_EQ(supplement.ObtainCallTrasferAction(action.c_str(), number, type), TELEPHONY_SUCCESS); + action = "*#"; + EXPECT_NE(supplement.ObtainCallTrasferAction(action.c_str(), number, type), TELEPHONY_SUCCESS); } - CellularCallSupplement supplement; - std::string action = "*"; - std::string number = ""; - CallTransferSettingType type; - EXPECT_EQ(supplement.ObtainCallTrasferAction(action.c_str(), number, type), TELEPHONY_SUCCESS); - EXPECT_EQ(supplement.ObtainCallTrasferAction(action.c_str(), PHONE_NUMBER, type), TELEPHONY_SUCCESS); - action = "#"; - EXPECT_EQ(supplement.ObtainCallTrasferAction(action.c_str(), number, type), TELEPHONY_SUCCESS); - action = "**"; - EXPECT_EQ(supplement.ObtainCallTrasferAction(action.c_str(), number, type), TELEPHONY_SUCCESS); - action = "##"; - EXPECT_EQ(supplement.ObtainCallTrasferAction(action.c_str(), number, type), TELEPHONY_SUCCESS); - action = "*#"; - EXPECT_NE(supplement.ObtainCallTrasferAction(action.c_str(), number, type), TELEPHONY_SUCCESS); } } @@ -1068,46 +1028,44 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallSupplement_0003, Function | MediumTe HWTEST_F(Cs2Test, cellular_call_CellularCallHandler_0001, Function | MediumTest | Level3) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - - EventFwk::MatchingSkills matchingSkills; - matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED); - EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills); - CellularCallHandler firstHandler { subscriberInfo }; - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + EventFwk::MatchingSkills matchingSkills; + matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED); + EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills); + CellularCallHandler firstHandler { subscriberInfo }; + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + firstHandler.SetSlotId(slotId); + auto event = AppExecFwk::InnerEvent::Get(0); + auto rilRadioResponse = std::make_shared(); + rilRadioResponse->error = ErrType::ERR_GENERIC_FAILURE; + firstHandler.CellularCallIncomingStartTrace(static_cast(TelCallState::CALL_STATUS_INCOMING)); + firstHandler.CellularCallIncomingFinishTrace(static_cast(TelCallState::CALL_STATUS_INCOMING)); + firstHandler.GetCsCallsDataResponse(event); + firstHandler.GetCsCallsDataRequest(event); + firstHandler.GetMMIResponse(event); + auto ringbackResponse = std::make_shared(); + ringbackResponse->status = ERROR_RESULT; + auto ringbackEvent = AppExecFwk::InnerEvent::Get(0, ringbackResponse); + firstHandler.CallRingBackVoiceResponse(event); + firstHandler.CallRingBackVoiceResponse(ringbackEvent); + auto srvccStatus = std::make_shared(); + srvccStatus->status = SrvccState::SRVCC_NONE; + auto srvccEvent1 = AppExecFwk::InnerEvent::Get(0, srvccStatus); + firstHandler.UpdateSrvccStateReport(event); + firstHandler.UpdateSrvccStateReport(srvccEvent1); + srvccStatus->status = SrvccState::COMPLETED; + auto srvccEvent2 = AppExecFwk::InnerEvent::Get(0, srvccStatus); + firstHandler.UpdateSrvccStateReport(srvccEvent2); + firstHandler.UpdateRsrvccStateReport(event); + firstHandler.GetCallFailReasonResponse(event); + firstHandler.GetEmergencyCallListResponse(event); + firstHandler.ReportEccChanged(event); + firstHandler.SetEmergencyCallListResponse(event); + firstHandler.SendUssdResponse(event); + ASSERT_EQ(firstHandler.GetSlotId(), slotId); } - firstHandler.SetSlotId(slotId); - auto event = AppExecFwk::InnerEvent::Get(0); - auto rilRadioResponse = std::make_shared(); - rilRadioResponse->error = ErrType::ERR_GENERIC_FAILURE; - firstHandler.CellularCallIncomingStartTrace(static_cast(TelCallState::CALL_STATUS_INCOMING)); - firstHandler.CellularCallIncomingFinishTrace(static_cast(TelCallState::CALL_STATUS_INCOMING)); - firstHandler.GetCsCallsDataResponse(event); - firstHandler.GetCsCallsDataRequest(event); - firstHandler.GetMMIResponse(event); - auto ringbackResponse = std::make_shared(); - ringbackResponse->status = ERROR_RESULT; - auto ringbackEvent = AppExecFwk::InnerEvent::Get(0, ringbackResponse); - firstHandler.CallRingBackVoiceResponse(event); - firstHandler.CallRingBackVoiceResponse(ringbackEvent); - auto srvccStatus = std::make_shared(); - srvccStatus->status = SrvccState::SRVCC_NONE; - auto srvccEvent1 = AppExecFwk::InnerEvent::Get(0, srvccStatus); - firstHandler.UpdateSrvccStateReport(event); - firstHandler.UpdateSrvccStateReport(srvccEvent1); - srvccStatus->status = SrvccState::COMPLETED; - auto srvccEvent2 = AppExecFwk::InnerEvent::Get(0, srvccStatus); - firstHandler.UpdateSrvccStateReport(srvccEvent2); - firstHandler.UpdateRsrvccStateReport(event); - firstHandler.GetCallFailReasonResponse(event); - firstHandler.GetEmergencyCallListResponse(event); - firstHandler.ReportEccChanged(event); - firstHandler.SetEmergencyCallListResponse(event); - firstHandler.SendUssdResponse(event); - ASSERT_EQ(firstHandler.GetSlotId(), slotId); } } @@ -1119,55 +1077,53 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallHandler_0001, Function | MediumTest HWTEST_F(Cs2Test, cellular_call_CellularCallHandler_0002, Function | MediumTest | Level3) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + EventFwk::MatchingSkills matchingSkills; + matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED); + EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills); + CellularCallHandler secondHandler { subscriberInfo }; + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + secondHandler.SetSlotId(slotId); + auto event = AppExecFwk::InnerEvent::Get(0); + auto rilRadioResponse = std::make_shared(); + rilRadioResponse->error = ErrType::ERR_GENERIC_FAILURE; + secondHandler.CommonResultResponse(event); + auto rejectEvent = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_REJECT_CALL, rilRadioResponse); + secondHandler.CommonResultResponse(rejectEvent); + auto supplementEvent = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_CALL_SUPPLEMENT, rilRadioResponse); + secondHandler.CommonResultResponse(supplementEvent); - EventFwk::MatchingSkills matchingSkills; - matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED); - EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills); - CellularCallHandler secondHandler { subscriberInfo }; - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; - } - secondHandler.SetSlotId(slotId); - auto event = AppExecFwk::InnerEvent::Get(0); - auto rilRadioResponse = std::make_shared(); - rilRadioResponse->error = ErrType::ERR_GENERIC_FAILURE; - secondHandler.CommonResultResponse(event); - auto rejectEvent = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_REJECT_CALL, rilRadioResponse); - secondHandler.CommonResultResponse(rejectEvent); - auto supplementEvent = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_CALL_SUPPLEMENT, rilRadioResponse); - secondHandler.CommonResultResponse(supplementEvent); - - rilRadioResponse->error = ErrType::NONE; - auto hangupConnectEvent = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_HANGUP_CONNECT, rilRadioResponse); - secondHandler.CommonResultResponse(hangupConnectEvent); - auto acceptEvent = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_ACCEPT_CALL, rilRadioResponse); - secondHandler.CommonResultResponse(acceptEvent); - auto splitNoErrorEvent = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_SPLIT_CALL, rilRadioResponse); - secondHandler.CommonResultResponse(splitNoErrorEvent); + rilRadioResponse->error = ErrType::NONE; + auto hangupConnectEvent = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_HANGUP_CONNECT, rilRadioResponse); + secondHandler.CommonResultResponse(hangupConnectEvent); + auto acceptEvent = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_ACCEPT_CALL, rilRadioResponse); + secondHandler.CommonResultResponse(acceptEvent); + auto splitNoErrorEvent = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_SPLIT_CALL, rilRadioResponse); + secondHandler.CommonResultResponse(splitNoErrorEvent); - auto ssResult = std::make_shared(); - ssResult->index = INVALID_INDEX; - ssResult->result = SUCCESS_RESULT; - auto errorEvent = AppExecFwk::InnerEvent::Get(0, ssResult); - secondHandler.SetCallRestrictionResponse(event); - secondHandler.SetCallRestrictionResponse(errorEvent); - secondHandler.SetBarringPasswordResponse(event); - secondHandler.SetCallTransferInfoResponse(event); - secondHandler.SetCallWaitingResponse(event); - secondHandler.SetClipResponse(event); - secondHandler.SetClirResponse(event); - secondHandler.SetColpResponse(event); - secondHandler.SetColrResponse(event); + auto ssResult = std::make_shared(); + ssResult->index = INVALID_INDEX; + ssResult->result = SUCCESS_RESULT; + auto errorEvent = AppExecFwk::InnerEvent::Get(0, ssResult); + secondHandler.SetCallRestrictionResponse(event); + secondHandler.SetCallRestrictionResponse(errorEvent); + secondHandler.SetBarringPasswordResponse(event); + secondHandler.SetCallTransferInfoResponse(event); + secondHandler.SetCallWaitingResponse(event); + secondHandler.SetClipResponse(event); + secondHandler.SetClirResponse(event); + secondHandler.SetColpResponse(event); + secondHandler.SetColrResponse(event); - auto responseEvent = AppExecFwk::InnerEvent::Get(0, rilRadioResponse); - secondHandler.SetMuteResponse(event); - secondHandler.SetMuteResponse(responseEvent); - secondHandler.GetMuteResponse(event); - secondHandler.GetMuteResponse(responseEvent); - ASSERT_EQ(secondHandler.GetSlotId(), slotId); + auto responseEvent = AppExecFwk::InnerEvent::Get(0, rilRadioResponse); + secondHandler.SetMuteResponse(event); + secondHandler.SetMuteResponse(responseEvent); + secondHandler.GetMuteResponse(event); + secondHandler.GetMuteResponse(responseEvent); + ASSERT_EQ(secondHandler.GetSlotId(), slotId); + } } } @@ -1179,52 +1135,51 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallHandler_0002, Function | MediumTest HWTEST_F(Cs2Test, cellular_call_CellularCallHandler_0003, Function | MediumTest | Level3) { if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - EventFwk::MatchingSkills matchingSkills; - matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED); - EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills); - CellularCallHandler thirdhandler { subscriberInfo }; - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; - } - thirdhandler.SetSlotId(slotId); - auto event = AppExecFwk::InnerEvent::Get(0); - auto ussdNoticeResponse = std::make_shared(); - ussdNoticeResponse->m = USSD_MODE_NOTIFY; - ussdNoticeResponse->str = "tdd test"; - auto successEvent = AppExecFwk::InnerEvent::Get(0, ussdNoticeResponse); - thirdhandler.UssdNotifyResponse(event); - thirdhandler.UssdNotifyResponse(successEvent); - ussdNoticeResponse->str = ""; - auto errorEvent = AppExecFwk::InnerEvent::Get(0, ussdNoticeResponse); - thirdhandler.UssdNotifyResponse(errorEvent); + EventFwk::MatchingSkills matchingSkills; + matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED); + EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills); + CellularCallHandler thirdhandler { subscriberInfo }; + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + thirdhandler.SetSlotId(slotId); + auto event = AppExecFwk::InnerEvent::Get(0); + auto ussdNoticeResponse = std::make_shared(); + ussdNoticeResponse->m = USSD_MODE_NOTIFY; + ussdNoticeResponse->str = "tdd test"; + auto successEvent = AppExecFwk::InnerEvent::Get(0, ussdNoticeResponse); + thirdhandler.UssdNotifyResponse(event); + thirdhandler.UssdNotifyResponse(successEvent); + ussdNoticeResponse->str = ""; + auto errorEvent = AppExecFwk::InnerEvent::Get(0, ussdNoticeResponse); + thirdhandler.UssdNotifyResponse(errorEvent); - auto ssNoticeResponse = std::make_shared(); - ssNoticeResponse->result = ERROR_RESULT; - auto defaultEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse); - thirdhandler.SsNotifyResponse(event); - thirdhandler.SsNotifyResponse(defaultEvent); - ssNoticeResponse->requestType = SUCCESS_RESULT; - auto noticeErrorEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse); - thirdhandler.SsNotifyResponse(noticeErrorEvent); - ssNoticeResponse->result = SUCCESS_RESULT; - auto noticeDefaultEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse); - thirdhandler.SsNotifyResponse(noticeDefaultEvent); - ssNoticeResponse->serviceType = static_cast(CallTransferType::TRANSFER_TYPE_UNCONDITIONAL); - auto noticeUnconditinalEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse); - thirdhandler.SsNotifyResponse(noticeUnconditinalEvent); - ssNoticeResponse->serviceType = static_cast(CallTransferType::TRANSFER_TYPE_BUSY); - auto noticeBusyEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse); - thirdhandler.SsNotifyResponse(noticeBusyEvent); - ssNoticeResponse->serviceType = static_cast(CallTransferType::TRANSFER_TYPE_NO_REPLY); - auto noticeNoReplyEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse); - thirdhandler.SsNotifyResponse(noticeNoReplyEvent); - ssNoticeResponse->serviceType = static_cast(CallTransferType::TRANSFER_TYPE_NOT_REACHABLE); - auto noticeNotReachableEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse); - thirdhandler.SsNotifyResponse(noticeNotReachableEvent); - ASSERT_EQ(thirdhandler.GetSlotId(), slotId); + auto ssNoticeResponse = std::make_shared(); + ssNoticeResponse->result = ERROR_RESULT; + auto defaultEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse); + thirdhandler.SsNotifyResponse(event); + thirdhandler.SsNotifyResponse(defaultEvent); + ssNoticeResponse->requestType = SUCCESS_RESULT; + auto noticeErrorEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse); + thirdhandler.SsNotifyResponse(noticeErrorEvent); + ssNoticeResponse->result = SUCCESS_RESULT; + auto noticeDefaultEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse); + thirdhandler.SsNotifyResponse(noticeDefaultEvent); + ssNoticeResponse->serviceType = static_cast(CallTransferType::TRANSFER_TYPE_UNCONDITIONAL); + auto noticeUnconditinalEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse); + thirdhandler.SsNotifyResponse(noticeUnconditinalEvent); + ssNoticeResponse->serviceType = static_cast(CallTransferType::TRANSFER_TYPE_BUSY); + auto noticeBusyEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse); + thirdhandler.SsNotifyResponse(noticeBusyEvent); + ssNoticeResponse->serviceType = static_cast(CallTransferType::TRANSFER_TYPE_NO_REPLY); + auto noticeNoReplyEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse); + thirdhandler.SsNotifyResponse(noticeNoReplyEvent); + ssNoticeResponse->serviceType = static_cast(CallTransferType::TRANSFER_TYPE_NOT_REACHABLE); + auto noticeNotReachableEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse); + thirdhandler.SsNotifyResponse(noticeNotReachableEvent); + ASSERT_EQ(thirdhandler.GetSlotId(), slotId); + } } } -- Gitee From 5ce38b6b9aae09de15639dc920c19d1362c05de5 Mon Sep 17 00:00:00 2001 From: lishuo Date: Wed, 23 Apr 2025 02:34:14 +0000 Subject: [PATCH 06/16] =?UTF-8?q?dt=E7=94=A8=E4=BE=8B=E8=A7=84=E8=8C=83?= =?UTF-8?q?=EF=BC=8C=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- .../unittest/cstest/cs_calloperation_test.cpp | 610 ++++++++---------- 1 file changed, 256 insertions(+), 354 deletions(-) diff --git a/test/unittest/cstest/cs_calloperation_test.cpp b/test/unittest/cstest/cs_calloperation_test.cpp index f01f15d9..50c107a3 100644 --- a/test/unittest/cstest/cs_calloperation_test.cpp +++ b/test/unittest/cstest/cs_calloperation_test.cpp @@ -157,9 +157,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0001, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0002, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#30#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -177,9 +174,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0002, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0003, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#30#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -197,9 +191,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0003, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0004, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*31#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -217,9 +208,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0004, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0005, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#31#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -237,9 +225,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0005, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0006, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#31#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -257,9 +242,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0006, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0007, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*21#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -277,9 +259,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0007, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0008, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#21#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -297,9 +276,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0008, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0009, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#21#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -317,9 +293,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0009, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0010, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*33#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -337,9 +310,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0010, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0011, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#33#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -357,9 +327,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0011, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0012, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#33#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -377,9 +344,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0012, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0013, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*43#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -397,9 +361,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0013, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0014, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#43#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -417,9 +378,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0014, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0015, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#43#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -437,9 +395,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0015, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0016, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*04#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -457,9 +412,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0016, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0017, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*05#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -477,9 +429,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0017, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0018, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*042#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -497,9 +446,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0018, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0019, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*052#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -517,9 +463,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0019, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0020, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*4444#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -537,9 +480,6 @@ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0020, Function | MediumTest */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0021, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(INVALID_SLOTID, PHONE_NUMBER); EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); @@ -564,9 +504,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_HangUpCall_0001, Function | MediumTe ASSERT_TRUE(hangUpCallRemote != nullptr); auto telephonyService = iface_cast(hangUpCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + CellularCallInfo hangUpCallInfo; if (HasSimCard(SIM1_SLOTID)) { int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, hangUpCallInfo); @@ -595,27 +533,26 @@ HWTEST_F(CsCallOperationTest, cellular_call_HangUpCall_0002, Function | MediumTe { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto hangUpCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(hangUpCallRemote != nullptr); - auto telephonyService = iface_cast(hangUpCallRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo hangUpCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, hangUpCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo hangUpCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, hangUpCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto hangUpCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(hangUpCallRemote != nullptr); + auto telephonyService = iface_cast(hangUpCallRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo hangUpCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, hangUpCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo hangUpCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, hangUpCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -633,9 +570,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_AnswerCall_0001, Function | MediumTe ASSERT_TRUE(answerCallRemote != nullptr); auto telephonyService = iface_cast(answerCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo answerCallInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, answerCallInfo); @@ -661,27 +596,26 @@ HWTEST_F(CsCallOperationTest, cellular_call_AnswerCall_0002, Function | MediumTe { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto answerCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(answerCallRemote != nullptr); - auto telephonyService = iface_cast(answerCallRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo answerCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, answerCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Answer(answerCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo answerCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, answerCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Answer(answerCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto answerCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(answerCallRemote != nullptr); + auto telephonyService = iface_cast(answerCallRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo answerCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, answerCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Answer(answerCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo answerCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, answerCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Answer(answerCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -699,9 +633,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_RejectCall_0001, Function | MediumTe ASSERT_TRUE(rejectCallRemote != nullptr); auto telephonyService = iface_cast(rejectCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo rejectCallInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, rejectCallInfo); @@ -727,27 +659,26 @@ HWTEST_F(CsCallOperationTest, cellular_call_RejectCall_0002, Function | MediumTe { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto rejectCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(rejectCallRemote != nullptr); - auto telephonyService = iface_cast(rejectCallRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo rejectCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, rejectCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Reject(rejectCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo rejectCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, rejectCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Reject(rejectCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto rejectCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(rejectCallRemote != nullptr); + auto telephonyService = iface_cast(rejectCallRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo rejectCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, rejectCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Reject(rejectCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo rejectCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, rejectCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Reject(rejectCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -765,9 +696,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_HoldCall_0001, Function | MediumTest ASSERT_TRUE(holdCallRemote != nullptr); auto telephonyService = iface_cast(holdCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo holdCallInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, holdCallInfo); @@ -793,27 +722,26 @@ HWTEST_F(CsCallOperationTest, cellular_call_HoldCall_0002, Function | MediumTest { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto holdCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(holdCallRemote != nullptr); - auto telephonyService = iface_cast(holdCallRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo holdCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, holdCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HoldCall(holdCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo holdCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, holdCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HoldCall(holdCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto holdCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(holdCallRemote != nullptr); + auto telephonyService = iface_cast(holdCallRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo holdCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, holdCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HoldCall(holdCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo holdCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, holdCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HoldCall(holdCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -831,9 +759,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_UnHoldCall_0001, Function | MediumTe ASSERT_TRUE(unHoldCallRemote != nullptr); auto telephonyService = iface_cast(unHoldCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo unHoldCallInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, unHoldCallInfo); @@ -859,27 +785,26 @@ HWTEST_F(CsCallOperationTest, cellular_call_UnHoldCall_0002, Function | MediumTe { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto unHoldCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(unHoldCallRemote != nullptr); - auto telephonyService = iface_cast(unHoldCallRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo unHoldCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, unHoldCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->UnHoldCall(unHoldCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo unHoldCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, unHoldCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->UnHoldCall(unHoldCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto unHoldCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(unHoldCallRemote != nullptr); + auto telephonyService = iface_cast(unHoldCallRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo unHoldCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, unHoldCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->UnHoldCall(unHoldCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo unHoldCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, unHoldCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->UnHoldCall(unHoldCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -897,9 +822,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_SwitchCall_0001, Function | MediumTe ASSERT_TRUE(switchCallRemote != nullptr); auto telephonyService = iface_cast(switchCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo switchCallInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, switchCallInfo); @@ -925,27 +848,26 @@ HWTEST_F(CsCallOperationTest, cellular_call_SwitchCall_0002, Function | MediumTe { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto switchCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(switchCallRemote != nullptr); - auto telephonyService = iface_cast(switchCallRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo switchCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, switchCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SwitchCall(switchCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo switchCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, switchCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SwitchCall(switchCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto switchCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(switchCallRemote != nullptr); + auto telephonyService = iface_cast(switchCallRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo switchCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, switchCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SwitchCall(switchCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo switchCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, switchCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SwitchCall(switchCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -963,9 +885,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_CombineConference_0001, Function | M ASSERT_TRUE(combineRemote != nullptr); auto telephonyService = iface_cast(combineRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo conferenceCallInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, conferenceCallInfo); @@ -991,27 +911,26 @@ HWTEST_F(CsCallOperationTest, cellular_call_CombineConference_0002, Function | M { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto combineRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(combineRemote != nullptr); - auto telephonyService = iface_cast(combineRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo conferenceCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, conferenceCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->CombineConference(conferenceCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo conferenceCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, conferenceCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->CombineConference(conferenceCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto combineRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(combineRemote != nullptr); + auto telephonyService = iface_cast(combineRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo conferenceCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, conferenceCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->CombineConference(conferenceCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo conferenceCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, conferenceCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->CombineConference(conferenceCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -1029,9 +948,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_SeparateConference_0001, Function | ASSERT_TRUE(separateRemote != nullptr); auto telephonyService = iface_cast(separateRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo callInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); @@ -1057,27 +974,26 @@ HWTEST_F(CsCallOperationTest, cellular_call_SeparateConference_0002, Function | { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto separateRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(separateRemote != nullptr); - auto telephonyService = iface_cast(separateRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo separateCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, separateCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SeparateConference(separateCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo separateCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, separateCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SeparateConference(separateCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto separateRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(separateRemote != nullptr); + auto telephonyService = iface_cast(separateRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo separateCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, separateCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SeparateConference(separateCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo separateCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, separateCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SeparateConference(separateCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -1095,9 +1011,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_KickOutFromConference_0001, Function ASSERT_TRUE(kickOutRemote != nullptr); auto telephonyService = iface_cast(kickOutRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo kickOutCallInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, kickOutCallInfo); @@ -1123,27 +1037,26 @@ HWTEST_F(CsCallOperationTest, cellular_call_KickOutFromConference_0002, Function { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto kickOutRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(kickOutRemote != nullptr); - auto telephonyService = iface_cast(kickOutRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo kickOutCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, kickOutCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->KickOutFromConference(kickOutCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo kickOutCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, kickOutCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->KickOutFromConference(kickOutCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto kickOutRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(kickOutRemote != nullptr); + auto telephonyService = iface_cast(kickOutRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo kickOutCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, kickOutCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->KickOutFromConference(kickOutCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo kickOutCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, kickOutCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->KickOutFromConference(kickOutCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -1161,9 +1074,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_HangUpAllConnection_0001, Function | ASSERT_TRUE(hangUpAllConRemote != nullptr); auto telephonyService = iface_cast(hangUpAllConRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { int32_t ret = telephonyService->HangUpAllConnection(); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -1188,9 +1099,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_StartDtmf_0001, Function | MediumTes ASSERT_TRUE(startDtmfRemote != nullptr); auto telephonyService = iface_cast(startDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo callInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); @@ -1218,28 +1127,27 @@ HWTEST_F(CsCallOperationTest, cellular_call_StartDtmf_0002, Function | MediumTes { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto startDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(startDtmfRemote != nullptr); - auto telephonyService = iface_cast(startDtmfRemote); - ASSERT_TRUE(telephonyService != nullptr); - CellularCallInfo callInfo; - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->StartDtmf(code, callInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->StartDtmf(code, callInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto startDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(startDtmfRemote != nullptr); + auto telephonyService = iface_cast(startDtmfRemote); + ASSERT_TRUE(telephonyService != nullptr); + CellularCallInfo callInfo; + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->StartDtmf(code, callInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->StartDtmf(code, callInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -1257,9 +1165,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_StopDtmf_0001, Function | MediumTest ASSERT_TRUE(stopDtmfRemote != nullptr); auto telephonyService = iface_cast(stopDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo callInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); @@ -1285,27 +1191,26 @@ HWTEST_F(CsCallOperationTest, cellular_call_StopDtmf_0002, Function | MediumTest { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto stopDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(stopDtmfRemote != nullptr); - auto telephonyService = iface_cast(stopDtmfRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo stopDtmfCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->StopDtmf(stopDtmfCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo stopDtmfCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->StopDtmf(stopDtmfCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto stopDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(stopDtmfRemote != nullptr); + auto telephonyService = iface_cast(stopDtmfRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo stopDtmfCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->StopDtmf(stopDtmfCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo stopDtmfCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->StopDtmf(stopDtmfCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -1323,9 +1228,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_SendDtmf_0001, Function | MediumTest ASSERT_TRUE(sendDtmfRemote != nullptr); auto telephonyService = iface_cast(sendDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo sendDtmfCallInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); @@ -1353,29 +1256,28 @@ HWTEST_F(CsCallOperationTest, cellular_call_SendDtmf_0002, Function | MediumTest { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto sendDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(sendDtmfRemote != nullptr); - auto telephonyService = iface_cast(sendDtmfRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo sendDtmfCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->SendDtmf(code, sendDtmfCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo sendDtmfCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->SendDtmf(code, sendDtmfCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto sendDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(sendDtmfRemote != nullptr); + auto telephonyService = iface_cast(sendDtmfRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo sendDtmfCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->SendDtmf(code, sendDtmfCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo sendDtmfCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->SendDtmf(code, sendDtmfCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } } // namespace Telephony -- Gitee From 21bb1e20e7837bffd4b91a1465039d1da9c66545 Mon Sep 17 00:00:00 2001 From: lishuo Date: Wed, 23 Apr 2025 02:41:06 +0000 Subject: [PATCH 07/16] =?UTF-8?q?dt=E7=94=A8=E4=BE=8B=E8=A7=84=E8=8C=83?= =?UTF-8?q?=EF=BC=8C=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- .../unittest/satellitetest/satellite_test.cpp | 157 ++++++++---------- 1 file changed, 70 insertions(+), 87 deletions(-) diff --git a/test/unittest/satellitetest/satellite_test.cpp b/test/unittest/satellitetest/satellite_test.cpp index b3041178..772631db 100644 --- a/test/unittest/satellitetest/satellite_test.cpp +++ b/test/unittest/satellitetest/satellite_test.cpp @@ -167,9 +167,7 @@ HWTEST_F(SatelliteTest, Satellite_call_DialCall_0001, Function | MediumTest | Le ASSERT_TRUE(hangUpCallRemote != nullptr); auto telephonyService = iface_cast(hangUpCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallBySatellite(SIM1_SLOTID, PHONE_NUMBER); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -199,9 +197,7 @@ HWTEST_F(SatelliteTest, Satellite_call_HangUpCall_0001, Function | MediumTest | ASSERT_TRUE(hangUpCallRemote != nullptr); auto telephonyService = iface_cast(hangUpCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo callInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); @@ -233,9 +229,7 @@ HWTEST_F(SatelliteTest, Satellite_call_AnswerCall_0001, Function | MediumTest | ASSERT_TRUE(answerCallRemote != nullptr); auto telephonyService = iface_cast(answerCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo callInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); @@ -267,9 +261,7 @@ HWTEST_F(SatelliteTest, Satellite_call_RejectCall_0001, Function | MediumTest | ASSERT_TRUE(rejectCallRemote != nullptr); auto telephonyService = iface_cast(rejectCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo callInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); @@ -299,9 +291,7 @@ HWTEST_F(SatelliteTest, Satellite_call_StartDtmf_0001, Function | MediumTest | L ASSERT_TRUE(startDtmfRemote != nullptr); auto telephonyService = iface_cast(startDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo callInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); @@ -329,28 +319,27 @@ HWTEST_F(SatelliteTest, Satellite_call_StartDtmf_0002, Function | MediumTest | L { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto startDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(startDtmfRemote != nullptr); - auto telephonyService = iface_cast(startDtmfRemote); - ASSERT_TRUE(telephonyService != nullptr); - CellularCallInfo callInfo; - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->StartDtmf(code, callInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->StartDtmf(code, callInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto startDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(startDtmfRemote != nullptr); + auto telephonyService = iface_cast(startDtmfRemote); + ASSERT_TRUE(telephonyService != nullptr); + CellularCallInfo callInfo; + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->StartDtmf(code, callInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->StartDtmf(code, callInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -368,9 +357,7 @@ HWTEST_F(SatelliteTest, Satellite_call_StopDtmf_0001, Function | MediumTest | Le ASSERT_TRUE(stopDtmfRemote != nullptr); auto telephonyService = iface_cast(stopDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo callInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); @@ -396,27 +383,26 @@ HWTEST_F(SatelliteTest, Satellite_call_StopDtmf_0002, Function | MediumTest | Le { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto stopDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(stopDtmfRemote != nullptr); - auto telephonyService = iface_cast(stopDtmfRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo stopDtmfCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->StopDtmf(stopDtmfCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo stopDtmfCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->StopDtmf(stopDtmfCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto stopDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(stopDtmfRemote != nullptr); + auto telephonyService = iface_cast(stopDtmfRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo stopDtmfCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->StopDtmf(stopDtmfCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo stopDtmfCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->StopDtmf(stopDtmfCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } @@ -434,9 +420,7 @@ HWTEST_F(SatelliteTest, Satellite_call_SendDtmf_0001, Function | MediumTest | Le ASSERT_TRUE(sendDtmfRemote != nullptr); auto telephonyService = iface_cast(sendDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } + if (HasSimCard(SIM1_SLOTID)) { CellularCallInfo sendDtmfCallInfo; int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); @@ -464,29 +448,28 @@ HWTEST_F(SatelliteTest, Satellite_call_SendDtmf_0002, Function | MediumTest | Le { AccessToken token; if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - ASSERT_TRUE(systemAbilityMgr != nullptr); - auto sendDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); - ASSERT_TRUE(sendDtmfRemote != nullptr); - auto telephonyService = iface_cast(sendDtmfRemote); - ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo sendDtmfCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->SendDtmf(code, sendDtmfCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo sendDtmfCallInfo; - int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->SendDtmf(code, sendDtmfCallInfo); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + ASSERT_TRUE(systemAbilityMgr != nullptr); + auto sendDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); + ASSERT_TRUE(sendDtmfRemote != nullptr); + auto telephonyService = iface_cast(sendDtmfRemote); + ASSERT_TRUE(telephonyService != nullptr); + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo sendDtmfCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->SendDtmf(code, sendDtmfCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo sendDtmfCallInfo; + int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->SendDtmf(code, sendDtmfCallInfo); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } } } } // namespace Telephony -- Gitee From cf083bf3ffe47d21420b10592ad3a28bf7daeaec Mon Sep 17 00:00:00 2001 From: lishuo Date: Wed, 23 Apr 2025 02:49:51 +0000 Subject: [PATCH 08/16] =?UTF-8?q?dt=E7=94=A8=E4=BE=8B=E8=A7=84=E8=8C=83?= =?UTF-8?q?=EF=BC=8C=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- .../satellitetest/satellite_callback_test.cpp | 81 +++++++++---------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/test/unittest/satellitetest/satellite_callback_test.cpp b/test/unittest/satellitetest/satellite_callback_test.cpp index 35a4f8c3..ffab6e78 100644 --- a/test/unittest/satellitetest/satellite_callback_test.cpp +++ b/test/unittest/satellitetest/satellite_callback_test.cpp @@ -157,48 +157,47 @@ HWTEST_F(SatelliteCallbackTest, cellular_call_SatelliteCallCallbackStub_0001, Fu sptr stub = (std::make_unique()).release(); ASSERT_TRUE(stub != nullptr); if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } - for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { - if (!HasSimCard(slotId)) { - continue; + for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { + if (!HasSimCard(slotId)) { + continue; + } + RadioResponseInfo rilRadioResponse; + rilRadioResponse.error = ErrType::ERR_GENERIC_FAILURE; + MessageParcel answerData; + MessageParcel answerReply; + ASSERT_TRUE(answerData.WriteInt32(slotId)); + ASSERT_TRUE(answerData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stub->OnAnswerResponseInner(answerData, answerReply), TELEPHONY_SUCCESS); + + MessageParcel dialData; + MessageParcel dialReply; + ASSERT_TRUE(dialData.WriteInt32(slotId)); + ASSERT_TRUE(dialData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stub->OnDialResponseInner(dialData, dialReply), TELEPHONY_SUCCESS); + + MessageParcel CallsData; + MessageParcel CallsReply; + ASSERT_TRUE(CallsData.WriteInt32(slotId)); + ASSERT_TRUE(CallsData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stub->OnGetSatelliteCallsDataResponseInner(CallsData, CallsReply), TELEPHONY_SUCCESS); + + MessageParcel hangupData; + MessageParcel hangupReply; + ASSERT_TRUE(hangupData.WriteInt32(slotId)); + ASSERT_TRUE(hangupData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stub->OnHangUpResponseInner(hangupData, hangupReply), TELEPHONY_SUCCESS); + + MessageParcel rejectData; + MessageParcel rejectReply; + ASSERT_TRUE(rejectData.WriteInt32(slotId)); + ASSERT_TRUE(rejectData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); + ASSERT_EQ(stub->OnRejectResponseInner(rejectData, rejectReply), TELEPHONY_SUCCESS); + + MessageParcel statechangeData; + MessageParcel statechangeReply; + ASSERT_TRUE(statechangeData.WriteInt32(slotId)); + ASSERT_EQ(stub->OnCallStateChangeReportInner(statechangeData, statechangeReply), TELEPHONY_SUCCESS); } - RadioResponseInfo rilRadioResponse; - rilRadioResponse.error = ErrType::ERR_GENERIC_FAILURE; - MessageParcel answerData; - MessageParcel answerReply; - ASSERT_TRUE(answerData.WriteInt32(slotId)); - ASSERT_TRUE(answerData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stub->OnAnswerResponseInner(answerData, answerReply), TELEPHONY_SUCCESS); - - MessageParcel dialData; - MessageParcel dialReply; - ASSERT_TRUE(dialData.WriteInt32(slotId)); - ASSERT_TRUE(dialData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stub->OnDialResponseInner(dialData, dialReply), TELEPHONY_SUCCESS); - - MessageParcel CallsData; - MessageParcel CallsReply; - ASSERT_TRUE(CallsData.WriteInt32(slotId)); - ASSERT_TRUE(CallsData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stub->OnGetSatelliteCallsDataResponseInner(CallsData, CallsReply), TELEPHONY_SUCCESS); - - MessageParcel hangupData; - MessageParcel hangupReply; - ASSERT_TRUE(hangupData.WriteInt32(slotId)); - ASSERT_TRUE(hangupData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stub->OnHangUpResponseInner(hangupData, hangupReply), TELEPHONY_SUCCESS); - - MessageParcel rejectData; - MessageParcel rejectReply; - ASSERT_TRUE(rejectData.WriteInt32(slotId)); - ASSERT_TRUE(rejectData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); - ASSERT_EQ(stub->OnRejectResponseInner(rejectData, rejectReply), TELEPHONY_SUCCESS); - - MessageParcel statechangeData; - MessageParcel statechangeReply; - ASSERT_TRUE(statechangeData.WriteInt32(slotId)); - ASSERT_EQ(stub->OnCallStateChangeReportInner(statechangeData, statechangeReply), TELEPHONY_SUCCESS); } } -- Gitee From 471c422833ac464cdb991b0f89a7aa19d1233cd4 Mon Sep 17 00:00:00 2001 From: lishuo Date: Wed, 23 Apr 2025 03:07:11 +0000 Subject: [PATCH 09/16] =?UTF-8?q?dt=E7=94=A8=E4=BE=8B=E8=A7=84=E8=8C=83?= =?UTF-8?q?=EF=BC=8C=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- .../ims_service_gtest/ims_service_test.cpp | 926 ++++++++---------- 1 file changed, 422 insertions(+), 504 deletions(-) diff --git a/vendor/ims/test/unittest/ims_service_gtest/ims_service_test.cpp b/vendor/ims/test/unittest/ims_service_gtest/ims_service_test.cpp index 40439024..8c1aad2f 100644 --- a/vendor/ims/test/unittest/ims_service_gtest/ims_service_test.cpp +++ b/vendor/ims/test/unittest/ims_service_gtest/ims_service_test.cpp @@ -110,17 +110,16 @@ int32_t ImsServiceTest::InitConditionCheck() */ HWTEST_F(ImsServiceTest, Telephony_ImsService_DIAL_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; - } - int32_t ret = TELEPHONY_ERROR; - if (memset_s(&callInfoForSlot0_, sizeof(callInfoForSlot0_), 0, sizeof(callInfoForSlot0_)) == EOK) { - ret = TELEPHONY_SUCCESS; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + if (memset_s(&callInfoForSlot0_, sizeof(callInfoForSlot0_), 0, sizeof(callInfoForSlot0_)) == EOK) { + ret = TELEPHONY_SUCCESS; + } + EXPECT_EQ(TELEPHONY_SUCCESS, ret); + CLIRMode mode = CLIRMode::DEFAULT; + ret = imsCallPtr_->Dial(callInfoForSlot0_, mode); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - EXPECT_EQ(TELEPHONY_SUCCESS, ret); - CLIRMode mode = CLIRMode::DEFAULT; - ret = imsCallPtr_->Dial(callInfoForSlot0_, mode); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -130,17 +129,16 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_DIAL_001, Function | MediumTest | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_DIAL_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; - } - int32_t ret = TELEPHONY_ERROR; - if (memset_s(&callInfoForSlot1_, sizeof(callInfoForSlot1_), 0, sizeof(callInfoForSlot1_)) == EOK) { - ret = TELEPHONY_SUCCESS; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + if (memset_s(&callInfoForSlot1_, sizeof(callInfoForSlot1_), 0, sizeof(callInfoForSlot1_)) == EOK) { + ret = TELEPHONY_SUCCESS; + } + EXPECT_EQ(TELEPHONY_SUCCESS, ret); + CLIRMode mode = CLIRMode::DEFAULT; + ret = imsCallPtr_->Dial(callInfoForSlot1_, mode); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - EXPECT_EQ(TELEPHONY_SUCCESS, ret); - CLIRMode mode = CLIRMode::DEFAULT; - ret = imsCallPtr_->Dial(callInfoForSlot1_, mode); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -150,16 +148,15 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_DIAL_002, Function | MediumTest | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_HangUP_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; - } - int32_t ret = TELEPHONY_ERROR; - if (memset_s(&callInfoForSlot0_, sizeof(callInfoForSlot0_), 0, sizeof(callInfoForSlot0_)) == EOK) { - ret = TELEPHONY_SUCCESS; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + if (memset_s(&callInfoForSlot0_, sizeof(callInfoForSlot0_), 0, sizeof(callInfoForSlot0_)) == EOK) { + ret = TELEPHONY_SUCCESS; + } + EXPECT_EQ(TELEPHONY_SUCCESS, ret); + ret = imsCallPtr_->HangUp(callInfoForSlot0_); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - EXPECT_EQ(TELEPHONY_SUCCESS, ret); - ret = imsCallPtr_->HangUp(callInfoForSlot0_); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -169,16 +166,15 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_HangUP_001, Function | MediumTest */ HWTEST_F(ImsServiceTest, Telephony_ImsService_HangUP_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; - } - int32_t ret = TELEPHONY_ERROR; - if (memset_s(&callInfoForSlot1_, sizeof(callInfoForSlot1_), 0, sizeof(callInfoForSlot1_)) == EOK) { - ret = TELEPHONY_SUCCESS; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + if (memset_s(&callInfoForSlot1_, sizeof(callInfoForSlot1_), 0, sizeof(callInfoForSlot1_)) == EOK) { + ret = TELEPHONY_SUCCESS; + } + EXPECT_EQ(TELEPHONY_SUCCESS, ret); + ret = imsCallPtr_->HangUp(callInfoForSlot1_); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - EXPECT_EQ(TELEPHONY_SUCCESS, ret); - ret = imsCallPtr_->HangUp(callInfoForSlot1_); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -188,16 +184,15 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_HangUP_002, Function | MediumTest */ HWTEST_F(ImsServiceTest, Telephony_ImsService_RejectWithReason_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; - } - int32_t ret = TELEPHONY_ERROR; - if (memset_s(&callInfoForSlot0_, sizeof(callInfoForSlot0_), 0, sizeof(callInfoForSlot0_)) == EOK) { - ret = TELEPHONY_SUCCESS; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + if (memset_s(&callInfoForSlot0_, sizeof(callInfoForSlot0_), 0, sizeof(callInfoForSlot0_)) == EOK) { + ret = TELEPHONY_SUCCESS; + } + EXPECT_EQ(TELEPHONY_SUCCESS, ret); + ret = imsCallPtr_->RejectWithReason(callInfoForSlot0_, ImsRejectReason::USER_DECLINE); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - EXPECT_EQ(TELEPHONY_SUCCESS, ret); - ret = imsCallPtr_->RejectWithReason(callInfoForSlot0_, ImsRejectReason::USER_DECLINE); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -207,16 +202,15 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_RejectWithReason_001, Function | M */ HWTEST_F(ImsServiceTest, Telephony_ImsService_RejectWithReason_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; - } - int32_t ret = TELEPHONY_ERROR; - if (memset_s(&callInfoForSlot1_, sizeof(callInfoForSlot1_), 0, sizeof(callInfoForSlot1_)) == EOK) { - ret = TELEPHONY_SUCCESS; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + if (memset_s(&callInfoForSlot1_, sizeof(callInfoForSlot1_), 0, sizeof(callInfoForSlot1_)) == EOK) { + ret = TELEPHONY_SUCCESS; + } + EXPECT_EQ(TELEPHONY_SUCCESS, ret); + ret = imsCallPtr_->RejectWithReason(callInfoForSlot1_, ImsRejectReason::USER_DECLINE); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - EXPECT_EQ(TELEPHONY_SUCCESS, ret); - ret = imsCallPtr_->RejectWithReason(callInfoForSlot1_, ImsRejectReason::USER_DECLINE); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -226,16 +220,15 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_RejectWithReason_002, Function | M */ HWTEST_F(ImsServiceTest, Telephony_ImsService_Answer_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; - } - int32_t ret = TELEPHONY_ERROR; - if (memset_s(&callInfoForSlot0_, sizeof(callInfoForSlot0_), 0, sizeof(callInfoForSlot0_)) == EOK) { - ret = TELEPHONY_SUCCESS; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + if (memset_s(&callInfoForSlot0_, sizeof(callInfoForSlot0_), 0, sizeof(callInfoForSlot0_)) == EOK) { + ret = TELEPHONY_SUCCESS; + } + EXPECT_EQ(TELEPHONY_SUCCESS, ret); + ret = imsCallPtr_->Answer(callInfoForSlot0_); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - EXPECT_EQ(TELEPHONY_SUCCESS, ret); - ret = imsCallPtr_->Answer(callInfoForSlot0_); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -245,16 +238,15 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_Answer_001, Function | MediumTest */ HWTEST_F(ImsServiceTest, Telephony_ImsService_Answer_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; - } - int32_t ret = TELEPHONY_ERROR; - if (memset_s(&callInfoForSlot1_, sizeof(callInfoForSlot1_), 0, sizeof(callInfoForSlot1_)) == EOK) { - ret = TELEPHONY_SUCCESS; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + if (memset_s(&callInfoForSlot1_, sizeof(callInfoForSlot1_), 0, sizeof(callInfoForSlot1_)) == EOK) { + ret = TELEPHONY_SUCCESS; + } + EXPECT_EQ(TELEPHONY_SUCCESS, ret); + ret = imsCallPtr_->Answer(callInfoForSlot1_); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - EXPECT_EQ(TELEPHONY_SUCCESS, ret); - ret = imsCallPtr_->Answer(callInfoForSlot1_); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -264,12 +256,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_Answer_002, Function | MediumTest */ HWTEST_F(ImsServiceTest, Telephony_ImsService_HoldCall_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->HoldCall(DEFAULT_SLOTID, CALL_TYPE_IMS); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->HoldCall(DEFAULT_SLOTID, CALL_TYPE_IMS); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -279,12 +270,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_HoldCall_001, Function | MediumTes */ HWTEST_F(ImsServiceTest, Telephony_ImsService_HoldCall_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->HoldCall(SIM_SLOT_ID_1, CALL_TYPE_IMS); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->HoldCall(SIM_SLOT_ID_1, CALL_TYPE_IMS); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -294,12 +284,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_HoldCall_002, Function | MediumTes */ HWTEST_F(ImsServiceTest, Telephony_ImsService_UnHoldCall_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->UnHoldCall(DEFAULT_SLOTID, CALL_TYPE_IMS); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->UnHoldCall(DEFAULT_SLOTID, CALL_TYPE_IMS); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -309,12 +298,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_UnHoldCall_001, Function | MediumT */ HWTEST_F(ImsServiceTest, Telephony_ImsService_UnHoldCall_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->UnHoldCall(SIM_SLOT_ID_1, CALL_TYPE_IMS); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->UnHoldCall(SIM_SLOT_ID_1, CALL_TYPE_IMS); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -324,12 +312,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_UnHoldCall_002, Function | MediumT */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SwitchCall_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->SwitchCall(DEFAULT_SLOTID, CALL_TYPE_IMS); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->SwitchCall(DEFAULT_SLOTID, CALL_TYPE_IMS); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -339,12 +326,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SwitchCall_001, Function | MediumT */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SwitchCall_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->SwitchCall(SIM_SLOT_ID_1, CALL_TYPE_IMS); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->SwitchCall(SIM_SLOT_ID_1, CALL_TYPE_IMS); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -354,12 +340,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SwitchCall_002, Function | MediumT */ HWTEST_F(ImsServiceTest, Telephony_ImsService_CombineConference_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->CombineConference(DEFAULT_SLOTID); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->CombineConference(DEFAULT_SLOTID); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -369,12 +354,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_CombineConference_001, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_CombineConference_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->CombineConference(SIM_SLOT_ID_1); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->CombineConference(SIM_SLOT_ID_1); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -384,14 +368,13 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_CombineConference_002, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_InviteToConference_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + std::vector numberList; + numberList.push_back(PHONE_NUMBER); + ret = imsCallPtr_->InviteToConference(DEFAULT_SLOTID, numberList); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - std::vector numberList; - numberList.push_back(PHONE_NUMBER); - ret = imsCallPtr_->InviteToConference(DEFAULT_SLOTID, numberList); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -401,14 +384,13 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_InviteToConference_001, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_InviteToConference_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + std::vector numberList; + numberList.push_back(PHONE_NUMBER); + ret = imsCallPtr_->InviteToConference(SIM_SLOT_ID_1, numberList); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - std::vector numberList; - numberList.push_back(PHONE_NUMBER); - ret = imsCallPtr_->InviteToConference(SIM_SLOT_ID_1, numberList); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -418,13 +400,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_InviteToConference_002, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_KickOutFromConference_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + int32_t index = 1; + int32_t ret = imsCallPtr_->KickOutFromConference(DEFAULT_SLOTID, index); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - int32_t index = 1; - int32_t ret = imsCallPtr_->KickOutFromConference(DEFAULT_SLOTID, index); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -434,13 +415,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_KickOutFromConference_001, Functio */ HWTEST_F(ImsServiceTest, Telephony_ImsService_KickOutFromConference_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + int32_t index = 1; + int32_t ret = imsCallPtr_->KickOutFromConference(SIM_SLOT_ID_1, index); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - int32_t index = 1; - int32_t ret = imsCallPtr_->KickOutFromConference(SIM_SLOT_ID_1, index); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -450,16 +430,15 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_KickOutFromConference_002, Functio */ HWTEST_F(ImsServiceTest, Telephony_ImsService_UpdateImsCallMode_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; - } - int32_t ret = TELEPHONY_ERROR; - if (memset_s(&callInfoForSlot0_, sizeof(callInfoForSlot0_), 0, sizeof(callInfoForSlot0_)) == EOK) { - ret = TELEPHONY_SUCCESS; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + if (memset_s(&callInfoForSlot0_, sizeof(callInfoForSlot0_), 0, sizeof(callInfoForSlot0_)) == EOK) { + ret = TELEPHONY_SUCCESS; + } + EXPECT_EQ(TELEPHONY_SUCCESS, ret); + ret = imsCallPtr_->UpdateImsCallMode(callInfoForSlot0_, static_cast(DEFAULT_MODE)); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - EXPECT_EQ(TELEPHONY_SUCCESS, ret); - ret = imsCallPtr_->UpdateImsCallMode(callInfoForSlot0_, static_cast(DEFAULT_MODE)); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -469,16 +448,15 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_UpdateImsCallMode_001, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_UpdateImsCallMode_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; - } - int32_t ret = TELEPHONY_ERROR; - if (memset_s(&callInfoForSlot1_, sizeof(callInfoForSlot1_), 0, sizeof(callInfoForSlot1_)) == EOK) { - ret = TELEPHONY_SUCCESS; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + if (memset_s(&callInfoForSlot1_, sizeof(callInfoForSlot1_), 0, sizeof(callInfoForSlot1_)) == EOK) { + ret = TELEPHONY_SUCCESS; + } + EXPECT_EQ(TELEPHONY_SUCCESS, ret); + ret = imsCallPtr_->UpdateImsCallMode(callInfoForSlot1_, static_cast(DEFAULT_MODE)); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - EXPECT_EQ(TELEPHONY_SUCCESS, ret); - ret = imsCallPtr_->UpdateImsCallMode(callInfoForSlot1_, static_cast(DEFAULT_MODE)); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -488,13 +466,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_UpdateImsCallMode_002, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_StartDtmf_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + char dtmfCode = '#'; + ret = imsCallPtr_->StartDtmf(DEFAULT_SLOTID, dtmfCode, DEFAULT_INDEX); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - char dtmfCode = '#'; - ret = imsCallPtr_->StartDtmf(DEFAULT_SLOTID, dtmfCode, DEFAULT_INDEX); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -504,13 +481,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_StartDtmf_001, Function | MediumTe */ HWTEST_F(ImsServiceTest, Telephony_ImsService_StartDtmf_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + char dtmfCode = '#'; + ret = imsCallPtr_->StartDtmf(SIM_SLOT_ID_1, dtmfCode, DEFAULT_INDEX); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - char dtmfCode = '#'; - ret = imsCallPtr_->StartDtmf(SIM_SLOT_ID_1, dtmfCode, DEFAULT_INDEX); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -520,13 +496,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_StartDtmf_002, Function | MediumTe */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SendDtmf_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + char dtmfCode = '#'; + ret = imsCallPtr_->SendDtmf(DEFAULT_SLOTID, dtmfCode, DEFAULT_INDEX); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - char dtmfCode = '#'; - ret = imsCallPtr_->SendDtmf(DEFAULT_SLOTID, dtmfCode, DEFAULT_INDEX); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -536,13 +511,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SendDtmf_001, Function | MediumTes */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SendDtmf_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + char dtmfCode = '#'; + ret = imsCallPtr_->SendDtmf(SIM_SLOT_ID_1, dtmfCode, DEFAULT_INDEX); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - char dtmfCode = '#'; - ret = imsCallPtr_->SendDtmf(SIM_SLOT_ID_1, dtmfCode, DEFAULT_INDEX); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -552,12 +526,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SendDtmf_002, Function | MediumTes */ HWTEST_F(ImsServiceTest, Telephony_ImsService_StopDtmf_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->StopDtmf(DEFAULT_SLOTID, DEFAULT_INDEX); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->StopDtmf(DEFAULT_SLOTID, DEFAULT_INDEX); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -567,12 +540,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_StopDtmf_001, Function | MediumTes */ HWTEST_F(ImsServiceTest, Telephony_ImsService_StopDtmf_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->StopDtmf(SIM_SLOT_ID_1, DEFAULT_INDEX); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->StopDtmf(SIM_SLOT_ID_1, DEFAULT_INDEX); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -582,12 +554,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_StopDtmf_002, Function | MediumTes */ HWTEST_F(ImsServiceTest, Telephony_ImsService_StartRtt_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->StartRtt(DEFAULT_SLOTID, RTT_MSG); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->StartRtt(DEFAULT_SLOTID, RTT_MSG); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -597,12 +568,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_StartRtt_001, Function | MediumTes */ HWTEST_F(ImsServiceTest, Telephony_ImsService_StartRtt_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->StartRtt(SIM_SLOT_ID_1, RTT_MSG); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->StartRtt(SIM_SLOT_ID_1, RTT_MSG); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -612,12 +582,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_StartRtt_002, Function | MediumTes */ HWTEST_F(ImsServiceTest, Telephony_ImsService_StopRtt_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->StopRtt(DEFAULT_SLOTID); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->StopRtt(DEFAULT_SLOTID); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -627,12 +596,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_StopRtt_001, Function | MediumTest */ HWTEST_F(ImsServiceTest, Telephony_ImsService_StopRtt_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->StopRtt(SIM_SLOT_ID_1); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->StopRtt(SIM_SLOT_ID_1); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -642,12 +610,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_StopRtt_002, Function | MediumTest */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetDomainPreferenceMode_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->SetDomainPreferenceMode(DEFAULT_SLOTID, DEFAULT_MODE); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->SetDomainPreferenceMode(DEFAULT_SLOTID, DEFAULT_MODE); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -657,12 +624,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetDomainPreferenceMode_001, Funct */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetDomainPreferenceMode_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->SetDomainPreferenceMode(SIM_SLOT_ID_1, DEFAULT_MODE); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->SetDomainPreferenceMode(SIM_SLOT_ID_1, DEFAULT_MODE); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -672,12 +638,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetDomainPreferenceMode_002, Funct */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetDomainPreferenceMode_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->GetDomainPreferenceMode(DEFAULT_SLOTID); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->GetDomainPreferenceMode(DEFAULT_SLOTID); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -687,12 +652,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetDomainPreferenceMode_001, Funct */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetDomainPreferenceMode_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->GetDomainPreferenceMode(SIM_SLOT_ID_1); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->GetDomainPreferenceMode(SIM_SLOT_ID_1); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -702,12 +666,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetDomainPreferenceMode_002, Funct */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetImsSwitchStatus_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->SetImsSwitchStatus(DEFAULT_SLOTID, DEFAULT_ACTIVE); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->SetImsSwitchStatus(DEFAULT_SLOTID, DEFAULT_ACTIVE); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -717,12 +680,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetImsSwitchStatus_001, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetImsSwitchStatus_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->SetImsSwitchStatus(SIM_SLOT_ID_1, DEFAULT_ACTIVE); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->SetImsSwitchStatus(SIM_SLOT_ID_1, DEFAULT_ACTIVE); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -732,12 +694,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetImsSwitchStatus_002, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetImsSwitchStatus_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->GetImsSwitchStatus(DEFAULT_SLOTID); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->GetImsSwitchStatus(DEFAULT_SLOTID); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -747,12 +708,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetImsSwitchStatus_001, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetImsSwitchStatus_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->GetImsSwitchStatus(SIM_SLOT_ID_1); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->GetImsSwitchStatus(SIM_SLOT_ID_1); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -762,13 +722,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetImsSwitchStatus_002, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetImsConfigString_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + std::string value = "0"; + ret = imsCallPtr_->SetImsConfig(DEFAULT_ITEM, value); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - std::string value = "0"; - ret = imsCallPtr_->SetImsConfig(DEFAULT_ITEM, value); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -778,13 +737,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetImsConfigString_001, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetImsConfigInt_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + int32_t value = 0; + ret = imsCallPtr_->SetImsConfig(DEFAULT_ITEM, value); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - int32_t value = 0; - ret = imsCallPtr_->SetImsConfig(DEFAULT_ITEM, value); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -794,12 +752,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetImsConfigInt_001, Function | Me */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetImsConfig_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->GetImsConfig(DEFAULT_ITEM); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->GetImsConfig(DEFAULT_ITEM); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -809,13 +766,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetImsConfig_001, Function | Mediu */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetImsFeatureValue_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + int32_t value = 0; + ret = imsCallPtr_->SetImsFeatureValue(DEFAULT_FEATURE_TYPE, value); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - int32_t value = 0; - ret = imsCallPtr_->SetImsFeatureValue(DEFAULT_FEATURE_TYPE, value); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -825,14 +781,13 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetImsFeatureValue_001, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetImsFeatureValue_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + int32_t value; + ret = imsCallPtr_->GetImsFeatureValue(DEFAULT_FEATURE_TYPE, value); + TELEPHONY_LOGI("Ims Feature Value:%{public}d", value); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - int32_t value; - ret = imsCallPtr_->GetImsFeatureValue(DEFAULT_FEATURE_TYPE, value); - TELEPHONY_LOGI("Ims Feature Value:%{public}d", value); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -842,13 +797,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetImsFeatureValue_001, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetMute_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + int32_t mute = 0; + ret = imsCallPtr_->SetMute(DEFAULT_SLOTID, mute); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - int32_t mute = 0; - ret = imsCallPtr_->SetMute(DEFAULT_SLOTID, mute); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -858,13 +812,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetMute_001, Function | MediumTest */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetMute_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + int32_t mute = 0; + ret = imsCallPtr_->SetMute(SIM_SLOT_ID_1, mute); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - int32_t mute = 0; - ret = imsCallPtr_->SetMute(SIM_SLOT_ID_1, mute); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -874,12 +827,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetMute_002, Function | MediumTest */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetMute_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->GetMute(DEFAULT_SLOTID); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->GetMute(DEFAULT_SLOTID); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** * @tc.number Telephony_ImsService_GetMute_002 @@ -888,12 +840,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetMute_001, Function | MediumTest */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetMute_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->GetMute(SIM_SLOT_ID_1); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->GetMute(SIM_SLOT_ID_1); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -903,15 +854,14 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetMute_002, Function | MediumTest */ HWTEST_F(ImsServiceTest, Telephony_ImsService_CtrlCamera_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + std::u16string cameraId = u"cameraId"; + int32_t callingUid = 0; + int32_t callingPid = 0; + ret = imsCallPtr_->CtrlCamera(cameraId, callingUid, callingPid); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - std::u16string cameraId = u"cameraId"; - int32_t callingUid = 0; - int32_t callingPid = 0; - ret = imsCallPtr_->CtrlCamera(cameraId, callingUid, callingPid); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -921,17 +871,16 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_CtrlCamera_001, Function | MediumT */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetPreviewWindow_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + int32_t x = 0; + int32_t y = 0; + int32_t z = 0; + int32_t width = 0; + int32_t height = 0; + ret = imsCallPtr_->SetPreviewWindow(x, y, z, width, height); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - int32_t x = 0; - int32_t y = 0; - int32_t z = 0; - int32_t width = 0; - int32_t height = 0; - ret = imsCallPtr_->SetPreviewWindow(x, y, z, width, height); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -941,17 +890,16 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetPreviewWindow_001, Function | M */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetDisplayWindow_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + int32_t x = 0; + int32_t y = 0; + int32_t z = 0; + int32_t width = 0; + int32_t height = 0; + ret = imsCallPtr_->SetDisplayWindow(x, y, z, width, height); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - int32_t x = 0; - int32_t y = 0; - int32_t z = 0; - int32_t width = 0; - int32_t height = 0; - ret = imsCallPtr_->SetDisplayWindow(x, y, z, width, height); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -961,13 +909,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetDisplayWindow_001, Function | M */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetCameraZoom_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + float zoomRatio = 1.0; + ret = imsCallPtr_->SetCameraZoom(zoomRatio); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - float zoomRatio = 1.0; - ret = imsCallPtr_->SetCameraZoom(zoomRatio); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -977,13 +924,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetCameraZoom_001, Function | Medi */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetPauseImage_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + std::u16string path = u"path"; + ret = imsCallPtr_->SetPauseImage(path); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - std::u16string path = u"path"; - ret = imsCallPtr_->SetPauseImage(path); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -993,13 +939,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetPauseImage_001, Function | Medi */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetDeviceDirection_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + int32_t rotation = 0; + ret = imsCallPtr_->SetDeviceDirection(rotation); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - int32_t rotation = 0; - ret = imsCallPtr_->SetDeviceDirection(rotation); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1009,12 +954,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetDeviceDirection_001, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetClip_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->GetClip(DEFAULT_SLOTID); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->GetClip(DEFAULT_SLOTID); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1024,12 +968,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetClip_001, Function | MediumTest */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetClip_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->GetClip(SIM_SLOT_ID_1); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->GetClip(SIM_SLOT_ID_1); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1039,13 +982,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetClip_002, Function | MediumTest */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetClir_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + int32_t action = 0; + ret = imsCallPtr_->SetClir(DEFAULT_SLOTID, action); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - int32_t action = 0; - ret = imsCallPtr_->SetClir(DEFAULT_SLOTID, action); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1055,13 +997,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetClir_001, Function | MediumTest */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetClir_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + int32_t action = 0; + ret = imsCallPtr_->SetClir(SIM_SLOT_ID_1, action); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - int32_t action = 0; - ret = imsCallPtr_->SetClir(SIM_SLOT_ID_1, action); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1071,12 +1012,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetClir_002, Function | MediumTest */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetClir_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->GetClir(DEFAULT_SLOTID); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->GetClir(DEFAULT_SLOTID); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1086,12 +1026,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetClir_001, Function | MediumTest */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetClir_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->GetClir(SIM_SLOT_ID_1); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->GetClir(SIM_SLOT_ID_1); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1101,14 +1040,13 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetClir_002, Function | MediumTest */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetCallTransfer_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + std::string transferNum = "000000"; + int32_t classType = 1; + ret = imsCallPtr_->SetCallTransfer(DEFAULT_SLOTID, DEFAULT_TRANSFER_TYPE, DEFAULT_MODE, transferNum, classType); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - std::string transferNum = "000000"; - int32_t classType = 1; - ret = imsCallPtr_->SetCallTransfer(DEFAULT_SLOTID, DEFAULT_TRANSFER_TYPE, DEFAULT_MODE, transferNum, classType); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1118,14 +1056,13 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetCallTransfer_001, Function | Me */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetCallTransfer_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + std::string transferNum = "000000"; + int32_t classType = 1; + ret = imsCallPtr_->SetCallTransfer(SIM_SLOT_ID_1, DEFAULT_TRANSFER_TYPE, DEFAULT_MODE, transferNum, classType); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - std::string transferNum = "000000"; - int32_t classType = 1; - ret = imsCallPtr_->SetCallTransfer(SIM_SLOT_ID_1, DEFAULT_TRANSFER_TYPE, DEFAULT_MODE, transferNum, classType); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1135,17 +1072,15 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetCallTransfer_002, Function | Me */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetCallTransfer_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; - } - int32_t ret = TELEPHONY_ERROR; - if (imsCallPtr_ == nullptr) { - TELEPHONY_LOGE("imsCallPtr is nullptr, Init Failed!"); + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + if (imsCallPtr_ == nullptr) { + TELEPHONY_LOGE("imsCallPtr is nullptr, Init Failed!"); + ASSERT_EQ(TELEPHONY_SUCCESS, ret); + } + ret = imsCallPtr_->GetCallTransfer(DEFAULT_SLOTID, DEFAULT_TRANSFER_TYPE); EXPECT_EQ(TELEPHONY_SUCCESS, ret); - return; } - ret = imsCallPtr_->GetCallTransfer(DEFAULT_SLOTID, DEFAULT_TRANSFER_TYPE); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1155,12 +1090,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetCallTransfer_001, Function | Me */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetCallTransfer_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->GetCallTransfer(SIM_SLOT_ID_1, DEFAULT_TRANSFER_TYPE); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->GetCallTransfer(SIM_SLOT_ID_1, DEFAULT_TRANSFER_TYPE); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1170,14 +1104,13 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetCallTransfer_002, Function | Me */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetCallRestriction_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + std::string fac = "AO"; + std::string password = "000000"; + ret = imsCallPtr_->SetCallRestriction(DEFAULT_SLOTID, fac, DEFAULT_MODE, password); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - std::string fac = "AO"; - std::string password = "000000"; - ret = imsCallPtr_->SetCallRestriction(DEFAULT_SLOTID, fac, DEFAULT_MODE, password); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1187,14 +1120,13 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetCallRestriction_001, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetCallRestriction_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + std::string fac = "AO"; + std::string password = "000000"; + ret = imsCallPtr_->SetCallRestriction(SIM_SLOT_ID_1, fac, DEFAULT_MODE, password); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - std::string fac = "AO"; - std::string password = "000000"; - ret = imsCallPtr_->SetCallRestriction(SIM_SLOT_ID_1, fac, DEFAULT_MODE, password); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1204,13 +1136,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetCallRestriction_002, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetCallRestriction_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + std::string facType = "AO"; + ret = imsCallPtr_->GetCallRestriction(DEFAULT_SLOTID, facType); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - std::string facType = "AO"; - ret = imsCallPtr_->GetCallRestriction(DEFAULT_SLOTID, facType); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1220,13 +1151,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetCallRestriction_001, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetCallRestriction_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + std::string facType = "AO"; + ret = imsCallPtr_->GetCallRestriction(SIM_SLOT_ID_1, facType); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - std::string facType = "AO"; - ret = imsCallPtr_->GetCallRestriction(SIM_SLOT_ID_1, facType); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1236,12 +1166,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetCallRestriction_002, Function | */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetCallWaiting_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->SetCallWaiting(DEFAULT_SLOTID, DEFAULT_ACTIVE, ServiceClassType::VOICE); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->SetCallWaiting(DEFAULT_SLOTID, DEFAULT_ACTIVE, ServiceClassType::VOICE); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1251,12 +1180,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetCallWaiting_001, Function | Med */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetCallWaiting_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->SetCallWaiting(SIM_SLOT_ID_1, DEFAULT_ACTIVE, ServiceClassType::VOICE); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->SetCallWaiting(SIM_SLOT_ID_1, DEFAULT_ACTIVE, ServiceClassType::VOICE); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1266,12 +1194,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetCallWaiting_002, Function | Med */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetCallWaiting_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->GetCallWaiting(DEFAULT_SLOTID); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->GetCallWaiting(DEFAULT_SLOTID); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1281,12 +1208,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetCallWaiting_001, Function | Med */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetCallWaiting_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCallPtr_->GetCallWaiting(SIM_SLOT_ID_1); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCallPtr_->GetCallWaiting(SIM_SLOT_ID_1); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1296,13 +1222,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetCallWaiting_002, Function | Med */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetSmsConfig_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + int32_t imsSmsConfig = 1; + ret = imsSmsPtr_->ImsSetSmsConfig(DEFAULT_SLOTID, imsSmsConfig); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - int32_t imsSmsConfig = 1; - ret = imsSmsPtr_->ImsSetSmsConfig(DEFAULT_SLOTID, imsSmsConfig); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1312,13 +1237,12 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetSmsConfig_001, Function | Mediu */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetSmsConfig_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + int32_t imsSmsConfig = 1; + ret = imsSmsPtr_->ImsSetSmsConfig(SIM_SLOT_ID_1, imsSmsConfig); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - int32_t imsSmsConfig = 1; - ret = imsSmsPtr_->ImsSetSmsConfig(SIM_SLOT_ID_1, imsSmsConfig); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1328,12 +1252,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SetSmsConfig_002, Function | Mediu */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetSmsConfig_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsSmsPtr_->ImsGetSmsConfig(DEFAULT_SLOTID); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsSmsPtr_->ImsGetSmsConfig(DEFAULT_SLOTID); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1343,12 +1266,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetSmsConfig_001, Function | Mediu */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetSmsConfig_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsSmsPtr_->ImsGetSmsConfig(SIM_SLOT_ID_1); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsSmsPtr_->ImsGetSmsConfig(SIM_SLOT_ID_1); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1358,15 +1280,14 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetSmsConfig_002, Function | Mediu */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SendMessage_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + int32_t refld = 1; + ImsMessageInfo imsMessageInfo; + imsMessageInfo.refId = refld; + ret = imsSmsPtr_->ImsSendMessage(DEFAULT_SLOTID, imsMessageInfo); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - int32_t refld = 1; - ImsMessageInfo imsMessageInfo; - imsMessageInfo.refId = refld; - ret = imsSmsPtr_->ImsSendMessage(DEFAULT_SLOTID, imsMessageInfo); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1376,15 +1297,14 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SendMessage_001, Function | Medium */ HWTEST_F(ImsServiceTest, Telephony_ImsService_SendMessage_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + int32_t refld = 1; + ImsMessageInfo imsMessageInfo; + imsMessageInfo.refId = refld; + ret = imsSmsPtr_->ImsSendMessage(SIM_SLOT_ID_1, imsMessageInfo); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - int32_t refld = 1; - ImsMessageInfo imsMessageInfo; - imsMessageInfo.refId = refld; - ret = imsSmsPtr_->ImsSendMessage(SIM_SLOT_ID_1, imsMessageInfo); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1394,12 +1314,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_SendMessage_002, Function | Medium */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetImsRegistrationStatus_001, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(DEFAULT_SLOTID)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCoreServicePtr_->GetImsRegistrationStatus(DEFAULT_SLOTID); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCoreServicePtr_->GetImsRegistrationStatus(DEFAULT_SLOTID); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } /** @@ -1409,12 +1328,11 @@ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetImsRegistrationStatus_001, Func */ HWTEST_F(ImsServiceTest, Telephony_ImsService_GetImsRegistrationStatus_002, Function | MediumTest | Level1) { - if ((ImsServiceTest::InitConditionCheck() != TELEPHONY_SUCCESS) || !HasSimCard(SIM_SLOT_ID_1)) { - return; + if ((ImsServiceTest::InitConditionCheck() == TELEPHONY_SUCCESS) && HasSimCard(DEFAULT_SLOTID)) { + int32_t ret = TELEPHONY_ERROR; + ret = imsCoreServicePtr_->GetImsRegistrationStatus(SIM_SLOT_ID_1); + EXPECT_EQ(TELEPHONY_SUCCESS, ret); } - int32_t ret = TELEPHONY_ERROR; - ret = imsCoreServicePtr_->GetImsRegistrationStatus(SIM_SLOT_ID_1); - EXPECT_EQ(TELEPHONY_SUCCESS, ret); } } // namespace Telephony } // namespace OHOS -- Gitee From da8bc2ac219bc453852b31b9c4d6a231676219ff Mon Sep 17 00:00:00 2001 From: lishuo Date: Wed, 23 Apr 2025 03:26:55 +0000 Subject: [PATCH 10/16] =?UTF-8?q?dt=E7=94=A8=E4=BE=8B=E8=A7=84=E8=8C=83?= =?UTF-8?q?=EF=BC=8C=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- test/unittest/cstest/cs1_test.cpp | 559 ++++++++++++++---------------- 1 file changed, 254 insertions(+), 305 deletions(-) diff --git a/test/unittest/cstest/cs1_test.cpp b/test/unittest/cstest/cs1_test.cpp index 9c24dce5..f6362344 100644 --- a/test/unittest/cstest/cs1_test.cpp +++ b/test/unittest/cstest/cs1_test.cpp @@ -120,38 +120,38 @@ void Cs1Test::JudgeIsEmergencyPhoneNumber() auto telephonyService = iface_cast(remote); ASSERT_TRUE(telephonyService != nullptr); - - if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { - bool enabled = false; - int32_t successCode = 1; - if (HasSimCard(SIM1_SLOTID)) { - telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "499", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "443", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "356", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "975", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "783", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "350", enabled); - EXPECT_NE(enabled, successCode); - } - if (HasSimCard(SIM2_SLOTID)) { - telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "499", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "443", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "356", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "975", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "783", enabled); - EXPECT_NE(enabled, successCode); - telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "350", enabled); - EXPECT_NE(enabled, successCode); - } + if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + return; + } + bool enabled = false; + int32_t successCode = 1; + if (HasSimCard(SIM1_SLOTID)) { + telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "499", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "443", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "356", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "975", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "783", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "350", enabled); + EXPECT_NE(enabled, successCode); + } + if (HasSimCard(SIM2_SLOTID)) { + telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "499", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "443", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "356", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "975", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "783", enabled); + EXPECT_NE(enabled, successCode); + telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "350", enabled); + EXPECT_NE(enabled, successCode); } } @@ -222,7 +222,7 @@ HWTEST_F(Cs1Test, cellular_call_SetEmergencyCallList_0101, Function | MediumTest auto telephonyService = iface_cast(emergencyRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { std::vector eccVec; EmergencyCall temp0 = { "499", "460", EccType::TYPE_CATEGORY, SimpresentType::TYPE_NO_CARD, AbnormalServiceType::TYPE_ALL }; @@ -262,7 +262,7 @@ HWTEST_F(Cs1Test, cellular_call_IsOperatorConfigEmergencyCallList_0001, Function auto telephonyService = iface_cast(operatorRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { OperatorConfig opc; if (HasSimCard(SIM1_SLOTID)) { DelayedRefSingleton::GetInstance().GetOperatorConfigs(SIM1_SLOTID, opc); @@ -294,15 +294,13 @@ HWTEST_F(Cs1Test, cellular_call_IsOperatorConfigEmergencyCallList_0001, Function */ HWTEST_F(Cs1Test, cellular_call_DialCall_0001, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -313,15 +311,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0001, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0002, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -332,15 +328,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0002, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0003, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -351,15 +345,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0003, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0004, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -370,15 +362,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0004, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0005, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -389,15 +379,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0005, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0006, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -408,15 +396,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0006, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0007, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -427,15 +413,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0007, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0008, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -446,15 +430,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0008, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0009, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -465,15 +447,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0009, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0010, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -484,15 +464,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0010, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0011, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -503,15 +481,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0011, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0012, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -522,15 +498,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0012, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0013, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -541,15 +515,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0013, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0014, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -560,15 +532,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0014, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0015, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -579,15 +549,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0015, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0016, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*04#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*04#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*04#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*04#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -598,15 +566,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0016, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0017, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*05#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*05#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*05#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*05#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -617,15 +583,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0017, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0018, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*042#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*042#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*042#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*042#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -636,15 +600,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0018, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0019, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*052#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*052#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*052#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*052#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -655,16 +617,15 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0019, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0020, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*4444#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*4444#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*4444#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*4444#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + } /** @@ -674,15 +635,13 @@ HWTEST_F(Cs1Test, cellular_call_DialCall_0020, Function | MediumTest | Level2) */ HWTEST_F(Cs1Test, cellular_call_DialCall_0021, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = TestDialCallByCs(INVALID_SLOTID, PHONE_NUMBER); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = TestDialCallByCs(INVALID_SLOTID, PHONE_NUMBER); - EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = TestDialCallByCs(INVALID_SLOTID, PHONE_NUMBER); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = TestDialCallByCs(INVALID_SLOTID, PHONE_NUMBER); + EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); } } @@ -700,7 +659,7 @@ HWTEST_F(Cs1Test, cellular_call_HangUpCall_0001, Function | MediumTest | Level2) ASSERT_TRUE(hangUpCallRemote != nullptr); auto telephonyService = iface_cast(hangUpCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { CellularCallInfo hangUpCallInfo; if (HasSimCard(SIM1_SLOTID)) { int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, hangUpCallInfo); @@ -729,7 +688,7 @@ HWTEST_F(Cs1Test, cellular_call_HangUpCall_0001, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_HangUpCall_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto hangUpCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -767,21 +726,19 @@ HWTEST_F(Cs1Test, cellular_call_AnswerCall_0001, Function | MediumTest | Level2) ASSERT_TRUE(answerCallRemote != nullptr); auto telephonyService = iface_cast(answerCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo answerCallInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, answerCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Answer(answerCallInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo answerCallInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, answerCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Answer(answerCallInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo answerCallInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, answerCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Answer(answerCallInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo answerCallInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, answerCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Answer(answerCallInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); } } @@ -793,7 +750,7 @@ HWTEST_F(Cs1Test, cellular_call_AnswerCall_0001, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_AnswerCall_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto answerCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -831,21 +788,19 @@ HWTEST_F(Cs1Test, cellular_call_RejectCall_0001, Function | MediumTest | Level2) ASSERT_TRUE(rejectCallRemote != nullptr); auto telephonyService = iface_cast(rejectCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo rejectCallInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, rejectCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Reject(rejectCallInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo rejectCallInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, rejectCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Reject(rejectCallInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo rejectCallInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, rejectCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Reject(rejectCallInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo rejectCallInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, rejectCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Reject(rejectCallInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); } } @@ -857,7 +812,7 @@ HWTEST_F(Cs1Test, cellular_call_RejectCall_0001, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_RejectCall_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto rejectCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -895,21 +850,19 @@ HWTEST_F(Cs1Test, cellular_call_HoldCall_0001, Function | MediumTest | Level2) ASSERT_TRUE(holdCallRemote != nullptr); auto telephonyService = iface_cast(holdCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo holdCallInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, holdCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HoldCall(holdCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo holdCallInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, holdCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HoldCall(holdCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo holdCallInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, holdCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HoldCall(holdCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo holdCallInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, holdCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HoldCall(holdCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -921,7 +874,7 @@ HWTEST_F(Cs1Test, cellular_call_HoldCall_0001, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_HoldCall_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto holdCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -959,21 +912,19 @@ HWTEST_F(Cs1Test, cellular_call_UnHoldCall_0001, Function | MediumTest | Level2) ASSERT_TRUE(unHoldCallRemote != nullptr); auto telephonyService = iface_cast(unHoldCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo unHoldCallInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, unHoldCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->UnHoldCall(unHoldCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo unHoldCallInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, unHoldCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->UnHoldCall(unHoldCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo unHoldCallInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, unHoldCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->UnHoldCall(unHoldCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo unHoldCallInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, unHoldCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->UnHoldCall(unHoldCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -985,7 +936,7 @@ HWTEST_F(Cs1Test, cellular_call_UnHoldCall_0001, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_UnHoldCall_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto unHoldCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -1023,21 +974,19 @@ HWTEST_F(Cs1Test, cellular_call_SwitchCall_0001, Function | MediumTest | Level2) ASSERT_TRUE(switchCallRemote != nullptr); auto telephonyService = iface_cast(switchCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - CellularCallInfo switchCallInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, switchCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SwitchCall(switchCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - CellularCallInfo switchCallInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, switchCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SwitchCall(switchCallInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + CellularCallInfo switchCallInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, switchCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SwitchCall(switchCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + CellularCallInfo switchCallInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, switchCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SwitchCall(switchCallInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -1049,7 +998,7 @@ HWTEST_F(Cs1Test, cellular_call_SwitchCall_0001, Function | MediumTest | Level2) HWTEST_F(Cs1Test, cellular_call_SwitchCall_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto switchCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); -- Gitee From e538b92dc714b310a3fae9a21e0910b737def229 Mon Sep 17 00:00:00 2001 From: lishuo Date: Wed, 23 Apr 2025 03:41:31 +0000 Subject: [PATCH 11/16] =?UTF-8?q?dt=E7=94=A8=E4=BE=8B=E8=A7=84=E8=8C=83?= =?UTF-8?q?=EF=BC=8C=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- test/unittest/cstest/cs2_test.cpp | 38 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/test/unittest/cstest/cs2_test.cpp b/test/unittest/cstest/cs2_test.cpp index 79b09985..e4d01939 100644 --- a/test/unittest/cstest/cs2_test.cpp +++ b/test/unittest/cstest/cs2_test.cpp @@ -174,7 +174,7 @@ HWTEST_F(Cs2Test, cellular_call_CombineConference_0001, Function | MediumTest | HWTEST_F(Cs2Test, cellular_call_CombineConference_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto combineRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -237,7 +237,7 @@ HWTEST_F(Cs2Test, cellular_call_SeparateConference_0001, Function | MediumTest | HWTEST_F(Cs2Test, cellular_call_SeparateConference_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto separateRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -300,7 +300,7 @@ HWTEST_F(Cs2Test, cellular_call_KickOutFromConference_0001, Function | MediumTes HWTEST_F(Cs2Test, cellular_call_KickOutFromConference_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto kickOutRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -390,7 +390,7 @@ HWTEST_F(Cs2Test, cellular_call_StartDtmf_0001, Function | MediumTest | Level2) HWTEST_F(Cs2Test, cellular_call_StartDtmf_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto startDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -454,7 +454,7 @@ HWTEST_F(Cs2Test, cellular_call_StopDtmf_0001, Function | MediumTest | Level2) HWTEST_F(Cs2Test, cellular_call_StopDtmf_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto stopDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -519,7 +519,7 @@ HWTEST_F(Cs2Test, cellular_call_SendDtmf_0001, Function | MediumTest | Level2) HWTEST_F(Cs2Test, cellular_call_SendDtmf_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto sendDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -578,7 +578,7 @@ HWTEST_F(Cs2Test, cellular_call_GetDomainPreferenceMode_0001, Function | MediumT HWTEST_F(Cs2Test, cellular_call_GetDomainPreferenceMode_0002, Function | MediumTest | Level3) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto domainPrefModeRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -629,7 +629,7 @@ HWTEST_F(Cs2Test, cellular_call_GetMute_0001, Function | MediumTest | Level3) HWTEST_F(Cs2Test, cellular_call_GetMute_0002, Function | MediumTest | Level3) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto getMuteRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -658,7 +658,7 @@ HWTEST_F(Cs2Test, cellular_call_CsControl_0001, Function | MediumTest | Level3) ASSERT_TRUE(systemAbilityMgr != nullptr); auto csControlRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); ASSERT_TRUE(csControlRemote != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto csControl = std::make_shared(); CellularCallInfo cellularCallInfo; bool enabled = false; @@ -756,7 +756,7 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallConnectionCS_0001, Function | Medium ASSERT_TRUE(systemAbilityMgr != nullptr); auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); ASSERT_TRUE(remote != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { if (!HasSimCard(slotId)) { continue; @@ -785,7 +785,7 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallRegister_0001, Function | MediumTest ASSERT_TRUE(systemAbilityMgr != nullptr); auto cellularCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); ASSERT_TRUE(cellularCallRemote != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto callRegister = DelayedSingleton::GetInstance(); ASSERT_TRUE(callRegister != nullptr); CellularCallEventInfo callEvent; @@ -855,7 +855,7 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallRegister_0002, Function | MediumTest */ HWTEST_F(Cs2Test, cellular_call_SupplementRequestCs_0001, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { if (!HasSimCard(slotId)) { continue; @@ -891,7 +891,7 @@ HWTEST_F(Cs2Test, cellular_call_SupplementRequestCs_0001, Function | MediumTest */ HWTEST_F(Cs2Test, cellular_call_ConfigRequest_0001, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { if (!HasSimCard(slotId)) { continue; @@ -913,7 +913,7 @@ HWTEST_F(Cs2Test, cellular_call_ConfigRequest_0001, Function | MediumTest | Leve */ HWTEST_F(Cs2Test, cellular_call_CellularCallSupplement_0001, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { if (!HasSimCard(slotId)) { continue; @@ -951,7 +951,7 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallSupplement_0001, Function | MediumTe */ HWTEST_F(Cs2Test, cellular_call_CellularCallSupplement_0002, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { if (!HasSimCard(slotId)) { continue; @@ -997,7 +997,7 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallSupplement_0002, Function | MediumTe */ HWTEST_F(Cs2Test, cellular_call_CellularCallSupplement_0003, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { if (!HasSimCard(slotId)) { continue; @@ -1027,7 +1027,7 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallSupplement_0003, Function | MediumTe */ HWTEST_F(Cs2Test, cellular_call_CellularCallHandler_0001, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { EventFwk::MatchingSkills matchingSkills; matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED); EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills); @@ -1076,7 +1076,7 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallHandler_0001, Function | MediumTest */ HWTEST_F(Cs2Test, cellular_call_CellularCallHandler_0002, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { EventFwk::MatchingSkills matchingSkills; matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED); EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills); @@ -1134,7 +1134,7 @@ HWTEST_F(Cs2Test, cellular_call_CellularCallHandler_0002, Function | MediumTest */ HWTEST_F(Cs2Test, cellular_call_CellularCallHandler_0003, Function | MediumTest | Level3) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { EventFwk::MatchingSkills matchingSkills; matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED); EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills); -- Gitee From 48c86e5de9b04d2695a5063392c388c3dd34b166 Mon Sep 17 00:00:00 2001 From: lishuo Date: Wed, 23 Apr 2025 06:32:09 +0000 Subject: [PATCH 12/16] =?UTF-8?q?dt=E7=94=A8=E4=BE=8B=E8=A7=84=E8=8C=83?= =?UTF-8?q?=EF=BC=8C=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- .../unittest/cstest/cs_calloperation_test.cpp | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/test/unittest/cstest/cs_calloperation_test.cpp b/test/unittest/cstest/cs_calloperation_test.cpp index 50c107a3..4549fb03 100644 --- a/test/unittest/cstest/cs_calloperation_test.cpp +++ b/test/unittest/cstest/cs_calloperation_test.cpp @@ -137,9 +137,6 @@ void CsCallOperationTest::TearDown(void) */ HWTEST_F(CsCallOperationTest, cellular_call_DialCall_0001, Function | MediumTest | Level2) { - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { - return; - } if (HasSimCard(SIM1_SLOTID)) { int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*30#"); EXPECT_EQ(ret, TELEPHONY_SUCCESS); @@ -532,7 +529,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_HangUpCall_0001, Function | MediumTe HWTEST_F(CsCallOperationTest, cellular_call_HangUpCall_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto hangUpCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -595,7 +592,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_AnswerCall_0001, Function | MediumTe HWTEST_F(CsCallOperationTest, cellular_call_AnswerCall_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto answerCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -658,7 +655,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_RejectCall_0001, Function | MediumTe HWTEST_F(CsCallOperationTest, cellular_call_RejectCall_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto rejectCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -721,7 +718,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_HoldCall_0001, Function | MediumTest HWTEST_F(CsCallOperationTest, cellular_call_HoldCall_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto holdCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -784,7 +781,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_UnHoldCall_0001, Function | MediumTe HWTEST_F(CsCallOperationTest, cellular_call_UnHoldCall_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto unHoldCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -847,7 +844,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_SwitchCall_0001, Function | MediumTe HWTEST_F(CsCallOperationTest, cellular_call_SwitchCall_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto switchCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -910,7 +907,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_CombineConference_0001, Function | M HWTEST_F(CsCallOperationTest, cellular_call_CombineConference_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto combineRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -973,7 +970,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_SeparateConference_0001, Function | HWTEST_F(CsCallOperationTest, cellular_call_SeparateConference_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto separateRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -1036,7 +1033,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_KickOutFromConference_0001, Function HWTEST_F(CsCallOperationTest, cellular_call_KickOutFromConference_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto kickOutRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -1126,7 +1123,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_StartDtmf_0001, Function | MediumTes HWTEST_F(CsCallOperationTest, cellular_call_StartDtmf_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto startDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -1190,7 +1187,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_StopDtmf_0001, Function | MediumTest HWTEST_F(CsCallOperationTest, cellular_call_StopDtmf_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto stopDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -1255,7 +1252,7 @@ HWTEST_F(CsCallOperationTest, cellular_call_SendDtmf_0001, Function | MediumTest HWTEST_F(CsCallOperationTest, cellular_call_SendDtmf_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto sendDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); -- Gitee From abb1c9553a2e53b05f8c47d4d501722e372d3678 Mon Sep 17 00:00:00 2001 From: lishuo Date: Wed, 23 Apr 2025 06:39:44 +0000 Subject: [PATCH 13/16] =?UTF-8?q?dt=E7=94=A8=E4=BE=8B=E8=A7=84=E8=8C=83?= =?UTF-8?q?=EF=BC=8C=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- test/unittest/satellitetest/satellite_test.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/unittest/satellitetest/satellite_test.cpp b/test/unittest/satellitetest/satellite_test.cpp index 772631db..19e2747b 100644 --- a/test/unittest/satellitetest/satellite_test.cpp +++ b/test/unittest/satellitetest/satellite_test.cpp @@ -318,7 +318,7 @@ HWTEST_F(SatelliteTest, Satellite_call_StartDtmf_0001, Function | MediumTest | L HWTEST_F(SatelliteTest, Satellite_call_StartDtmf_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto startDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -382,7 +382,7 @@ HWTEST_F(SatelliteTest, Satellite_call_StopDtmf_0001, Function | MediumTest | Le HWTEST_F(SatelliteTest, Satellite_call_StopDtmf_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto stopDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); @@ -447,7 +447,7 @@ HWTEST_F(SatelliteTest, Satellite_call_SendDtmf_0001, Function | MediumTest | Le HWTEST_F(SatelliteTest, Satellite_call_SendDtmf_0002, Function | MediumTest | Level2) { AccessToken token; - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); ASSERT_TRUE(systemAbilityMgr != nullptr); auto sendDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); -- Gitee From 327d86266a7e9beddd7ccabb630f0268165b4111 Mon Sep 17 00:00:00 2001 From: lishuo Date: Wed, 23 Apr 2025 06:43:52 +0000 Subject: [PATCH 14/16] =?UTF-8?q?dt=E7=94=A8=E4=BE=8B=E8=A7=84=E8=8C=83?= =?UTF-8?q?=EF=BC=8C=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- test/unittest/satellitetest/satellite_callback_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unittest/satellitetest/satellite_callback_test.cpp b/test/unittest/satellitetest/satellite_callback_test.cpp index ffab6e78..0a233b69 100644 --- a/test/unittest/satellitetest/satellite_callback_test.cpp +++ b/test/unittest/satellitetest/satellite_callback_test.cpp @@ -156,7 +156,7 @@ HWTEST_F(SatelliteCallbackTest, cellular_call_SatelliteCallCallbackStub_0001, Fu { sptr stub = (std::make_unique()).release(); ASSERT_TRUE(stub != nullptr); - if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { + if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { if (!HasSimCard(slotId)) { continue; -- Gitee From bdd809f45756433cfe4e3d1376d63afc18acabcc Mon Sep 17 00:00:00 2001 From: lishuo Date: Thu, 24 Apr 2025 00:54:50 +0000 Subject: [PATCH 15/16] =?UTF-8?q?dt=E7=94=A8=E4=BE=8B=E8=A7=84=E8=8C=83?= =?UTF-8?q?=EF=BC=8C=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- test/unittest/imstest/ims2_test.cpp | 248 +++++++++++++--------------- 1 file changed, 111 insertions(+), 137 deletions(-) diff --git a/test/unittest/imstest/ims2_test.cpp b/test/unittest/imstest/ims2_test.cpp index 2685c332..ad24161b 100644 --- a/test/unittest/imstest/ims2_test.cpp +++ b/test/unittest/imstest/ims2_test.cpp @@ -174,17 +174,15 @@ HWTEST_F(Ims2Test, cellular_call_GetVoNRState_0001, Function | MediumTest | Leve ASSERT_TRUE(getVoNRRemote != nullptr); auto telephonyService = iface_cast(getVoNRRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t result; - int32_t ret = telephonyService->GetVoNRState(SIM1_SLOTID, result); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t result; - int32_t ret = telephonyService->GetVoNRState(SIM2_SLOTID, result); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t result; + int32_t ret = telephonyService->GetVoNRState(SIM1_SLOTID, result); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t result; + int32_t ret = telephonyService->GetVoNRState(SIM2_SLOTID, result); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -202,15 +200,13 @@ HWTEST_F(Ims2Test, cellular_call_StartRtt_0001, Function | MediumTest | Level2) ASSERT_TRUE(startRttRemote != nullptr); auto telephonyService = iface_cast(startRttRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - int32_t ret = telephonyService->StartRtt(SIM1_SLOTID, PHONE_NUMBER); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - int32_t ret = telephonyService->StartRtt(SIM2_SLOTID, PHONE_NUMBER); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + int32_t ret = telephonyService->StartRtt(SIM1_SLOTID, PHONE_NUMBER); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + int32_t ret = telephonyService->StartRtt(SIM2_SLOTID, PHONE_NUMBER); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -228,15 +224,13 @@ HWTEST_F(Ims2Test, cellular_call_StopRtt_0001, Function | MediumTest | Level2) ASSERT_TRUE(stopRttRemote != nullptr); auto telephonyService = iface_cast(stopRttRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - int32_t ret = telephonyService->StopRtt(SIM1_SLOTID); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - int32_t ret = telephonyService->StopRtt(SIM2_SLOTID); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + int32_t ret = telephonyService->StopRtt(SIM1_SLOTID); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + int32_t ret = telephonyService->StopRtt(SIM2_SLOTID); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -254,17 +248,15 @@ HWTEST_F(Ims2Test, cellular_call_SetDomainPreferenceMode_0001, Function | Medium ASSERT_TRUE(domainPrefModeRemote != nullptr); auto telephonyService = iface_cast(domainPrefModeRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - int32_t mode = -1; - int32_t ret = telephonyService->SetDomainPreferenceMode(SIM1_SLOTID, mode); - EXPECT_EQ(ret, CALL_ERR_PARAMETER_OUT_OF_RANGE); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - int32_t mode = -1; - int32_t ret = telephonyService->SetDomainPreferenceMode(SIM2_SLOTID, mode); - EXPECT_EQ(ret, CALL_ERR_PARAMETER_OUT_OF_RANGE); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + int32_t mode = -1; + int32_t ret = telephonyService->SetDomainPreferenceMode(SIM1_SLOTID, mode); + EXPECT_EQ(ret, CALL_ERR_PARAMETER_OUT_OF_RANGE); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + int32_t mode = -1; + int32_t ret = telephonyService->SetDomainPreferenceMode(SIM2_SLOTID, mode); + EXPECT_EQ(ret, CALL_ERR_PARAMETER_OUT_OF_RANGE); } } @@ -282,17 +274,15 @@ HWTEST_F(Ims2Test, cellular_call_GetImsConfig_0001, Function | MediumTest | Leve ASSERT_TRUE(getImsConfigRemote != nullptr); auto telephonyService = iface_cast(getImsConfigRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - ImsConfigItem mode = ITEM_IMS_SWITCH_STATUS; - int32_t ret = telephonyService->GetImsConfig(SIM1_SLOTID, mode); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - ImsConfigItem mode = ITEM_IMS_SWITCH_STATUS; - int32_t ret = telephonyService->GetImsConfig(SIM2_SLOTID, mode); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + ImsConfigItem mode = ITEM_IMS_SWITCH_STATUS; + int32_t ret = telephonyService->GetImsConfig(SIM1_SLOTID, mode); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + ImsConfigItem mode = ITEM_IMS_SWITCH_STATUS; + int32_t ret = telephonyService->GetImsConfig(SIM2_SLOTID, mode); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -310,17 +300,15 @@ HWTEST_F(Ims2Test, cellular_call_GetImsFeatureValue_0001, Function | MediumTest ASSERT_TRUE(getImsFeatureRemote != nullptr); auto telephonyService = iface_cast(getImsFeatureRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - FeatureType mode = TYPE_VOICE_OVER_LTE; - int32_t ret = telephonyService->GetImsFeatureValue(SIM1_SLOTID, mode); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - FeatureType mode = TYPE_VOICE_OVER_LTE; - int32_t ret = telephonyService->GetImsFeatureValue(SIM2_SLOTID, mode); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + FeatureType mode = TYPE_VOICE_OVER_LTE; + int32_t ret = telephonyService->GetImsFeatureValue(SIM1_SLOTID, mode); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + FeatureType mode = TYPE_VOICE_OVER_LTE; + int32_t ret = telephonyService->GetImsFeatureValue(SIM2_SLOTID, mode); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -338,17 +326,15 @@ HWTEST_F(Ims2Test, cellular_call_SetMute_0001, Function | MediumTest | Level2) ASSERT_TRUE(setMuteRemote != nullptr); auto telephonyService = iface_cast(setMuteRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - int32_t mode = 0; - int32_t ret = telephonyService->SetMute(SIM1_SLOTID, mode); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - int32_t mode = 0; - int32_t ret = telephonyService->SetMute(SIM2_SLOTID, mode); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + int32_t mode = 0; + int32_t ret = telephonyService->SetMute(SIM1_SLOTID, mode); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + int32_t mode = 0; + int32_t ret = telephonyService->SetMute(SIM2_SLOTID, mode); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -366,17 +352,15 @@ HWTEST_F(Ims2Test, cellular_call_SetCallWaiting_0001, Function | MediumTest | Le ASSERT_TRUE(SetCWRemote != nullptr); auto telephonyService = iface_cast(SetCWRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - bool act = true; - int32_t ret = telephonyService->SetCallWaiting(SIM1_SLOTID, act); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - bool act = true; - int32_t ret = telephonyService->SetCallWaiting(SIM2_SLOTID, act); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + bool act = true; + int32_t ret = telephonyService->SetCallWaiting(SIM1_SLOTID, act); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + bool act = true; + int32_t ret = telephonyService->SetCallWaiting(SIM2_SLOTID, act); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -394,15 +378,13 @@ HWTEST_F(Ims2Test, cellular_call_GetCallWaiting_0001, Function | MediumTest | Le ASSERT_TRUE(getCWRemote != nullptr); auto telephonyService = iface_cast(getCWRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = telephonyService->GetCallWaiting(SIM1_SLOTID); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = telephonyService->GetCallWaiting(SIM2_SLOTID); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = telephonyService->GetCallWaiting(SIM1_SLOTID); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = telephonyService->GetCallWaiting(SIM2_SLOTID); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -420,17 +402,15 @@ HWTEST_F(Ims2Test, cellular_call_SetCallRestriction_0001, Function | MediumTest ASSERT_TRUE(setCRRemote != nullptr); auto telephonyService = iface_cast(setCRRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - CallRestrictionInfo crInfo; - int32_t ret = telephonyService->SetCallRestriction(SIM1_SLOTID, crInfo); - EXPECT_NE(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - CallRestrictionInfo crInfo; - int32_t ret = telephonyService->SetCallRestriction(SIM2_SLOTID, crInfo); - EXPECT_NE(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + CallRestrictionInfo crInfo; + int32_t ret = telephonyService->SetCallRestriction(SIM1_SLOTID, crInfo); + EXPECT_NE(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + CallRestrictionInfo crInfo; + int32_t ret = telephonyService->SetCallRestriction(SIM2_SLOTID, crInfo); + EXPECT_NE(ret, TELEPHONY_SUCCESS); } } @@ -448,17 +428,15 @@ HWTEST_F(Ims2Test, cellular_call_GetCallRestriction_0001, Function | MediumTest ASSERT_TRUE(getCRRemote != nullptr); auto telephonyService = iface_cast(getCRRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - CallRestrictionType facType = CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING; - int32_t ret = telephonyService->GetCallRestriction(SIM1_SLOTID, facType); - EXPECT_NE(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - CallRestrictionType facType = CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING; - int32_t ret = telephonyService->GetCallRestriction(SIM2_SLOTID, facType); - EXPECT_NE(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + CallRestrictionType facType = CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING; + int32_t ret = telephonyService->GetCallRestriction(SIM1_SLOTID, facType); + EXPECT_NE(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + CallRestrictionType facType = CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING; + int32_t ret = telephonyService->GetCallRestriction(SIM2_SLOTID, facType); + EXPECT_NE(ret, TELEPHONY_SUCCESS); } } @@ -476,17 +454,15 @@ HWTEST_F(Ims2Test, cellular_call_SetCallTransferInfo_0001, Function | MediumTest ASSERT_TRUE(setTransferRemote != nullptr); auto telephonyService = iface_cast(setTransferRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - CallTransferInfo ctInfo; - int32_t ret = telephonyService->SetCallTransferInfo(SIM1_SLOTID, ctInfo); - EXPECT_NE(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - CallTransferInfo ctInfo; - int32_t ret = telephonyService->SetCallTransferInfo(SIM2_SLOTID, ctInfo); - EXPECT_NE(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + CallTransferInfo ctInfo; + int32_t ret = telephonyService->SetCallTransferInfo(SIM1_SLOTID, ctInfo); + EXPECT_NE(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + CallTransferInfo ctInfo; + int32_t ret = telephonyService->SetCallTransferInfo(SIM2_SLOTID, ctInfo); + EXPECT_NE(ret, TELEPHONY_SUCCESS); } } @@ -504,17 +480,15 @@ HWTEST_F(Ims2Test, cellular_call_GetCallTransferInfo_0001, Function | MediumTest ASSERT_TRUE(getTransferRemote != nullptr); auto telephonyService = iface_cast(getTransferRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID) || HasSimCard(SIM2_SLOTID)) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - CallTransferType type = CallTransferType::TRANSFER_TYPE_UNCONDITIONAL; - int32_t ret = telephonyService->GetCallTransferInfo(SIM1_SLOTID, type); - EXPECT_NE(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - CallTransferType type = CallTransferType::TRANSFER_TYPE_UNCONDITIONAL; - int32_t ret = telephonyService->GetCallTransferInfo(SIM2_SLOTID, type); - EXPECT_NE(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + CallTransferType type = CallTransferType::TRANSFER_TYPE_UNCONDITIONAL; + int32_t ret = telephonyService->GetCallTransferInfo(SIM1_SLOTID, type); + EXPECT_NE(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + CallTransferType type = CallTransferType::TRANSFER_TYPE_UNCONDITIONAL; + int32_t ret = telephonyService->GetCallTransferInfo(SIM2_SLOTID, type); + EXPECT_NE(ret, TELEPHONY_SUCCESS); } } -- Gitee From 7969f086ff25624a1c351c7cba59b4f8dcf3cbee Mon Sep 17 00:00:00 2001 From: lishuo Date: Thu, 24 Apr 2025 01:06:34 +0000 Subject: [PATCH 16/16] =?UTF-8?q?dt=E7=94=A8=E4=BE=8B=E8=A7=84=E8=8C=83?= =?UTF-8?q?=EF=BC=8C=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lishuo --- test/unittest/imstest/ims1_test.cpp | 644 +++++++++++++--------------- 1 file changed, 293 insertions(+), 351 deletions(-) diff --git a/test/unittest/imstest/ims1_test.cpp b/test/unittest/imstest/ims1_test.cpp index 24eb3a44..137f9ba6 100644 --- a/test/unittest/imstest/ims1_test.cpp +++ b/test/unittest/imstest/ims1_test.cpp @@ -161,15 +161,13 @@ HWTEST_F(Ims1Test, cellular_call_ims_test_001, Function | MediumTest | Level0) HWTEST_F(Ims1Test, cellular_call_DialCall_0001, Function | MediumTest | Level2) { AccessToken token; - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -180,16 +178,14 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0001, Function | MediumTest | Level2) */ HWTEST_F(Ims1Test, cellular_call_DialCall_0002, Function | MediumTest | Level2) { - AccessToken token; - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + AccessToken token; + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -200,16 +196,14 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0002, Function | MediumTest | Level2) */ HWTEST_F(Ims1Test, cellular_call_DialCall_0003, Function | MediumTest | Level2) { - AccessToken token; - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#30#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + AccessToken token; + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#30#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -220,16 +214,14 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0003, Function | MediumTest | Level2) */ HWTEST_F(Ims1Test, cellular_call_DialCall_0004, Function | MediumTest | Level2) { - AccessToken token; - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + AccessToken token; + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -241,15 +233,13 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0004, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0005, Function | MediumTest | Level2) { AccessToken token; - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -261,15 +251,13 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0005, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0006, Function | MediumTest | Level2) { AccessToken token; - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#31#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#31#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -280,16 +268,14 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0006, Function | MediumTest | Level2) */ HWTEST_F(Ims1Test, cellular_call_DialCall_0007, Function | MediumTest | Level2) { - AccessToken token; - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + AccessToken token; + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -301,15 +287,13 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0007, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0008, Function | MediumTest | Level2) { AccessToken token; - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -321,15 +305,13 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0008, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0009, Function | MediumTest | Level2) { AccessToken token; - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#21#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#21#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -341,15 +323,13 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0009, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0010, Function | MediumTest | Level2) { AccessToken token; - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -361,15 +341,13 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0010, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0011, Function | MediumTest | Level2) { AccessToken token; - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -381,15 +359,13 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0011, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0012, Function | MediumTest | Level2) { AccessToken token; - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#33#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#33#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -401,15 +377,13 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0012, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0013, Function | MediumTest | Level2) { AccessToken token; - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -421,15 +395,13 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0013, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0014, Function | MediumTest | Level2) { AccessToken token; - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -441,19 +413,17 @@ HWTEST_F(Ims1Test, cellular_call_DialCall_0014, Function | MediumTest | Level2) HWTEST_F(Ims1Test, cellular_call_DialCall_0015, Function | MediumTest | Level2) { AccessToken token; - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = TestDialCallByIms(SIM1_SLOTID, "*#4@3#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { - int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#43#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = TestDialCallByIms(SIM2_SLOTID, "*#4@3#"); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = TestDialCallByIms(SIM1_SLOTID, "*#4@3#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) { + int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#43#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = TestDialCallByIms(SIM2_SLOTID, "*#4@3#"); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -471,25 +441,23 @@ HWTEST_F(Ims1Test, cellular_call_HangUpCall_0001, Function | MediumTest | Level2 ASSERT_TRUE(hangUpCallRemote != nullptr); auto telephonyService = iface_cast(hangUpCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_DEFAULT); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_DEFAULT); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_DEFAULT); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_DEFAULT); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -507,21 +475,19 @@ HWTEST_F(Ims1Test, cellular_call_AnswerCall_0001, Function | MediumTest | Level2 ASSERT_TRUE(answerCallRemote != nullptr); auto telephonyService = iface_cast(answerCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Answer(callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Answer(callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Answer(callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Answer(callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); } } @@ -539,21 +505,19 @@ HWTEST_F(Ims1Test, cellular_call_RejectCall_0001, Function | MediumTest | Level2 ASSERT_TRUE(rejectCallRemote != nullptr); auto telephonyService = iface_cast(rejectCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Reject(callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->Reject(callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Reject(callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->Reject(callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); } } @@ -571,21 +535,19 @@ HWTEST_F(Ims1Test, cellular_call_HoldCall_0001, Function | MediumTest | Level2) ASSERT_TRUE(holdCallRemote != nullptr); auto telephonyService = iface_cast(holdCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HoldCall(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->HoldCall(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HoldCall(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->HoldCall(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -603,21 +565,19 @@ HWTEST_F(Ims1Test, cellular_call_UnHoldCall_0001, Function | MediumTest | Level2 ASSERT_TRUE(unHoldCallRemote != nullptr); auto telephonyService = iface_cast(unHoldCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->UnHoldCall(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->UnHoldCall(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->UnHoldCall(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->UnHoldCall(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -635,21 +595,19 @@ HWTEST_F(Ims1Test, cellular_call_SwitchCall_0001, Function | MediumTest | Level2 ASSERT_TRUE(switchCallRemote != nullptr); auto telephonyService = iface_cast(switchCallRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SwitchCall(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SwitchCall(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SwitchCall(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SwitchCall(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -667,21 +625,19 @@ HWTEST_F(Ims1Test, cellular_call_CombineConference_0001, Function | MediumTest | ASSERT_TRUE(combineRemote != nullptr); auto telephonyService = iface_cast(combineRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->CombineConference(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->CombineConference(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->CombineConference(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->CombineConference(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -699,21 +655,19 @@ HWTEST_F(Ims1Test, cellular_call_SeparateConference_0001, Function | MediumTest ASSERT_TRUE(separateRemote != nullptr); auto telephonyService = iface_cast(separateRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SeparateConference(callInfo); - EXPECT_EQ(ret, TELEPHONY_ERR_ARGUMENT_INVALID); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->SeparateConference(callInfo); - EXPECT_EQ(ret, TELEPHONY_ERR_ARGUMENT_INVALID); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SeparateConference(callInfo); + EXPECT_EQ(ret, TELEPHONY_ERR_ARGUMENT_INVALID); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->SeparateConference(callInfo); + EXPECT_EQ(ret, TELEPHONY_ERR_ARGUMENT_INVALID); } } @@ -731,21 +685,19 @@ HWTEST_F(Ims1Test, cellular_call_KickOutFromConference_0001, Function | MediumTe ASSERT_TRUE(kickOutRemote != nullptr); auto telephonyService = iface_cast(kickOutRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->KickOutFromConference(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->KickOutFromConference(callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->KickOutFromConference(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->KickOutFromConference(callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -763,23 +715,21 @@ HWTEST_F(Ims1Test, cellular_call_StartDtmf_0001, Function | MediumTest | Level2) ASSERT_TRUE(startDtmfRemote != nullptr); auto telephonyService = iface_cast(startDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->StartDtmf(code, callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->StartDtmf(code, callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->StartDtmf(code, callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->StartDtmf(code, callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); } } @@ -797,21 +747,19 @@ HWTEST_F(Ims1Test, cellular_call_StopDtmf_0001, Function | MediumTest | Level2) ASSERT_TRUE(stopDtmfRemote != nullptr); auto telephonyService = iface_cast(stopDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->StopDtmf(callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - ret = telephonyService->StopDtmf(callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->StopDtmf(callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + ret = telephonyService->StopDtmf(callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); } } @@ -829,23 +777,21 @@ HWTEST_F(Ims1Test, cellular_call_SendDtmf_0001, Function | MediumTest | Level2) ASSERT_TRUE(sendDtmfRemote != nullptr); auto telephonyService = iface_cast(sendDtmfRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->SendDtmf(code, callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } - if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { - CellularCallInfo callInfo; - int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - char code = '1'; - ret = telephonyService->SendDtmf(code, callInfo); - EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->SendDtmf(code, callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); + } + if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) { + CellularCallInfo callInfo; + int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + char code = '1'; + ret = telephonyService->SendDtmf(code, callInfo); + EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); } } @@ -863,17 +809,15 @@ HWTEST_F(Ims1Test, cellular_call_CanSetCallTransferTime_0001, Function | MediumT ASSERT_TRUE(transferRemote != nullptr); auto telephonyService = iface_cast(transferRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { - bool result; - int32_t ret = telephonyService->CanSetCallTransferTime(SIM1_SLOTID, result); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - bool result; - int32_t ret = telephonyService->CanSetCallTransferTime(SIM2_SLOTID, result); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) { + bool result; + int32_t ret = telephonyService->CanSetCallTransferTime(SIM1_SLOTID, result); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + bool result; + int32_t ret = telephonyService->CanSetCallTransferTime(SIM2_SLOTID, result); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } @@ -892,15 +836,13 @@ HWTEST_F(Ims1Test, cellular_call_SetVoNRState_0001, Function | MediumTest | Leve ASSERT_TRUE(setVoNRRemote != nullptr); auto telephonyService = iface_cast(setVoNRRemote); ASSERT_TRUE(telephonyService != nullptr); - if (HasSimCard(SIM1_SLOTID || HasSimCard(SIM2_SLOTID))) { - if (HasSimCard(SIM1_SLOTID)) { - int32_t ret = telephonyService->SetVoNRState(SIM1_SLOTID, 1); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } - if (HasSimCard(SIM2_SLOTID)) { - int32_t ret = telephonyService->SetVoNRState(SIM2_SLOTID, 1); - EXPECT_EQ(ret, TELEPHONY_SUCCESS); - } + if (HasSimCard(SIM1_SLOTID)) { + int32_t ret = telephonyService->SetVoNRState(SIM1_SLOTID, 1); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); + } + if (HasSimCard(SIM2_SLOTID)) { + int32_t ret = telephonyService->SetVoNRState(SIM2_SLOTID, 1); + EXPECT_EQ(ret, TELEPHONY_SUCCESS); } } } // namespace Telephony -- Gitee