2 * Copyright 2017 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 <folly/io/async/AsyncUDPSocket.h>
19 #include <folly/portability/GMock.h>
21 namespace folly { namespace test {
23 struct MockAsyncUDPSocket : public AsyncUDPSocket {
24 explicit MockAsyncUDPSocket(EventBase* evb) : AsyncUDPSocket(evb) {}
25 ~MockAsyncUDPSocket() override {}
27 MOCK_CONST_METHOD0(address, const SocketAddress&());
28 MOCK_METHOD1(bind, void(const SocketAddress&));
29 MOCK_METHOD2(setFD, void(int, AsyncUDPSocket::FDOwnership));
32 ssize_t(const SocketAddress&, const std::unique_ptr<IOBuf>&));
35 ssize_t(const SocketAddress&, const struct iovec*, size_t));
36 MOCK_METHOD1(resumeRead, void(ReadCallback*));
37 MOCK_METHOD0(pauseRead, void());
38 MOCK_METHOD0(close, void());
39 MOCK_CONST_METHOD0(getFD, int());
40 MOCK_METHOD1(setReusePort, void(bool));
41 MOCK_METHOD1(setReuseAddr, void(bool));