blob: c981ebc8b0f63661803e599571434ecc6aa3f929 [file] [log] [blame]
Hunsuk Choi9d4f38c2021-12-16 21:50:04 +00001/*
Hunsuk Choid12c2f02022-10-06 01:00:53 +00002 * Copyright (C) 2022 The Android Open Source Project
Hunsuk Choi9d4f38c2021-12-16 21:50:04 +00003 *
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
25using namespace aidl::android::hardware::radio::ims;
26
27class RadioImsTest;
28
29/* Callback class for radio ims response */
30class 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;
Hunsuk Choif3ef4ff2022-03-29 03:10:35 +000039 std::optional<ConnectionFailureInfo> startImsTrafficResp;
Hunsuk Choi9d4f38c2021-12-16 21:50:04 +000040
41 virtual ndk::ScopedAStatus setSrvccCallInfoResponse(const RadioResponseInfo& info) override;
42
43 virtual ndk::ScopedAStatus updateImsRegistrationInfoResponse(
44 const RadioResponseInfo& info) override;
45
Hunsuk Choid12c2f02022-10-06 01:00:53 +000046 virtual ndk::ScopedAStatus startImsTrafficResponse(
47 const RadioResponseInfo& info,
Hunsuk Choif3ef4ff2022-03-29 03:10:35 +000048 const std::optional<ConnectionFailureInfo>& response) override;
Hunsuk Choi9d4f38c2021-12-16 21:50:04 +000049
Hunsuk Choif3ef4ff2022-03-29 03:10:35 +000050 virtual ndk::ScopedAStatus stopImsTrafficResponse(const RadioResponseInfo& info) override;
Hwayoung1ec992a2022-02-15 09:48:07 +000051
Hunsuk Choi539c9982022-08-01 05:47:36 +000052 virtual ndk::ScopedAStatus triggerEpsFallbackResponse(const RadioResponseInfo& info) override;
53
Hwayoung1ec992a2022-02-15 09:48:07 +000054 virtual ndk::ScopedAStatus sendAnbrQueryResponse(const RadioResponseInfo& info) override;
Hunsuk Choi9d4f38c2021-12-16 21:50:04 +000055};
56
57/* Callback class for radio ims indication */
58class RadioImsIndication : public BnRadioImsIndication {
59 protected:
60 RadioServiceTest& parent_ims;
61
62 public:
63 RadioImsIndication(RadioServiceTest& parent_ims);
64 virtual ~RadioImsIndication() = default;
65
Hunsuk Choif3ef4ff2022-03-29 03:10:35 +000066 virtual ndk::ScopedAStatus onConnectionSetupFailure(RadioIndicationType type,
67 const std::string& token, const ConnectionFailureInfo& info) override;
Hwayoung1ec992a2022-02-15 09:48:07 +000068
Helenc112be12022-04-26 01:02:40 +000069 virtual ndk::ScopedAStatus notifyAnbr(RadioIndicationType type, ImsStreamType mediaType,
Hwayoung1ec992a2022-02-15 09:48:07 +000070 ImsStreamDirection direction, int bitsPerSecond) override;
Hunsuk Choidb17f4f2022-04-12 06:26:48 +000071
Hunsuk Choi2456ad42022-09-02 03:52:53 +000072 virtual ndk::ScopedAStatus triggerImsDeregistration(RadioIndicationType type,
73 ImsDeregistrationReason reason) override;
Hunsuk Choi9d4f38c2021-12-16 21:50:04 +000074};
75
76// The main test class for Radio AIDL Ims.
77class RadioImsTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
78 protected:
79 virtual void verifyError(RadioError resp);
80
81 public:
82 virtual void SetUp() override;
83
84 /* radio ims service handle */
85 std::shared_ptr<IRadioIms> radio_ims;
86 /* radio ims response handle */
87 std::shared_ptr<RadioImsResponse> radioRsp_ims;
88 /* radio ims indication handle */
89 std::shared_ptr<RadioImsIndication> radioInd_ims;
90};