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:11 20 * 21 * mockcify.pl ver 0.3.0 22 */ 23 24 #include <functional> 25 26 // Original included files, if any 27 #include "osi/include/fixed_queue.h" 28 #include "osi/include/reactor.h" 29 #include "osi/include/thread.h" 30 31 // Mocked compile conditionals, if any 32 33 namespace test { 34 namespace mock { 35 namespace osi_thread { 36 37 // Shared state between mocked functions and tests 38 // Name: thread_free 39 // Params: thread_t* thread 40 // Return: void 41 struct thread_free { 42 std::function<void(thread_t* thread)> body{[](thread_t* /* thread */) {}}; operatorthread_free43 void operator()(thread_t* thread) { body(thread); } 44 }; 45 extern struct thread_free thread_free; 46 47 // Name: thread_get_reactor 48 // Params: const thread_t* thread 49 // Return: reactor_t* 50 struct thread_get_reactor { 51 reactor_t* return_value{0}; 52 std::function<reactor_t*(const thread_t* thread)> body{ 53 [this](const thread_t* /* thread */) { return return_value; }}; operatorthread_get_reactor54 reactor_t* operator()(const thread_t* thread) { return body(thread); } 55 }; 56 extern struct thread_get_reactor thread_get_reactor; 57 58 // Name: thread_is_self 59 // Params: const thread_t* thread 60 // Return: bool 61 struct thread_is_self { 62 bool return_value{false}; 63 std::function<bool(const thread_t* thread)> body{ 64 [this](const thread_t* /* thread */) { return return_value; }}; operatorthread_is_self65 bool operator()(const thread_t* thread) { return body(thread); } 66 }; 67 extern struct thread_is_self thread_is_self; 68 69 // Name: thread_join 70 // Params: thread_t* thread 71 // Return: void 72 struct thread_join { 73 std::function<void(thread_t* thread)> body{[](thread_t* /* thread */) {}}; operatorthread_join74 void operator()(thread_t* thread) { body(thread); } 75 }; 76 extern struct thread_join thread_join; 77 78 // Name: thread_name 79 // Params: const thread_t* thread 80 // Return: const char* 81 struct thread_name { 82 const char* return_value{0}; 83 std::function<const char*(const thread_t* thread)> body{ 84 [this](const thread_t* /* thread */) { return return_value; }}; operatorthread_name85 const char* operator()(const thread_t* thread) { return body(thread); } 86 }; 87 extern struct thread_name thread_name; 88 89 // Name: thread_new 90 // Params: const char* name 91 // Return: thread_t* 92 struct thread_new { 93 thread_t* return_value{0}; 94 std::function<thread_t*(const char* name)> body{ 95 [this](const char* /* name */) { return return_value; }}; operatorthread_new96 thread_t* operator()(const char* name) { return body(name); } 97 }; 98 extern struct thread_new thread_new; 99 100 // Name: thread_new_sized 101 // Params: const char* name, size_t work_queue_capacity 102 // Return: thread_t* 103 struct thread_new_sized { 104 thread_t* return_value{0}; 105 std::function<thread_t*(const char* name, size_t work_queue_capacity)> body{ 106 [this](const char* /* name */, size_t /* work_queue_capacity */) { 107 return return_value; 108 }}; operatorthread_new_sized109 thread_t* operator()(const char* name, size_t work_queue_capacity) { 110 return body(name, work_queue_capacity); 111 } 112 }; 113 extern struct thread_new_sized thread_new_sized; 114 115 // Name: thread_post 116 // Params: thread_t* thread, thread_fn func, void* context 117 // Return: bool 118 struct thread_post { 119 bool return_value{false}; 120 std::function<bool(thread_t* thread, thread_fn func, void* context)> body{ 121 [this](thread_t* /* thread */, thread_fn /* func */, void* /* context */) { 122 return return_value; 123 }}; operatorthread_post124 bool operator()(thread_t* thread, thread_fn func, void* context) { 125 return body(thread, func, context); 126 } 127 }; 128 extern struct thread_post thread_post; 129 130 // Name: thread_set_priority 131 // Params: thread_t* thread, int priority 132 // Return: bool 133 struct thread_set_priority { 134 bool return_value{false}; 135 std::function<bool(thread_t* thread, int priority)> body{ 136 [this](thread_t* /* thread */, int /* priority */) { return return_value; }}; operatorthread_set_priority137 bool operator()(thread_t* thread, int priority) { return body(thread, priority); } 138 }; 139 extern struct thread_set_priority thread_set_priority; 140 141 // Name: thread_set_rt_priority 142 // Params: thread_t* thread, int priority 143 // Return: bool 144 struct thread_set_rt_priority { 145 bool return_value{false}; 146 std::function<bool(thread_t* thread, int priority)> body{ 147 [this](thread_t* /* thread */, int /* priority */) { return return_value; }}; operatorthread_set_rt_priority148 bool operator()(thread_t* thread, int priority) { return body(thread, priority); } 149 }; 150 extern struct thread_set_rt_priority thread_set_rt_priority; 151 152 // Name: thread_stop 153 // Params: thread_t* thread 154 // Return: void 155 struct thread_stop { 156 std::function<void(thread_t* thread)> body{[](thread_t* /* thread */) {}}; operatorthread_stop157 void operator()(thread_t* thread) { body(thread); } 158 }; 159 extern struct thread_stop thread_stop; 160 161 } // namespace osi_thread 162 } // namespace mock 163 } // namespace test 164 165 // END mockcify generation 166