Hunsuk Choi | 9d4f38c | 2021-12-16 21:50:04 +0000 | [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 | #pragma once |
| 18 | |
| 19 | #include <aidl/android/hardware/radio/ims/BnRadioImsIndication.h> |
| 20 | #include <aidl/android/hardware/radio/ims/BnRadioImsResponse.h> |
| 21 | #include <aidl/android/hardware/radio/ims/IRadioIms.h> |
| 22 | |
| 23 | #include "radio_aidl_hal_utils.h" |
| 24 | |
| 25 | using namespace aidl::android::hardware::radio::ims; |
| 26 | |
| 27 | class RadioImsTest; |
| 28 | |
| 29 | /* Callback class for radio ims response */ |
| 30 | class RadioImsResponse : public BnRadioImsResponse { |
| 31 | protected: |
| 32 | RadioServiceTest& parent_ims; |
| 33 | |
| 34 | public: |
| 35 | RadioImsResponse(RadioServiceTest& parent_ims); |
| 36 | virtual ~RadioImsResponse() = default; |
| 37 | |
| 38 | RadioResponseInfo rspInfo; |
| 39 | |
| 40 | virtual ndk::ScopedAStatus setSrvccCallInfoResponse(const RadioResponseInfo& info) override; |
| 41 | |
| 42 | virtual ndk::ScopedAStatus updateImsRegistrationInfoResponse( |
| 43 | const RadioResponseInfo& info) override; |
| 44 | |
| 45 | virtual ndk::ScopedAStatus notifyImsTrafficResponse(const RadioResponseInfo& info) override; |
| 46 | |
| 47 | virtual ndk::ScopedAStatus performAcbCheckResponse(const RadioResponseInfo& info) override; |
| 48 | }; |
| 49 | |
| 50 | /* Callback class for radio ims indication */ |
| 51 | class RadioImsIndication : public BnRadioImsIndication { |
| 52 | protected: |
| 53 | RadioServiceTest& parent_ims; |
| 54 | |
| 55 | public: |
| 56 | RadioImsIndication(RadioServiceTest& parent_ims); |
| 57 | virtual ~RadioImsIndication() = default; |
| 58 | |
| 59 | virtual ndk::ScopedAStatus onConnectionSetupFailure(RadioIndicationType type, int token, |
| 60 | const ConnectionFailureInfo& info) override; |
| 61 | |
| 62 | virtual ndk::ScopedAStatus onAccessAllowed(RadioIndicationType type, int token) override; |
| 63 | }; |
| 64 | |
| 65 | // The main test class for Radio AIDL Ims. |
| 66 | class RadioImsTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest { |
| 67 | protected: |
| 68 | virtual void verifyError(RadioError resp); |
| 69 | |
| 70 | public: |
| 71 | virtual void SetUp() override; |
| 72 | |
| 73 | /* radio ims service handle */ |
| 74 | std::shared_ptr<IRadioIms> radio_ims; |
| 75 | /* radio ims response handle */ |
| 76 | std::shared_ptr<RadioImsResponse> radioRsp_ims; |
| 77 | /* radio ims indication handle */ |
| 78 | std::shared_ptr<RadioImsIndication> radioInd_ims; |
| 79 | }; |