1 /****************************************************************************** 2 * 3 * Copyright (C) 2022 Google, Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19 #pragma once 20 21 #include <sys/select.h> 22 #include <sys/socket.h> 23 24 #include "gmock/gmock.h" 25 #include "hal/syscall_wrapper_interface.h" 26 27 namespace bluetooth { 28 namespace hal { 29 30 class SyscallWrapperMock : public SyscallWrapperInterface { 31 public: 32 MOCK_METHOD(int, Socket, (int, int, int)); 33 34 MOCK_METHOD(int, Bind, (int, const struct sockaddr*, socklen_t)); 35 36 MOCK_METHOD(int, Connect, (int, const struct sockaddr*, socklen_t)); 37 38 MOCK_METHOD(ssize_t, Send, (int, const void*, size_t, int)); 39 40 MOCK_METHOD(ssize_t, Recv, (int, void*, size_t, int)); 41 42 MOCK_METHOD(int, Setsockopt, (int, int, int, const void*, socklen_t)); 43 44 MOCK_METHOD(int, Listen, (int, int)); 45 46 MOCK_METHOD(int, Accept, (int, struct sockaddr*, socklen_t*, int)); 47 48 MOCK_METHOD(ssize_t, Write, (int, const void*, size_t)); 49 50 MOCK_METHOD(int, Close, (int)); 51 52 MOCK_METHOD(int, Pipe2, (int*, int)); 53 54 MOCK_METHOD(int, GetErrno, (), (const)); 55 56 MOCK_METHOD(void, FDSet, (int, fd_set*)); 57 58 MOCK_METHOD(void, FDClr, (int, fd_set*)); 59 60 MOCK_METHOD(bool, FDIsSet, (int, fd_set*)); 61 62 MOCK_METHOD(void, FDZero, (fd_set*)); 63 64 MOCK_METHOD(int, Select, (int, fd_set*, fd_set*, fd_set*, struct timeval*)); 65 }; 66 67 } // namespace hal 68 } // namespace bluetooth 69