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:4 20 * 21 * mockcify.pl ver 0.3.0 22 */ 23 24 #include <cstdint> 25 #include <functional> 26 #include <map> 27 #include <string> 28 29 extern std::map<std::string, int> mock_function_count_map; 30 31 // Original included files, if any 32 // NOTE: Since this is a mock file with mock definitions some number of 33 // include files may not be required. The include-what-you-use 34 // still applies, but crafting proper inclusion is out of scope 35 // for this effort. This compilation unit may compile as-is, or 36 // may need attention to prune from (or add to ) the inclusion set. 37 #include <base/logging.h> 38 39 #include "check.h" 40 #include "osi/include/allocator.h" 41 #include "osi/include/future.h" 42 #include "osi/include/log.h" 43 #include "osi/include/osi.h" 44 #include "osi/include/semaphore.h" 45 46 // Mocked compile conditionals, if any 47 48 namespace test { 49 namespace mock { 50 namespace osi_future { 51 52 // Shared state between mocked functions and tests 53 // Name: future_await 54 // Params: future_t* future 55 // Return: void* 56 struct future_await { 57 void* return_value{}; 58 std::function<void*(future_t* future)> body{ 59 [this](future_t* future) { return return_value; }}; operatorfuture_await60 void* operator()(future_t* future) { return body(future); }; 61 }; 62 extern struct future_await future_await; 63 64 // Name: future_new 65 // Params: void 66 // Return: future_t* 67 struct future_new { 68 future_t* return_value{0}; 69 std::function<future_t*(void)> body{[this](void) { return return_value; }}; operatorfuture_new70 future_t* operator()(void) { return body(); }; 71 }; 72 extern struct future_new future_new; 73 74 // Name: future_new_named 75 // Params: const char* name 76 // Return: future_t* 77 struct future_new_named { 78 future_t* return_value{0}; 79 std::function<future_t*(const char* name)> body{ 80 [this](const char* name) { return return_value; }}; operatorfuture_new_named81 future_t* operator()(const char* name) { return body(name); }; 82 }; 83 extern struct future_new_named future_new_named; 84 85 // Name: future_new_immediate 86 // Params: void* value 87 // Return: future_t* 88 struct future_new_immediate { 89 future_t* return_value{0}; 90 std::function<future_t*(void* value)> body{[this](void* value) { 91 CHECK(0); 92 return return_value; 93 }}; operatorfuture_new_immediate94 future_t* operator()(void* value) { return body(value); }; 95 }; 96 extern struct future_new_immediate future_new_immediate; 97 98 // Name: future_ready 99 // Params: future_t* future, void* value 100 // Return: void 101 struct future_ready { 102 std::function<void(future_t* future, void* value)> body{ 103 [](future_t* future, void* value) {}}; operatorfuture_ready104 void operator()(future_t* future, void* value) { body(future, value); }; 105 }; 106 extern struct future_ready future_ready; 107 108 } // namespace osi_future 109 } // namespace mock 110 } // namespace test 111 112 // END mockcify generation 113