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 /* 18 * Generated mock file from original source file 19 * Functions generated:10 20 * 21 * mockcify.pl ver 0.3.0 22 */ 23 24 #include <cstdint> 25 #include <functional> 26 #include <map> 27 #include <string> 28 29 // Original included files, if any 30 // NOTE: Since this is a mock file with mock definitions some number of 31 // include files may not be required. The include-what-you-use 32 // still applies, but crafting proper inclusion is out of scope 33 // for this effort. This compilation unit may compile as-is, or 34 // may need attention to prune from (or add to ) the inclusion set. 35 #include <base/cancelable_callback.h> 36 #include <base/logging.h> 37 #include <errno.h> 38 #include <fcntl.h> 39 #include <hardware/bluetooth.h> 40 #include <inttypes.h> 41 #include <malloc.h> 42 #include <pthread.h> 43 #include <signal.h> 44 #include <string.h> 45 #include <time.h> 46 47 #include <mutex> 48 49 #include "check.h" 50 #include "internal_include/bt_target.h" 51 #include "osi/include/alarm.h" 52 #include "osi/include/allocator.h" 53 #include "osi/include/fixed_queue.h" 54 #include "osi/include/list.h" 55 #include "osi/include/log.h" 56 #include "osi/include/osi.h" 57 #include "osi/include/thread.h" 58 #include "osi/include/wakelock.h" 59 #include "test/common/mock_functions.h" 60 61 // Mocked compile conditionals, if any 62 63 namespace test { 64 namespace mock { 65 namespace osi_alarm { 66 67 // Shared state between mocked functions and tests 68 // Name: alarm_cancel 69 // Params: alarm_t* alarm 70 // Return: void 71 struct alarm_cancel { 72 std::function<void(alarm_t* alarm)> body{[](alarm_t* alarm) {}}; operatoralarm_cancel73 void operator()(alarm_t* alarm) { body(alarm); }; 74 }; 75 extern struct alarm_cancel alarm_cancel; 76 77 // Name: alarm_cleanup 78 // Params: void 79 // Return: void 80 struct alarm_cleanup { 81 std::function<void(void)> body{[](void) {}}; operatoralarm_cleanup82 void operator()(void) { body(); }; 83 }; 84 extern struct alarm_cleanup alarm_cleanup; 85 86 // Name: alarm_debug_dump 87 // Params: int fd 88 // Return: void 89 struct alarm_debug_dump { 90 std::function<void(int fd)> body{[](int fd) {}}; operatoralarm_debug_dump91 void operator()(int fd) { body(fd); }; 92 }; 93 extern struct alarm_debug_dump alarm_debug_dump; 94 95 // Name: alarm_free 96 // Params: alarm_t* alarm 97 // Return: void 98 struct alarm_free { 99 std::function<void(alarm_t* alarm)> body{[](alarm_t* alarm) {}}; operatoralarm_free100 void operator()(alarm_t* alarm) { body(alarm); }; 101 }; 102 extern struct alarm_free alarm_free; 103 104 // Name: alarm_get_remaining_ms 105 // Params: const alarm_t* alarm 106 // Return: uint64_t 107 struct alarm_get_remaining_ms { 108 uint64_t return_value{0}; 109 std::function<uint64_t(const alarm_t* alarm)> body{ 110 [this](const alarm_t* alarm) { return return_value; }}; operatoralarm_get_remaining_ms111 uint64_t operator()(const alarm_t* alarm) { return body(alarm); }; 112 }; 113 extern struct alarm_get_remaining_ms alarm_get_remaining_ms; 114 115 // Name: alarm_is_scheduled 116 // Params: const alarm_t* alarm 117 // Return: bool 118 struct alarm_is_scheduled { 119 bool return_value{false}; 120 std::function<bool(const alarm_t* alarm)> body{ 121 [this](const alarm_t* alarm) { return return_value; }}; operatoralarm_is_scheduled122 bool operator()(const alarm_t* alarm) { return body(alarm); }; 123 }; 124 extern struct alarm_is_scheduled alarm_is_scheduled; 125 126 // Name: alarm_new 127 // Params: const char* name 128 // Return: alarm_t* 129 struct alarm_new { 130 alarm_t* return_value{0}; 131 std::function<alarm_t*(const char* name)> body{ 132 [this](const char* name) { return return_value; }}; operatoralarm_new133 alarm_t* operator()(const char* name) { return body(name); }; 134 }; 135 extern struct alarm_new alarm_new; 136 137 // Name: alarm_new_periodic 138 // Params: const char* name 139 // Return: alarm_t* 140 struct alarm_new_periodic { 141 alarm_t* return_value{0}; 142 std::function<alarm_t*(const char* name)> body{ 143 [this](const char* name) { return return_value; }}; operatoralarm_new_periodic144 alarm_t* operator()(const char* name) { return body(name); }; 145 }; 146 extern struct alarm_new_periodic alarm_new_periodic; 147 148 // Name: alarm_set 149 // Params: alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, void* data 150 // Return: void 151 struct alarm_set { 152 std::function<void(alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, 153 void* data)> 154 body{[](alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, 155 void* data) {}}; operatoralarm_set156 void operator()(alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, 157 void* data) { 158 body(alarm, interval_ms, cb, data); 159 }; 160 }; 161 extern struct alarm_set alarm_set; 162 163 // Name: alarm_set_on_mloop 164 // Params: alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, void* data 165 // Return: void 166 struct alarm_set_on_mloop { 167 std::function<void(alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, 168 void* data)> 169 body{[](alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, 170 void* data) {}}; operatoralarm_set_on_mloop171 void operator()(alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, 172 void* data) { 173 body(alarm, interval_ms, cb, data); 174 }; 175 }; 176 extern struct alarm_set_on_mloop alarm_set_on_mloop; 177 178 } // namespace osi_alarm 179 } // namespace mock 180 } // namespace test 181 182 // END mockcify generation