• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <map>
21 #include <string>
22 
23 #include "stack/include/btu.h"
24 #include "stack/include/hci_error_code.h"
25 #include "stack/include/hcidefs.h"
26 #include "test/common/mock_functions.h"
27 
28 /* Function for test provided by btu_hcif.cc */
29 void btu_hcif_hdl_command_status(uint16_t opcode, uint8_t status,
30                                  const uint8_t* p_cmd,
31                                  void* p_vsc_status_cback);
32 
33 class StackBtuTest : public ::testing::Test {
34  protected:
SetUp()35   void SetUp() override { reset_mock_function_count_map(); }
36 };
37 
TEST_F(StackBtuTest,post_on_main)38 TEST_F(StackBtuTest, post_on_main) {}
39 
TEST_F(StackBtuTest,btm_sco_connection_failed_called)40 TEST_F(StackBtuTest, btm_sco_connection_failed_called) {
41   uint8_t p_cmd[10];  // garbage data for testing
42   bluetooth::legacy::testing::btu_hcif_hdl_command_status(
43       HCI_SETUP_ESCO_CONNECTION, HCI_ERR_UNSPECIFIED, p_cmd, nullptr);
44   ASSERT_EQ(1, get_func_call_count("btm_sco_connection_failed"));
45 }
46