1 /*
2  * Copyright 2021 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 #include <gtest/gtest.h>
18 
19 #include <cstdint>
20 
21 #include "stack/include/btu_hcif.h"
22 #include "stack/include/hci_error_code.h"
23 #include "stack/include/hcidefs.h"
24 #include "test/common/mock_functions.h"
25 
26 /* Function for test provided by btu_hcif.cc */
27 void btu_hcif_hdl_command_status(uint16_t opcode, uint8_t status,
28                                  const uint8_t* p_cmd);
29 
30 class StackBtuTest : public ::testing::Test {
31  protected:
SetUp()32   void SetUp() override { reset_mock_function_count_map(); }
33 };
34 
TEST_F(StackBtuTest,post_on_main)35 TEST_F(StackBtuTest, post_on_main) {}
36 
TEST_F(StackBtuTest,btm_sco_connection_failed_called)37 TEST_F(StackBtuTest, btm_sco_connection_failed_called) {
38   uint8_t p_cmd[10];  // garbage data for testing
39   bluetooth::legacy::testing::btu_hcif_hdl_command_status(
40       HCI_SETUP_ESCO_CONNECTION, HCI_ERR_UNSPECIFIED, p_cmd);
41   ASSERT_EQ(1, get_func_call_count("btm_sco_connection_failed"));
42 }
43