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