diff options
author | paulye <paulye@google.com> | 2019-02-07 19:29:05 -0800 |
---|---|---|
committer | paulye <paulye@google.com> | 2019-02-21 16:03:48 -0800 |
commit | 2a7c4a59d0e8888d0e1dcda5887efda2191817ce (patch) | |
tree | 218f48635b91c43e8394421ba603483bf1d0f22a /radio/1.4 | |
parent | 603244cb70d64a1862dbb1a1f411500c9fa62fa4 (diff) | |
download | platform_hardware_interfaces-2a7c4a59d0e8888d0e1dcda5887efda2191817ce.tar.gz platform_hardware_interfaces-2a7c4a59d0e8888d0e1dcda5887efda2191817ce.tar.bz2 platform_hardware_interfaces-2a7c4a59d0e8888d0e1dcda5887efda2191817ce.zip |
Add vts tests for start network scan 1.4.
Bug: 122730115
Test: vts
Change-Id: If04c5b8c2d2c7d5239805ef65df577f7d4dea61b
Diffstat (limited to 'radio/1.4')
-rw-r--r-- | radio/1.4/vts/functional/radio_hidl_hal_api.cpp | 344 |
1 files changed, 344 insertions, 0 deletions
diff --git a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp index f9404d2d64..52eb27779e 100644 --- a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp @@ -96,6 +96,350 @@ TEST_F(RadioHidlTest_v1_4, emergencyDial_withEmergencyRouting) { } /* + * Test IRadio.startNetworkScan() for the response returned. + */ +TEST_F(RadioHidlTest_v1_4, startNetworkScan) { + serial = GetRandomSerialNumber(); + + RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, + .geranBands = {GeranBands::BAND_450, GeranBands::BAND_480}, + .channels = {1, 2}}; + + ::android::hardware::radio::V1_2::NetworkScanRequest request = { + .type = ScanType::ONE_SHOT, .interval = 60, .specifiers = {specifier}}; + + Return<void> res = radio_v1_4->startNetworkScan_1_4(serial, request); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type); + EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial); + + ALOGI("startNetworkScan, rspInfo.error = %s\n", toString(radioRsp_v1_4->rspInfo.error).c_str()); + + if (cardStatus.base.base.cardState == CardState::ABSENT) { + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, {RadioError::SIM_ABSENT})); + } else if (cardStatus.base.base.cardState == CardState::PRESENT) { + // OPERATION_NOT_ALLOWED should not be allowed; however, some vendors do not support the + // required manual GSM search functionality. This is tracked in b/112206766. + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, + {RadioError::NONE, RadioError::OPERATION_NOT_ALLOWED})); + } +} + +/* + * Test IRadio.startNetworkScan() with invalid specifier. + */ +TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidArgument) { + serial = GetRandomSerialNumber(); + + ::android::hardware::radio::V1_2::NetworkScanRequest request = {.type = ScanType::ONE_SHOT, + .interval = 60}; + + Return<void> res = radio_v1_4->startNetworkScan_1_4(serial, request); + + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type); + EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial); + + ALOGI("startNetworkScan_InvalidArgument, rspInfo.error = %s\n", + toString(radioRsp_v1_4->rspInfo.error).c_str()); + if (cardStatus.base.base.cardState == CardState::ABSENT) { + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, + {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); + } else if (cardStatus.base.base.cardState == CardState::PRESENT) { + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + } +} + +/* + * Test IRadio.startNetworkScan() with invalid interval (lower boundary). + */ +TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidInterval1) { + serial = GetRandomSerialNumber(); + + RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, + .geranBands = {GeranBands::BAND_450, GeranBands::BAND_480}, + .channels = {1, 2}}; + + ::android::hardware::radio::V1_2::NetworkScanRequest request = { + .type = ScanType::ONE_SHOT, + .interval = 4, + .specifiers = {specifier}, + .maxSearchTime = 60, + .incrementalResults = false, + .incrementalResultsPeriodicity = 1}; + + Return<void> res = radio_v1_4->startNetworkScan_1_4(serial, request); + + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type); + EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial); + + ALOGI("startNetworkScan_InvalidInterval1, rspInfo.error = %s\n", + toString(radioRsp_v1_4->rspInfo.error).c_str()); + if (cardStatus.base.base.cardState == CardState::ABSENT) { + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, + {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); + } else if (cardStatus.base.base.cardState == CardState::PRESENT) { + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + } +} + +/* + * Test IRadio.startNetworkScan() with invalid interval (upper boundary). + */ +TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidInterval2) { + serial = GetRandomSerialNumber(); + + RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, + .geranBands = {GeranBands::BAND_450, GeranBands::BAND_480}, + .channels = {1, 2}}; + + ::android::hardware::radio::V1_2::NetworkScanRequest request = { + .type = ScanType::ONE_SHOT, + .interval = 301, + .specifiers = {specifier}, + .maxSearchTime = 60, + .incrementalResults = false, + .incrementalResultsPeriodicity = 1}; + + Return<void> res = radio_v1_4->startNetworkScan_1_4(serial, request); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type); + EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial); + + ALOGI("startNetworkScan_InvalidInterval2, rspInfo.error = %s\n", + toString(radioRsp_v1_4->rspInfo.error).c_str()); + if (cardStatus.base.base.cardState == CardState::ABSENT) { + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, + {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); + } else if (cardStatus.base.base.cardState == CardState::PRESENT) { + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + } +} + +/* + * Test IRadio.startNetworkScan() with invalid max search time (lower boundary). + */ +TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidMaxSearchTime1) { + serial = GetRandomSerialNumber(); + + RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, + .geranBands = {GeranBands::BAND_450, GeranBands::BAND_480}, + .channels = {1, 2}}; + + ::android::hardware::radio::V1_2::NetworkScanRequest request = { + .type = ScanType::ONE_SHOT, + .interval = 60, + .specifiers = {specifier}, + .maxSearchTime = 59, + .incrementalResults = false, + .incrementalResultsPeriodicity = 1}; + + Return<void> res = radio_v1_4->startNetworkScan_1_4(serial, request); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type); + EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial); + + ALOGI("startNetworkScan_InvalidMaxSearchTime1, rspInfo.error = %s\n", + toString(radioRsp_v1_4->rspInfo.error).c_str()); + if (cardStatus.base.base.cardState == CardState::ABSENT) { + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, + {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); + } else if (cardStatus.base.base.cardState == CardState::PRESENT) { + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + } +} + +/* + * Test IRadio.startNetworkScan() with invalid max search time (upper boundary). + */ +TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidMaxSearchTime2) { + serial = GetRandomSerialNumber(); + + RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, + .geranBands = {GeranBands::BAND_450, GeranBands::BAND_480}, + .channels = {1, 2}}; + + ::android::hardware::radio::V1_2::NetworkScanRequest request = { + .type = ScanType::ONE_SHOT, + .interval = 60, + .specifiers = {specifier}, + .maxSearchTime = 3601, + .incrementalResults = false, + .incrementalResultsPeriodicity = 1}; + + Return<void> res = radio_v1_4->startNetworkScan_1_4(serial, request); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type); + EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial); + + ALOGI("startNetworkScan_InvalidMaxSearchTime2, rspInfo.error = %s\n", + toString(radioRsp_v1_4->rspInfo.error).c_str()); + if (cardStatus.base.base.cardState == CardState::ABSENT) { + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, + {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); + } else if (cardStatus.base.base.cardState == CardState::PRESENT) { + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + } +} + +/* + * Test IRadio.startNetworkScan() with invalid periodicity (lower boundary). + */ +TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidPeriodicity1) { + serial = GetRandomSerialNumber(); + + RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, + .geranBands = {GeranBands::BAND_450, GeranBands::BAND_480}, + .channels = {1, 2}}; + + ::android::hardware::radio::V1_2::NetworkScanRequest request = { + .type = ScanType::ONE_SHOT, + .interval = 60, + .specifiers = {specifier}, + .maxSearchTime = 600, + .incrementalResults = false, + .incrementalResultsPeriodicity = 0}; + + Return<void> res = radio_v1_4->startNetworkScan_1_4(serial, request); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type); + EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial); + + ALOGI("startNetworkScan_InvalidPeriodicity1, rspInfo.error = %s\n", + toString(radioRsp_v1_4->rspInfo.error).c_str()); + if (cardStatus.base.base.cardState == CardState::ABSENT) { + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, + {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); + } else if (cardStatus.base.base.cardState == CardState::PRESENT) { + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + } +} + +/* + * Test IRadio.startNetworkScan() with invalid periodicity (upper boundary). + */ +TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidPeriodicity2) { + serial = GetRandomSerialNumber(); + + RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, + .geranBands = {GeranBands::BAND_450, GeranBands::BAND_480}, + .channels = {1, 2}}; + + ::android::hardware::radio::V1_2::NetworkScanRequest request = { + .type = ScanType::ONE_SHOT, + .interval = 60, + .specifiers = {specifier}, + .maxSearchTime = 600, + .incrementalResults = false, + .incrementalResultsPeriodicity = 11}; + + Return<void> res = radio_v1_4->startNetworkScan_1_4(serial, request); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type); + EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial); + + ALOGI("startNetworkScan_InvalidPeriodicity2, rspInfo.error = %s\n", + toString(radioRsp_v1_4->rspInfo.error).c_str()); + if (cardStatus.base.base.cardState == CardState::ABSENT) { + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, + {RadioError::SIM_ABSENT, RadioError::INVALID_ARGUMENTS})); + } else if (cardStatus.base.base.cardState == CardState::PRESENT) { + ASSERT_TRUE( + CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, {RadioError::INVALID_ARGUMENTS})); + } +} + +/* + * Test IRadio.startNetworkScan() with valid periodicity + */ +TEST_F(RadioHidlTest_v1_4, startNetworkScan_GoodRequest1) { + serial = GetRandomSerialNumber(); + + RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, + .geranBands = {GeranBands::BAND_450, GeranBands::BAND_480}, + .channels = {1, 2}}; + + ::android::hardware::radio::V1_2::NetworkScanRequest request = { + .type = ScanType::ONE_SHOT, + .interval = 60, + .specifiers = {specifier}, + // Some vendor may not support max search time of 360s. + // This issue is tracked in b/112205669. + .maxSearchTime = 300, + .incrementalResults = false, + .incrementalResultsPeriodicity = 10}; + + Return<void> res = radio_v1_4->startNetworkScan_1_4(serial, request); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type); + EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial); + + ALOGI("startNetworkScan_GoodRequest1, rspInfo.error = %s\n", + toString(radioRsp_v1_4->rspInfo.error).c_str()); + if (cardStatus.base.base.cardState == CardState::ABSENT) { + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, + {RadioError::NONE, RadioError::SIM_ABSENT})); + } else if (cardStatus.base.base.cardState == CardState::PRESENT) { + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, + {RadioError::NONE, RadioError::INVALID_ARGUMENTS})); + } +} + +/* + * Test IRadio.startNetworkScan() with valid periodicity and plmns + */ +TEST_F(RadioHidlTest_v1_4, startNetworkScan_GoodRequest2) { + serial = GetRandomSerialNumber(); + + RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, + .geranBands = {GeranBands::BAND_450, GeranBands::BAND_480}, + .channels = {1, 2}}; + + ::android::hardware::radio::V1_2::NetworkScanRequest request = { + .type = ScanType::ONE_SHOT, + .interval = 60, + .specifiers = {specifier}, + // Some vendor may not support max search time of 360s. + // This issue is tracked in b/112205669. + .maxSearchTime = 300, + .incrementalResults = false, + .incrementalResultsPeriodicity = 10, + .mccMncs = {"310410"}}; + + Return<void> res = radio_v1_4->startNetworkScan_1_4(serial, request); + + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type); + EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial); + + ALOGI("startNetworkScan_GoodRequest2, rspInfo.error = %s\n", + toString(radioRsp_v1_4->rspInfo.error).c_str()); + if (cardStatus.base.base.cardState == CardState::ABSENT) { + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, + {RadioError::NONE, RadioError::SIM_ABSENT})); + } else if (cardStatus.base.base.cardState == CardState::PRESENT) { + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_4->rspInfo.error, + {RadioError::NONE, RadioError::INVALID_ARGUMENTS})); + } +} +/* * Test IRadio.setupDataCall_1_4() for the response returned. */ TEST_F(RadioHidlTest_v1_4, setupDataCall_1_4) { |