2 * Copyright 2016 Facebook, Inc.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include <gmock/gmock.h>
20 #include <folly/io/async/AsyncUDPSocket.h>
22 namespace folly { namespace test {
24 struct MockAsyncUDPSocket : public AsyncUDPSocket {
25 explicit MockAsyncUDPSocket(EventBase* evb) : AsyncUDPSocket(evb) {}
26 virtual ~MockAsyncUDPSocket() {}
28 MOCK_CONST_METHOD0(address, const SocketAddress&());
29 MOCK_METHOD1(bind, void(const SocketAddress&));
30 MOCK_METHOD2(setFD, void(int, AsyncUDPSocket::FDOwnership));
33 ssize_t(const SocketAddress&, const std::unique_ptr<IOBuf>&));
36 ssize_t(const SocketAddress&, const struct iovec*, size_t));
37 MOCK_METHOD1(resumeRead, void(ReadCallback*));
38 MOCK_METHOD0(pauseRead, void());
39 MOCK_METHOD0(close, void());
40 MOCK_CONST_METHOD0(getFD, int());
41 MOCK_METHOD1(setReusePort, void(bool));
42 MOCK_METHOD1(setReuseAddr, void(bool));