Sarah Chin | 91997ac | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 The Android Open Source Project |
| 3 | * |
| 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 |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 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. |
| 15 | */ |
| 16 | |
| 17 | #include <android-base/logging.h> |
| 18 | #include <android/binder_manager.h> |
| 19 | |
| 20 | #include "radio_config_utils.h" |
| 21 | |
| 22 | #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) |
| 23 | |
| 24 | void RadioConfigTest::SetUp() { |
| 25 | std::string serviceName = GetParam(); |
| 26 | |
| 27 | if (!isServiceValidForDeviceConfiguration(serviceName)) { |
| 28 | ALOGI("Skipped the test due to device configuration."); |
| 29 | GTEST_SKIP(); |
| 30 | } |
| 31 | |
| 32 | radio_config = IRadioConfig::fromBinder( |
| 33 | ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str()))); |
| 34 | ASSERT_NE(nullptr, radio_config.get()); |
| 35 | |
| 36 | radioRsp_config = ndk::SharedRefBase::make<RadioConfigResponse>(*this); |
| 37 | ASSERT_NE(nullptr, radioRsp_config.get()); |
| 38 | |
| 39 | count_ = 0; |
| 40 | |
| 41 | radioInd_config = ndk::SharedRefBase::make<RadioConfigIndication>(*this); |
| 42 | ASSERT_NE(nullptr, radioInd_config.get()); |
| 43 | |
| 44 | radio_config->setResponseFunctions(radioRsp_config, radioInd_config); |
| 45 | } |
| 46 | |
| 47 | /* |
| 48 | * Test IRadioConfig.getHalDeviceCapabilities() for the response returned. |
| 49 | */ |
| 50 | TEST_P(RadioConfigTest, getHalDeviceCapabilities) { |
| 51 | serial = GetRandomSerialNumber(); |
| 52 | ndk::ScopedAStatus res = radio_config->getHalDeviceCapabilities(serial); |
| 53 | ASSERT_OK(res); |
| 54 | ALOGI("getHalDeviceCapabilities, rspInfo.error = %s\n", |
| 55 | toString(radioRsp_config->rspInfo.error).c_str()); |
| 56 | } |