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