2 * Copyright (C) 2017 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <radio_hidl_hal_utils_v1_1.h>
20 * Test IRadio.setSimCardPower() for the response returned.
22 TEST_F(RadioHidlTest_v1_1, setSimCardPower_1_1) {
23 int serial = GetRandomSerialNumber();
25 radio_v1_1->setSimCardPower_1_1(serial, CardPowerState::POWER_DOWN);
26 EXPECT_EQ(std::cv_status::no_timeout, wait());
27 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
28 EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
30 if (cardStatus.cardState == CardState::ABSENT) {
31 ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::NONE ||
32 radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED ||
33 radioRsp_v1_1->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
34 radioRsp_v1_1->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE);
39 * Test IRadio.startNetworkScan() for the response returned.
41 TEST_F(RadioHidlTest_v1_1, startNetworkScan) {
42 int serial = GetRandomSerialNumber();
44 NetworkScanRequest request;
45 request.type = ScanType::ONE_SHOT;
46 request.interval = 60;
47 RadioAccessSpecifier specifier;
48 specifier.radioAccessNetwork = RadioAccessNetworks::GERAN;
49 specifier.geranBands.resize(2);
50 specifier.geranBands[0] = GeranBands::BAND_450;
51 specifier.geranBands[1] = GeranBands::BAND_480;
52 specifier.channels.resize(2);
53 specifier.channels[0] = 1;
54 specifier.channels[1] = 2;
55 request.specifiers.resize(1);
56 request.specifiers[0] = specifier;
58 radio_v1_1->startNetworkScan(serial, request);
59 EXPECT_EQ(std::cv_status::no_timeout, wait());
60 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
61 EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
63 if (cardStatus.cardState == CardState::ABSENT) {
64 ALOGI("startNetworkScan, rspInfo.error = %d\n", (int32_t)radioRsp_v1_1->rspInfo.error);
65 ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::NONE ||
66 radioRsp_v1_1->rspInfo.error == RadioError::SIM_ABSENT ||
67 radioRsp_v1_1->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
68 radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED ||
69 radioRsp_v1_1->rspInfo.error == RadioError::OPERATION_NOT_ALLOWED);
74 * Test IRadio.startNetworkScan() for the response returned.
76 TEST_F(RadioHidlTest_v1_1, startNetworkScan_InvalidArgument) {
77 int serial = GetRandomSerialNumber();
79 NetworkScanRequest request;
80 request.type = ScanType::ONE_SHOT;
81 request.interval = 60;
83 radio_v1_1->startNetworkScan(serial, request);
84 EXPECT_EQ(std::cv_status::no_timeout, wait());
85 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
86 EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
88 if (cardStatus.cardState == CardState::ABSENT) {
89 ALOGI("startNetworkScan_InvalidArgument, rspInfo.error = %d\n",
90 (int32_t)radioRsp_v1_1->rspInfo.error);
91 ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
92 radioRsp_v1_1->rspInfo.error == RadioError::SIM_ABSENT ||
93 radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
98 * Test IRadio.stopNetworkScan() for the response returned.
100 TEST_F(RadioHidlTest_v1_1, stopNetworkScan) {
101 int serial = GetRandomSerialNumber();
103 radio_v1_1->stopNetworkScan(serial);
104 EXPECT_EQ(std::cv_status::no_timeout, wait());
105 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
106 EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
108 if (cardStatus.cardState == CardState::ABSENT) {
109 ALOGI("stopNetworkScan rspInfo.error = %d\n", (int32_t)radioRsp_v1_1->rspInfo.error);
110 ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::NONE ||
111 radioRsp_v1_1->rspInfo.error == RadioError::SIM_ABSENT ||
112 radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);