• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2021 HIMSA II K/S - www.himsa.com.
3  * Represented by EHIMA - www.ehima.com
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #include "mock_state_machine.h"
19 
20 #include <base/logging.h>
21 
22 static MockLeAudioGroupStateMachine* mock_machine = nullptr;
23 
Initialize(le_audio::LeAudioGroupStateMachine::Callbacks * state_machine_callbacks)24 void le_audio::LeAudioGroupStateMachine::Initialize(
25     le_audio::LeAudioGroupStateMachine::Callbacks* state_machine_callbacks) {
26   LOG_ASSERT(mock_machine) << "Mock State Machine not set!";
27   mock_machine->Initialize(state_machine_callbacks);
28 }
29 
Cleanup(void)30 void le_audio::LeAudioGroupStateMachine::Cleanup(void) {
31   LOG_ASSERT(mock_machine) << "Mock State Machine not set!";
32   mock_machine->Cleanup();
33 }
34 
Get(void)35 le_audio::LeAudioGroupStateMachine* le_audio::LeAudioGroupStateMachine::Get(
36     void) {
37   return mock_machine;
38 }
39 
SetMockInstanceForTesting(MockLeAudioGroupStateMachine * machine)40 void MockLeAudioGroupStateMachine::SetMockInstanceForTesting(
41     MockLeAudioGroupStateMachine* machine) {
42   mock_machine = machine;
43 }
44