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 // 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/logging.h> 36 37 #include "check.h" 38 #include "osi/include/allocator.h" 39 #include "osi/include/future.h" 40 #include "osi/include/log.h" 41 #include "osi/include/osi.h" 42 #include "test/common/mock_functions.h" 43 44 // Mocked compile conditionals, if any 45 46 namespace test { 47 namespace mock { 48 namespace osi_future { 49 50 // Shared state between mocked functions and tests 51 // Name: future_await 52 // Params: future_t* future 53 // Return: void* 54 struct future_await { 55 void* return_value{}; 56 std::function<void*(future_t* future)> body{ 57 [this](future_t* future) { return return_value; }}; operatorfuture_await58 void* operator()(future_t* future) { return body(future); }; 59 }; 60 extern struct future_await future_await; 61 62 // Name: future_new 63 // Params: void 64 // Return: future_t* 65 struct future_new { 66 future_t* return_value{0}; 67 std::function<future_t*(void)> body{[this](void) { return return_value; }}; operatorfuture_new68 future_t* operator()(void) { return body(); }; 69 }; 70 extern struct future_new future_new; 71 72 // Name: future_new_named 73 // Params: const char* name 74 // Return: future_t* 75 struct future_new_named { 76 future_t* return_value{0}; 77 std::function<future_t*(const char* name)> body{ 78 [this](const char* name) { return return_value; }}; operatorfuture_new_named79 future_t* operator()(const char* name) { return body(name); }; 80 }; 81 extern struct future_new_named future_new_named; 82 83 // Name: future_new_immediate 84 // Params: void* value 85 // Return: future_t* 86 struct future_new_immediate { 87 future_t* return_value{0}; 88 std::function<future_t*(void* value)> body{[this](void* value) { 89 CHECK(0); 90 return return_value; 91 }}; operatorfuture_new_immediate92 future_t* operator()(void* value) { return body(value); }; 93 }; 94 extern struct future_new_immediate future_new_immediate; 95 96 // Name: future_ready 97 // Params: future_t* future, void* value 98 // Return: void 99 struct future_ready { 100 std::function<void(future_t* future, void* value)> body{ 101 [](future_t* future, void* value) {}}; operatorfuture_ready102 void operator()(future_t* future, void* value) { body(future, value); }; 103 }; 104 extern struct future_ready future_ready; 105 106 } // namespace osi_future 107 } // namespace mock 108 } // namespace test 109 110 // END mockcify generation 111