Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b3f56567 authored by Chris Manton's avatar Chris Manton
Browse files

mock: Update bta_sdp mocks

Also include additional default return value for tool

Bug: 187825293
Test: mma .

Change-Id: I94dce71369219cc6fb686c6666b168120be5503b
parent 6291a12f
Loading
Loading
Loading
Loading
+51 −19
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright 2021 The Android Open Source Project
 * Copyright 2023 The Android Open Source Project
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * you may not use this file except in compliance with the License.
@@ -13,43 +13,75 @@
 * See the License for the specific language governing permissions and
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * limitations under the License.
 */
 */

/*
/*
 * Generated mock file from original source file
 * Generated mock file from original source file
 *   Functions generated:4
 *   Functions generated:5
 *
 *  mockcify.pl ver 0.6.1
 */
 */


#include <base/functional/bind.h>
#include <cstdint>
#include <base/location.h>
#include <functional>

#include <map>
#include <map>
#include <string>
#include <string>


#include "bt_target.h"
// Mock include file to share data between tests and mock
#include "bta/include/bta_sdp_api.h"
#include "test/mock/mock_bta_sdp_api.h"
#include "bta/sdp/bta_sdp_int.h"

#include "test/common/mock_functions.h"
// Original usings
#include "types/bluetooth/uuid.h"

#include "types/raw_address.h"
// Mocked internal structures, if any

namespace test {
namespace mock {
namespace bta_sdp_api {


#ifndef UNUSED_ATTR
// Function state capture and return values, if needed
#define UNUSED_ATTR
struct BTA_SdpCreateRecordByUser BTA_SdpCreateRecordByUser;
#endif
struct BTA_SdpDumpsys BTA_SdpDumpsys;
struct BTA_SdpEnable BTA_SdpEnable;
struct BTA_SdpRemoveRecordByUser BTA_SdpRemoveRecordByUser;
struct BTA_SdpSearch BTA_SdpSearch;


}  // namespace bta_sdp_api
}  // namespace mock
}  // namespace test

// Mocked function return values, if any
namespace test {
namespace mock {
namespace bta_sdp_api {

tBTA_SDP_STATUS BTA_SdpCreateRecordByUser::return_value = BTA_SDP_SUCCESS;
tBTA_SDP_STATUS BTA_SdpEnable::return_value = BTA_SDP_SUCCESS;
tBTA_SDP_STATUS BTA_SdpRemoveRecordByUser::return_value = BTA_SDP_SUCCESS;
tBTA_SDP_STATUS BTA_SdpSearch::return_value = BTA_SDP_SUCCESS;

}  // namespace bta_sdp_api
}  // namespace mock
}  // namespace test

// Mocked functions, if any
tBTA_SDP_STATUS BTA_SdpCreateRecordByUser(void* user_data) {
tBTA_SDP_STATUS BTA_SdpCreateRecordByUser(void* user_data) {
  inc_func_call_count(__func__);
  inc_func_call_count(__func__);
  return BTA_SDP_SUCCESS;
  return test::mock::bta_sdp_api::BTA_SdpCreateRecordByUser(user_data);
}
void BTA_SdpDumpsys(int fd) {
  inc_func_call_count(__func__);
  test::mock::bta_sdp_api::BTA_SdpDumpsys(fd);
}
}
tBTA_SDP_STATUS BTA_SdpEnable(tBTA_SDP_DM_CBACK* p_cback) {
tBTA_SDP_STATUS BTA_SdpEnable(tBTA_SDP_DM_CBACK* p_cback) {
  inc_func_call_count(__func__);
  inc_func_call_count(__func__);
  return BTA_SDP_SUCCESS;
  return test::mock::bta_sdp_api::BTA_SdpEnable(p_cback);
}
}
tBTA_SDP_STATUS BTA_SdpRemoveRecordByUser(void* user_data) {
tBTA_SDP_STATUS BTA_SdpRemoveRecordByUser(void* user_data) {
  inc_func_call_count(__func__);
  inc_func_call_count(__func__);
  return BTA_SDP_SUCCESS;
  return test::mock::bta_sdp_api::BTA_SdpRemoveRecordByUser(user_data);
}
}
tBTA_SDP_STATUS BTA_SdpSearch(const RawAddress& bd_addr,
tBTA_SDP_STATUS BTA_SdpSearch(const RawAddress& bd_addr,
                              const bluetooth::Uuid& uuid) {
                              const bluetooth::Uuid& uuid) {
  inc_func_call_count(__func__);
  inc_func_call_count(__func__);
  return BTA_SDP_SUCCESS;
  return test::mock::bta_sdp_api::BTA_SdpSearch(bd_addr, uuid);
}
}
// Mocked functions complete
// END mockcify generation
+116 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#pragma once

/*
 * Generated mock file from original source file
 *   Functions generated:5
 *
 *  mockcify.pl ver 0.6.1
 */

#include <cstdint>
#include <functional>
#include <map>
#include <string>

#include "test/common/mock_functions.h"

// Original included files, if any
// NOTE: Since this is a mock file with mock definitions some number of
//       include files may not be required.  The include-what-you-use
//       still applies, but crafting proper inclusion is out of scope
//       for this effort.  This compilation unit may compile as-is, or
//       may need attention to prune from (or add to ) the inclusion set.
#include "bta/include/bta_sdp_api.h"
#include "types/bluetooth/uuid.h"
#include "types/raw_address.h"

// Original usings

// Mocked compile conditionals, if any

namespace test {
namespace mock {
namespace bta_sdp_api {

// Shared state between mocked functions and tests
// Name: BTA_SdpCreateRecordByUser
// Params: void* user_data
// Return: tBTA_SDP_STATUS
struct BTA_SdpCreateRecordByUser {
  static tBTA_SDP_STATUS return_value;
  std::function<tBTA_SDP_STATUS(void* user_data)> body{
      [](void* user_data) { return return_value; }};
  tBTA_SDP_STATUS operator()(void* user_data) { return body(user_data); };
};
extern struct BTA_SdpCreateRecordByUser BTA_SdpCreateRecordByUser;

// Name: BTA_SdpDumpsys
// Params: int fd
// Return: void
struct BTA_SdpDumpsys {
  std::function<void(int fd)> body{[](int fd) {}};
  void operator()(int fd) { body(fd); };
};
extern struct BTA_SdpDumpsys BTA_SdpDumpsys;

// Name: BTA_SdpEnable
// Params: tBTA_SDP_DM_CBACK* p_cback
// Return: tBTA_SDP_STATUS
struct BTA_SdpEnable {
  static tBTA_SDP_STATUS return_value;
  std::function<tBTA_SDP_STATUS(tBTA_SDP_DM_CBACK* p_cback)> body{
      [](tBTA_SDP_DM_CBACK* p_cback) { return return_value; }};
  tBTA_SDP_STATUS operator()(tBTA_SDP_DM_CBACK* p_cback) {
    return body(p_cback);
  };
};
extern struct BTA_SdpEnable BTA_SdpEnable;

// Name: BTA_SdpRemoveRecordByUser
// Params: void* user_data
// Return: tBTA_SDP_STATUS
struct BTA_SdpRemoveRecordByUser {
  static tBTA_SDP_STATUS return_value;
  std::function<tBTA_SDP_STATUS(void* user_data)> body{
      [](void* user_data) { return return_value; }};
  tBTA_SDP_STATUS operator()(void* user_data) { return body(user_data); };
};
extern struct BTA_SdpRemoveRecordByUser BTA_SdpRemoveRecordByUser;

// Name: BTA_SdpSearch
// Params: const RawAddress& bd_addr, const bluetooth::Uuid& uuid
// Return: tBTA_SDP_STATUS
struct BTA_SdpSearch {
  static tBTA_SDP_STATUS return_value;
  std::function<tBTA_SDP_STATUS(const RawAddress& bd_addr,
                                const bluetooth::Uuid& uuid)>
      body{[](const RawAddress& bd_addr, const bluetooth::Uuid& uuid) {
        return return_value;
      }};
  tBTA_SDP_STATUS operator()(const RawAddress& bd_addr,
                             const bluetooth::Uuid& uuid) {
    return body(bd_addr, uuid);
  };
};
extern struct BTA_SdpSearch BTA_SdpSearch;

}  // namespace bta_sdp_api
}  // namespace mock
}  // namespace test

// END mockcify generation
+5 −1
Original line number Original line Diff line number Diff line
@@ -18,6 +18,8 @@ use File::Basename;


## mockcify version
## mockcify version
##
##
## 0.6.1 Add tBTA_SDP_STATUS default value
##
## 0.6.0 Replace `extern` with `include` for mock_function_count_map
## 0.6.0 Replace `extern` with `include` for mock_function_count_map
##
##
## 0.5.0 Add compilation check
## 0.5.0 Add compilation check
@@ -36,7 +38,7 @@ use File::Basename;
##
##
## 0.2.0 First version
## 0.2.0 First version
##
##
my $VERSION = "0.6.0";
my $VERSION = "0.6.1";


use strict;
use strict;
use warnings;
use warnings;
@@ -561,6 +563,8 @@ sub get_default_return_value_from_type {
    return "nullptr";
    return "nullptr";
  } elsif(/btav_a2dp_codec_index_t/) {
  } elsif(/btav_a2dp_codec_index_t/) {
    return "BTAV_A2DP_CODEC_INDEX_SOURCE_MIN";
    return "BTAV_A2DP_CODEC_INDEX_SOURCE_MIN";
  } elsif(/tBTA_SDP_STATUS/) {
    return "BTA_SDP_SUCCESS";
  } else {
  } else {
    ## Decay to int type
    ## Decay to int type
    return "0";
    return "0";