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_interface.h"
24 
25 class MockCodecInterface {
26 public:
27   static void RegisterMockInstanceHook(std::function<void(MockCodecInterface*, bool)>);
28   static void ClearMockInstanceHookList();
29 
30   MockCodecInterface() = default;
31   MockCodecInterface(const MockCodecInterface&) = delete;
32   MockCodecInterface& operator=(const MockCodecInterface&) = delete;
33 
34   virtual ~MockCodecInterface() = default;
35 
36   MOCK_METHOD((bluetooth::le_audio::CodecInterface::Status), InitEncoder,
37               (const bluetooth::le_audio::LeAudioCodecConfiguration& pcm_config,
38                const bluetooth::le_audio::LeAudioCodecConfiguration& codec_config));
39   MOCK_METHOD(bluetooth::le_audio::CodecInterface::Status, InitDecoder,
40               (const bluetooth::le_audio::LeAudioCodecConfiguration& codec_config,
41                const bluetooth::le_audio::LeAudioCodecConfiguration& pcm_config));
42   MOCK_METHOD(bluetooth::le_audio::CodecInterface::Status, Encode,
43               (const uint8_t* data, int stride, uint16_t out_size, std::vector<int16_t>* out_buffer,
44                uint16_t out_offset));
45   MOCK_METHOD(bluetooth::le_audio::CodecInterface::Status, Decode, (uint8_t* data, uint16_t size));
46   MOCK_METHOD((void), Cleanup, ());
47   MOCK_METHOD((bool), IsReady, ());
48   MOCK_METHOD((uint16_t), GetNumOfSamplesPerChannel, ());
49   MOCK_METHOD((uint8_t), GetNumOfBytesPerSample, ());
50   MOCK_METHOD((std::vector<int16_t>&), GetDecodedSamples, ());
51 };
52