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