summaryrefslogtreecommitdiff
path: root/system/btif/test/btif_hf_client_service_test.cc
blob: db48af146b37f93212612e4fd40e1befe0ac7639 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <base/logging.h>
#include <gtest/gtest.h>
#include "bta_hfp_api.h"

#undef LOG_TAG
#include "btif/src/btif_hf_client.cc"

static tBTA_HF_CLIENT_FEAT gFeatures;


uint8_t btif_trace_level = BT_TRACE_LEVEL_WARNING;
void LogMsg(uint32_t trace_set_mask, const char* fmt_str, ...) {}
tBTA_STATUS BTA_HfClientEnable(tBTA_HF_CLIENT_CBACK* p_cback,
                               tBTA_HF_CLIENT_FEAT features,
                               const char* p_service_name) {
  gFeatures = features;
  return BTA_SUCCESS;
}
void BTA_HfClientDisable(void) { }
bt_status_t btif_transfer_context(tBTIF_CBACK* p_cback, uint16_t event,
                                  char* p_params, int param_len,
                                  tBTIF_COPY_CBACK* p_copy_cback) {
  return BT_STATUS_SUCCESS;
}
void btif_queue_advance() {}
const char* dump_hf_client_event(uint16_t event) {
  return "UNKNOWN MSG ID";
}

class BtifHfClientTest : public ::testing::Test {
 protected:
  void SetUp() override {
    gFeatures = BTIF_HF_CLIENT_FEATURES;
  }

  void TearDown() override {}
};

TEST_F(BtifHfClientTest, test_btif_hf_cleint_service) {
  bool enable = true;

  btif_hf_client_execute_service(enable);
  ASSERT_EQ((gFeatures & BTA_HF_CLIENT_FEAT_ESCO_S4) > 0,
            BTA_HFP_VERSION >= HFP_VERSION_1_7);
}