17fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu/*
27fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu * Copyright (C) 2018 The Android Open Source Project
37fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu *
47fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu * Licensed under the Apache License, Version 2.0 (the "License");
57fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu * you may not use this file except in compliance with the License.
67fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu * You may obtain a copy of the License at
77fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu *
87fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu *      http://www.apache.org/licenses/LICENSE-2.0
97fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu *
107fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu * Unless required by applicable law or agreed to in writing, software
117fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu * distributed under the License is distributed on an "AS IS" BASIS,
127fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
137fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu * See the License for the specific language governing permissions and
147fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu * limitations under the License.
157fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu */
167fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu
177fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu#include <radio_config_hidl_hal_utils.h>
187fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu
197fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
207fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu
217fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu/*
227fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu * Test IRadioConfig.getSimSlotsStatus()
237fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu */
247fd46a30f30c8a4ada30777e94e80e788e45dd0byinxuTEST_F(RadioConfigHidlTest, getSimSlotsStatus) {
257fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    const int serial = GetRandomSerialNumber();
267fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    Return<void> res = radioConfig->getSimSlotsStatus(serial);
277fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    ASSERT_OK(res);
287fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    EXPECT_EQ(std::cv_status::no_timeout, wait());
297fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
307fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
317fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    ALOGI("getIccSlotsStatus, rspInfo.error = %s\n",
327fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu          toString(radioConfigRsp->rspInfo.error).c_str());
337fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu
347fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    ASSERT_TRUE(CheckAnyOfErrors(radioConfigRsp->rspInfo.error,
357fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu                                 {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
367fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu}
377fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu
387fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu/*
397fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu * Test IRadioConfig.setSimSlotsMapping()
407fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu */
417fd46a30f30c8a4ada30777e94e80e788e45dd0byinxuTEST_F(RadioConfigHidlTest, setSimSlotsMapping) {
427fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    const int serial = GetRandomSerialNumber();
437fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    android::hardware::hidl_vec<uint32_t> mapping = {0};
447fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    Return<void> res = radioConfig->setSimSlotsMapping(serial, mapping);
457fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    ASSERT_OK(res);
467fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    EXPECT_EQ(std::cv_status::no_timeout, wait());
477fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
487fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
497fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    ALOGI("setSimSlotsMapping, rspInfo.error = %s\n",
507fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu          toString(radioConfigRsp->rspInfo.error).c_str());
517fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu
527fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu    ASSERT_TRUE(CheckAnyOfErrors(radioConfigRsp->rspInfo.error,
537fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu                                 {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
547fd46a30f30c8a4ada30777e94e80e788e45dd0byinxu}
55