• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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, (), (const));
41   MOCK_METHOD(std::optional<bluetooth::le_audio::ProviderInfo>, GetCodecConfigProviderInfo, (),
42               (const));
43   MOCK_METHOD((bool), IsDualBiDirSwbSupported, (), (const));
44 
45   MOCK_METHOD((bool), UpdateActiveUnicastAudioHalClient,
46               (::bluetooth::le_audio::LeAudioSourceAudioHalClient * source_unicast_client,
47                ::bluetooth::le_audio::LeAudioSinkAudioHalClient* sink_unicast_client,
48                bool is_active));
49 
50   MOCK_METHOD((bool), UpdateActiveBroadcastAudioHalClient,
51               (::bluetooth::le_audio::LeAudioSourceAudioHalClient * source_broadcast_client,
52                bool is_active));
53 
54   MOCK_METHOD((void), UpdateActiveAudioConfig,
55               (const bluetooth::le_audio::types::BidirectionalPair<
56                        bluetooth::le_audio::stream_parameters>& stream_params,
57                std::function<void(const ::bluetooth::le_audio::stream_config& config,
58                                   uint8_t direction)>
59                        update_receiver,
60                uint8_t directions_to_update));
61   MOCK_METHOD(
62           (std::unique_ptr<bluetooth::le_audio::types::AudioSetConfiguration>), GetCodecConfig,
63           (const bluetooth::le_audio::CodecManager::UnicastConfigurationRequirements& requirements,
64            bluetooth::le_audio::CodecManager::UnicastConfigurationProvider),
65           (const));
66   MOCK_METHOD((bool), CheckCodecConfigIsBiDirSwb,
67               (const bluetooth::le_audio::types::AudioSetConfiguration& config), (const));
68   MOCK_METHOD((bool), CheckCodecConfigIsDualBiDirSwb,
69               (const bluetooth::le_audio::types::AudioSetConfiguration& config), (const));
70   MOCK_METHOD((std::unique_ptr<bluetooth::le_audio::broadcaster::BroadcastConfiguration>),
71               GetBroadcastConfig,
72               (const bluetooth::le_audio::CodecManager::BroadcastConfigurationRequirements&),
73               (const));
74   MOCK_METHOD((std::vector<bluetooth::le_audio::btle_audio_codec_config_t>),
75               GetLocalAudioOutputCodecCapa, ());
76   MOCK_METHOD((std::vector<bluetooth::le_audio::btle_audio_codec_config_t>),
77               GetLocalAudioInputCodecCapa, ());
78   MOCK_METHOD((void), UpdateBroadcastConnHandle,
79               (const std::vector<uint16_t>& conn_handle,
80                std::function<void(const ::bluetooth::le_audio::broadcast_offload_config& config)>
81                        update_receiver));
82   MOCK_METHOD((bool), UpdateCisConfiguration,
83               (const std::vector<struct bluetooth::le_audio::types::cis>& cises,
84                const bluetooth::le_audio::stream_parameters& stream_params, uint8_t direction),
85               (const));
86   MOCK_METHOD((void), ClearCisConfiguration, (uint8_t direction));
87   MOCK_METHOD((bool), IsUsingCodecExtensibility, (), (const));
88 
89   MOCK_METHOD((void), Start, ());
90   MOCK_METHOD((void), Stop, ());
91 };
92