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 // Mock include file to share data between tests and mock
24 #include "test/mock/mock_osi_socket.h"
25
26 #include "test/common/mock_functions.h"
27
28 // Mocked internal structures, if any
29
30 // TODO(b/369381361) Enfore -Wmissing-prototypes
31 #pragma GCC diagnostic ignored "-Wmissing-prototypes"
32
33 namespace test {
34 namespace mock {
35 namespace osi_socket {
36
37 // Function state capture and return values, if needed
38 struct socket_accept socket_accept;
39 struct socket_bytes_available socket_bytes_available;
40 struct socket_free socket_free;
41 struct socket_listen socket_listen;
42 struct socket_new socket_new;
43 struct socket_new_from_fd socket_new_from_fd;
44 struct socket_read socket_read;
45 struct socket_register socket_register;
46 struct socket_unregister socket_unregister;
47 struct socket_write socket_write;
48 struct socket_write_and_transfer_fd socket_write_and_transfer_fd;
49
50 } // namespace osi_socket
51 } // namespace mock
52 } // namespace test
53
54 // Mocked functions, if any
socket_accept(const socket_t * socket)55 socket_t* socket_accept(const socket_t* socket) {
56 inc_func_call_count(__func__);
57 return test::mock::osi_socket::socket_accept(socket);
58 }
socket_bytes_available(const socket_t * socket)59 ssize_t socket_bytes_available(const socket_t* socket) {
60 inc_func_call_count(__func__);
61 return test::mock::osi_socket::socket_bytes_available(socket);
62 }
socket_free(socket_t * socket)63 void socket_free(socket_t* socket) {
64 inc_func_call_count(__func__);
65 test::mock::osi_socket::socket_free(socket);
66 }
socket_listen(const socket_t * socket,port_t port)67 bool socket_listen(const socket_t* socket, port_t port) {
68 inc_func_call_count(__func__);
69 return test::mock::osi_socket::socket_listen(socket, port);
70 }
socket_new(void)71 socket_t* socket_new(void) {
72 inc_func_call_count(__func__);
73 return test::mock::osi_socket::socket_new();
74 }
socket_new_from_fd(int fd)75 socket_t* socket_new_from_fd(int fd) {
76 inc_func_call_count(__func__);
77 return test::mock::osi_socket::socket_new_from_fd(fd);
78 }
socket_read(const socket_t * socket,void * buf,size_t count)79 ssize_t socket_read(const socket_t* socket, void* buf, size_t count) {
80 inc_func_call_count(__func__);
81 return test::mock::osi_socket::socket_read(socket, buf, count);
82 }
socket_register(socket_t * socket,reactor_t * reactor,void * context,socket_cb read_cb,socket_cb write_cb)83 void socket_register(socket_t* socket, reactor_t* reactor, void* context, socket_cb read_cb,
84 socket_cb write_cb) {
85 inc_func_call_count(__func__);
86 test::mock::osi_socket::socket_register(socket, reactor, context, read_cb, write_cb);
87 }
socket_unregister(socket_t * socket)88 void socket_unregister(socket_t* socket) {
89 inc_func_call_count(__func__);
90 test::mock::osi_socket::socket_unregister(socket);
91 }
socket_write(const socket_t * socket,const void * buf,size_t count)92 ssize_t socket_write(const socket_t* socket, const void* buf, size_t count) {
93 inc_func_call_count(__func__);
94 return test::mock::osi_socket::socket_write(socket, buf, count);
95 }
socket_write_and_transfer_fd(const socket_t * socket,const void * buf,size_t count,int fd)96 ssize_t socket_write_and_transfer_fd(const socket_t* socket, const void* buf, size_t count,
97 int fd) {
98 inc_func_call_count(__func__);
99 return test::mock::osi_socket::socket_write_and_transfer_fd(socket, buf, count, fd);
100 }
101 // Mocked functions complete
102 // END mockcify generation
osi_socket_local_server_bind(int,const char *,int)103 int osi_socket_local_server_bind(int /* s */, const char* /* name */, int /* namespaceId */) {
104 inc_func_call_count(__func__);
105 return 0;
106 }
107