1 /*
2  * Copyright 2022 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 <gmock/gmock.h>
20 
21 #include <vector>
22 
23 #include "codec_manager.h"
24 
25 namespace bluetooth::le_audio {
26 class LeAudioSinkAudioHalClient;
27 class LeAudioSourceAudioHalClient;
28 }  // namespace bluetooth::le_audio
29 
30 class MockCodecManager {
31  public:
32   static MockCodecManager* GetInstance();
33 
34   MockCodecManager() = default;
35   MockCodecManager(const MockCodecManager&) = delete;
36   MockCodecManager& operator=(const MockCodecManager&) = delete;
37 
38   virtual ~MockCodecManager() = default;
39 
40   MOCK_METHOD((bluetooth::le_audio::types::CodecLocation), GetCodecLocation, (),
41               (const));
42   MOCK_METHOD((bool), IsDualBiDirSwbSupported, (), (const));
43 
44   MOCK_METHOD(
45       (bool), UpdateActiveUnicastAudioHalClient,
46       (::bluetooth::le_audio::LeAudioSourceAudioHalClient *
47            source_unicast_client,
48        ::bluetooth::le_audio::LeAudioSinkAudioHalClient* sink_unicast_client,
49        bool is_active));
50 
51   MOCK_METHOD((bool), UpdateActiveBroadcastAudioHalClient,
52               (::bluetooth::le_audio::LeAudioSourceAudioHalClient *
53                    source_broadcast_client,
54                bool is_active));
55 
56   MOCK_METHOD(
57       (void), UpdateActiveAudioConfig,
58       (const bluetooth::le_audio::types::BidirectionalPair<
59            bluetooth::le_audio::stream_parameters>& stream_params,
60        bluetooth::le_audio::types::BidirectionalPair<uint16_t> delays_ms,
61        std::function<void(const ::bluetooth::le_audio::offload_config& config,
62                           uint8_t direction)>
63            update_receiver));
64   MOCK_METHOD(
65       (std::unique_ptr<
66           bluetooth::le_audio::set_configurations::AudioSetConfiguration>),
67       GetCodecConfig,
68       (const bluetooth::le_audio::CodecManager::
69            UnicastConfigurationRequirements& requirements,
70        bluetooth::le_audio::CodecManager::UnicastConfigurationVerifier),
71       (const));
72   MOCK_METHOD(
73       (bool), CheckCodecConfigIsBiDirSwb,
74       (const bluetooth::le_audio::set_configurations::AudioSetConfiguration&
75            config),
76       (const));
77   MOCK_METHOD(
78       (bool), CheckCodecConfigIsDualBiDirSwb,
79       (const bluetooth::le_audio::set_configurations::AudioSetConfiguration&
80            config),
81       (const));
82   MOCK_METHOD((std::unique_ptr<
83                   bluetooth::le_audio::broadcaster::BroadcastConfiguration>),
84               GetBroadcastConfig,
85               (const bluetooth::le_audio::CodecManager::
86                    BroadcastConfigurationRequirements&),
87               (const));
88   MOCK_METHOD((std::vector<bluetooth::le_audio::btle_audio_codec_config_t>),
89               GetLocalAudioOutputCodecCapa, ());
90   MOCK_METHOD((std::vector<bluetooth::le_audio::btle_audio_codec_config_t>),
91               GetLocalAudioInputCodecCapa, ());
92   MOCK_METHOD(
93       (void), UpdateBroadcastConnHandle,
94       (const std::vector<uint16_t>& conn_handle,
95        std::function<
96            void(const ::bluetooth::le_audio::broadcast_offload_config& config)>
97            update_receiver));
98   MOCK_METHOD((void), UpdateCisConfiguration,
99               (const std::vector<struct bluetooth::le_audio::types::cis>& cises,
100                const bluetooth::le_audio::stream_parameters& stream_params,
101                uint8_t direction),
102               (const));
103   MOCK_METHOD((void), ClearCisConfiguration, (uint8_t direction));
104   MOCK_METHOD((bool), IsUsingCodecExtensibility, (), (const));
105 
106   MOCK_METHOD((void), Start, ());
107   MOCK_METHOD((void), Stop, ());
108 };
109