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

Commit 2c9626ee authored by Chris Manton's avatar Chris Manton
Browse files

mockcify: ==> 0.6.3 More accurate inclusion

Also update stack_avrc_sdp

Bug: 299365655
Test: m .

Change-Id: Ibae5c10687d7c25a99e9c21caaa23b8f2d15af60
parent 7bc294ed
Loading
Loading
Loading
Loading
+58 −10
Original line number 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");
 * you may not use this file except in compliance with the License.
@@ -13,35 +13,83 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

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

#include "stack/include/avrc_api.h"
// Mock include file to share data between tests and mock
#include "test/mock/mock_stack_avrc_sdp.h"

#include <cstdint>

#include "test/common/mock_functions.h"
#include "types/raw_address.h"

// Original usings
using bluetooth::Uuid;
using namespace bluetooth::legacy::stack::sdp;

// Mocked internal structures, if any

namespace test {
namespace mock {
namespace stack_avrc_sdp {

// Function state capture and return values, if needed
struct AVRC_AddRecord AVRC_AddRecord;
struct AVRC_FindService AVRC_FindService;
struct AVRC_Init AVRC_Init;
struct AVRC_RemoveRecord AVRC_RemoveRecord;
struct AVRC_SetTraceLevel AVRC_SetTraceLevel;

}  // namespace stack_avrc_sdp
}  // namespace mock
}  // namespace test

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

uint16_t AVRC_AddRecord::return_value = 0;
uint16_t AVRC_FindService::return_value = 0;
uint16_t AVRC_RemoveRecord::return_value = 0;
uint8_t AVRC_SetTraceLevel::return_value = 0;

}  // namespace stack_avrc_sdp
}  // namespace mock
}  // namespace test

// Mocked functions, if any
uint16_t AVRC_AddRecord(uint16_t service_uuid, const char* p_service_name,
                        const char* p_provider_name, uint16_t categories,
                        uint32_t sdp_handle, bool browse_supported,
                        uint16_t profile_version, uint16_t cover_art_psm) {
  inc_func_call_count(__func__);
  return 0;
  return test::mock::stack_avrc_sdp::AVRC_AddRecord(
      service_uuid, p_service_name, p_provider_name, categories, sdp_handle,
      browse_supported, profile_version, cover_art_psm);
}
uint16_t AVRC_FindService(uint16_t service_uuid, const RawAddress& bd_addr,
                          tAVRC_SDP_DB_PARAMS* p_db,
                          const tAVRC_FIND_CBACK& find_cback) {
  inc_func_call_count(__func__);
  return 0;
  return test::mock::stack_avrc_sdp::AVRC_FindService(service_uuid, bd_addr,
                                                      p_db, find_cback);
}
void AVRC_Init(void) {
  inc_func_call_count(__func__);
  test::mock::stack_avrc_sdp::AVRC_Init();
}
uint16_t AVRC_RemoveRecord(uint32_t sdp_handle) {
  inc_func_call_count(__func__);
  return 0;
  return test::mock::stack_avrc_sdp::AVRC_RemoveRecord(sdp_handle);
}
uint8_t AVRC_SetTraceLevel(uint8_t new_level) {
  inc_func_call_count(__func__);
  return 0;
  return test::mock::stack_avrc_sdp::AVRC_SetTraceLevel(new_level);
}
void AVRC_Init(void) { inc_func_call_count(__func__); }
// Mocked functions complete
// END mockcify generation
+131 −0
Original line number 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.3
 */

#include <cstdint>
#include <functional>

// 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 "stack/include/avrc_api.h"
#include "types/bluetooth/uuid.h"
#include "types/raw_address.h"

// Original usings
using bluetooth::Uuid;
using namespace bluetooth::legacy::stack::sdp;

// Mocked compile conditionals, if any

namespace test {
namespace mock {
namespace stack_avrc_sdp {

// Shared state between mocked functions and tests
// Name: AVRC_AddRecord
// Params: uint16_t service_uuid, const char* p_service_name, const char*
// p_provider_name, uint16_t categories, uint32_t sdp_handle, bool
// browse_supported, uint16_t profile_version, uint16_t cover_art_psm Return:
// uint16_t
struct AVRC_AddRecord {
  static uint16_t return_value;
  std::function<uint16_t(uint16_t service_uuid, const char* p_service_name,
                         const char* p_provider_name, uint16_t categories,
                         uint32_t sdp_handle, bool browse_supported,
                         uint16_t profile_version, uint16_t cover_art_psm)>
      body{[](uint16_t service_uuid, const char* p_service_name,
              const char* p_provider_name, uint16_t categories,
              uint32_t sdp_handle, bool browse_supported,
              uint16_t profile_version,
              uint16_t cover_art_psm) { return return_value; }};
  uint16_t operator()(uint16_t service_uuid, const char* p_service_name,
                      const char* p_provider_name, uint16_t categories,
                      uint32_t sdp_handle, bool browse_supported,
                      uint16_t profile_version, uint16_t cover_art_psm) {
    return body(service_uuid, p_service_name, p_provider_name, categories,
                sdp_handle, browse_supported, profile_version, cover_art_psm);
  };
};
extern struct AVRC_AddRecord AVRC_AddRecord;

// Name: AVRC_FindService
// Params: uint16_t service_uuid, const RawAddress& bd_addr,
// tAVRC_SDP_DB_PARAMS* p_db, const tAVRC_FIND_CBACK& find_cback Return:
// uint16_t
struct AVRC_FindService {
  static uint16_t return_value;
  std::function<uint16_t(uint16_t service_uuid, const RawAddress& bd_addr,
                         tAVRC_SDP_DB_PARAMS* p_db,
                         const tAVRC_FIND_CBACK& find_cback)>
      body{[](uint16_t service_uuid, const RawAddress& bd_addr,
              tAVRC_SDP_DB_PARAMS* p_db,
              const tAVRC_FIND_CBACK& find_cback) { return return_value; }};
  uint16_t operator()(uint16_t service_uuid, const RawAddress& bd_addr,
                      tAVRC_SDP_DB_PARAMS* p_db,
                      const tAVRC_FIND_CBACK& find_cback) {
    return body(service_uuid, bd_addr, p_db, find_cback);
  };
};
extern struct AVRC_FindService AVRC_FindService;

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

// Name: AVRC_RemoveRecord
// Params: uint32_t sdp_handle
// Return: uint16_t
struct AVRC_RemoveRecord {
  static uint16_t return_value;
  std::function<uint16_t(uint32_t sdp_handle)> body{
      [](uint32_t sdp_handle) { return return_value; }};
  uint16_t operator()(uint32_t sdp_handle) { return body(sdp_handle); };
};
extern struct AVRC_RemoveRecord AVRC_RemoveRecord;

// Name: AVRC_SetTraceLevel
// Params: uint8_t new_level
// Return: uint8_t
struct AVRC_SetTraceLevel {
  static uint8_t return_value;
  std::function<uint8_t(uint8_t new_level)> body{
      [](uint8_t new_level) { return return_value; }};
  uint8_t operator()(uint8_t new_level) { return body(new_level); };
};
extern struct AVRC_SetTraceLevel AVRC_SetTraceLevel;

}  // namespace stack_avrc_sdp
}  // namespace mock
}  // namespace test

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

## mockcify version
##
## 0.6.3 Streamline inclusion for headers and source
##
## 0.6.2 Add tBTA_STATUS default value, Cpp type failure log
##
## 0.6.1 Add tBTA_SDP_STATUS default value
@@ -40,7 +42,7 @@ use File::Basename;
##
## 0.2.0 First version
##
my $VERSION = "0.6.2";
my $VERSION = "0.6.3";

use strict;
use warnings;
@@ -790,8 +792,6 @@ sub print_mock_decl_hdr {
print $FH <<EOF;
#include <cstdint>
#include <functional>
#include <map>
#include <string>

EOF
}
@@ -800,9 +800,6 @@ sub print_mock_decl_src {
  my $FH = shift @_;
print $FH <<EOF;
#include <cstdint>
#include <functional>
#include <map>
#include <string>

#include "test/common/mock_functions.h"