1 /*
2 * Copyright 2022 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 "internal_include/stack_config.h"
18
19 #include <gmock/gmock.h>
20 #include <gtest/gtest.h>
21
22 #include <cstdarg>
23 #include <cstring>
24
25 const std::string kSmpOptions("mock smp options");
26 const std::string kBroadcastAudioConfigOptions(
27 "mock broadcast audio config options");
get_trace_config_enabled(void)28 bool get_trace_config_enabled(void) { return false; }
get_pts_avrcp_test(void)29 bool get_pts_avrcp_test(void) { return false; }
get_pts_secure_only_mode(void)30 bool get_pts_secure_only_mode(void) { return false; }
get_pts_conn_updates_disabled(void)31 bool get_pts_conn_updates_disabled(void) { return false; }
get_pts_crosskey_sdp_disable(void)32 bool get_pts_crosskey_sdp_disable(void) { return false; }
get_pts_smp_options(void)33 const std::string* get_pts_smp_options(void) { return &kSmpOptions; }
get_pts_smp_failure_case(void)34 int get_pts_smp_failure_case(void) { return 123; }
get_pts_force_eatt_for_notifications(void)35 bool get_pts_force_eatt_for_notifications(void) { return false; }
get_pts_connect_eatt_unconditionally(void)36 bool get_pts_connect_eatt_unconditionally(void) { return false; }
get_pts_connect_eatt_before_encryption(void)37 bool get_pts_connect_eatt_before_encryption(void) { return false; }
get_pts_unencrypt_broadcast(void)38 bool get_pts_unencrypt_broadcast(void) { return false; }
get_pts_eatt_peripheral_collision_support(void)39 bool get_pts_eatt_peripheral_collision_support(void) { return false; }
get_pts_use_eatt_for_all_services(void)40 bool get_pts_use_eatt_for_all_services(void) { return false; }
get_pts_force_le_audio_multiple_contexts_metadata(void)41 bool get_pts_force_le_audio_multiple_contexts_metadata(void) { return false; }
get_pts_l2cap_ecoc_upper_tester(void)42 bool get_pts_l2cap_ecoc_upper_tester(void) { return false; }
get_pts_l2cap_ecoc_min_key_size(void)43 int get_pts_l2cap_ecoc_min_key_size(void) { return -1; }
get_pts_l2cap_ecoc_initial_chan_cnt(void)44 int get_pts_l2cap_ecoc_initial_chan_cnt(void) { return -1; }
get_pts_l2cap_ecoc_connect_remaining(void)45 bool get_pts_l2cap_ecoc_connect_remaining(void) { return false; }
get_pts_l2cap_ecoc_send_num_of_sdu(void)46 int get_pts_l2cap_ecoc_send_num_of_sdu(void) { return -1; }
get_pts_l2cap_ecoc_reconfigure(void)47 bool get_pts_l2cap_ecoc_reconfigure(void) { return false; }
get_pts_broadcast_audio_config_options(void)48 const std::string* get_pts_broadcast_audio_config_options(void) {
49 return &kBroadcastAudioConfigOptions;
50 }
get_pts_le_audio_disable_ases_before_stopping(void)51 bool get_pts_le_audio_disable_ases_before_stopping(void) { return false; }
52 struct config_t;
get_all(void)53 config_t* get_all(void) { return nullptr; }
54 struct packet_fragmenter_t;
packet_fragmenter_get_interface()55 const packet_fragmenter_t* packet_fragmenter_get_interface() { return nullptr; }
56
57 stack_config_t mock_stack_config{
58 .get_trace_config_enabled = get_trace_config_enabled,
59 .get_pts_avrcp_test = get_pts_avrcp_test,
60 .get_pts_secure_only_mode = get_pts_secure_only_mode,
61 .get_pts_conn_updates_disabled = get_pts_conn_updates_disabled,
62 .get_pts_crosskey_sdp_disable = get_pts_crosskey_sdp_disable,
63 .get_pts_smp_options = get_pts_smp_options,
64 .get_pts_smp_failure_case = get_pts_smp_failure_case,
65 .get_pts_force_eatt_for_notifications =
66 get_pts_force_eatt_for_notifications,
67 .get_pts_connect_eatt_unconditionally =
68 get_pts_connect_eatt_unconditionally,
69 .get_pts_connect_eatt_before_encryption =
70 get_pts_connect_eatt_before_encryption,
71 .get_pts_unencrypt_broadcast = get_pts_unencrypt_broadcast,
72 .get_pts_eatt_peripheral_collision_support =
73 get_pts_eatt_peripheral_collision_support,
74 .get_pts_use_eatt_for_all_services = get_pts_use_eatt_for_all_services,
75 .get_pts_l2cap_ecoc_upper_tester = get_pts_l2cap_ecoc_upper_tester,
76 .get_pts_force_le_audio_multiple_contexts_metadata =
77 get_pts_force_le_audio_multiple_contexts_metadata,
78 .get_pts_l2cap_ecoc_min_key_size = get_pts_l2cap_ecoc_min_key_size,
79 .get_pts_l2cap_ecoc_initial_chan_cnt = get_pts_l2cap_ecoc_initial_chan_cnt,
80 .get_pts_l2cap_ecoc_connect_remaining =
81 get_pts_l2cap_ecoc_connect_remaining,
82 .get_pts_l2cap_ecoc_send_num_of_sdu = get_pts_l2cap_ecoc_send_num_of_sdu,
83 .get_pts_l2cap_ecoc_reconfigure = get_pts_l2cap_ecoc_reconfigure,
84 .get_pts_broadcast_audio_config_options =
85 get_pts_broadcast_audio_config_options,
86 .get_pts_le_audio_disable_ases_before_stopping =
87 get_pts_le_audio_disable_ases_before_stopping,
88 .get_all = get_all,
89 };
90
stack_config_get_interface(void)91 const stack_config_t* stack_config_get_interface(void) {
92 return &mock_stack_config;
93 }
94