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 ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::NONE ||
65 radioRsp_v1_1->rspInfo.error == RadioError::SIM_ABSENT ||
66 radioRsp_v1_1->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
67 radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
72 * Test IRadio.startNetworkScan() for the response returned.
74 TEST_F(RadioHidlTest_v1_1, startNetworkScan_InvalidArgument) {
75 int serial = GetRandomSerialNumber();
77 NetworkScanRequest request;
78 request.type = ScanType::ONE_SHOT;
79 request.interval = 60;
81 radio_v1_1->startNetworkScan(serial, request);
82 EXPECT_EQ(std::cv_status::no_timeout, wait());
83 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
84 EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
86 if (cardStatus.cardState == CardState::ABSENT) {
87 ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
88 radioRsp_v1_1->rspInfo.error == RadioError::SIM_ABSENT ||
89 radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
94 * Test IRadio.stopNetworkScan() for the response returned.
96 TEST_F(RadioHidlTest_v1_1, stopNetworkScan) {
97 int serial = GetRandomSerialNumber();
99 radio_v1_1->stopNetworkScan(serial);
100 EXPECT_EQ(std::cv_status::no_timeout, wait());
101 EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
102 EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
104 if (cardStatus.cardState == CardState::ABSENT) {
105 ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::NONE ||
106 radioRsp_v1_1->rspInfo.error == RadioError::SIM_ABSENT ||
107 radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);