folly copyright 2015 -> copyright 2016
[folly.git] / folly / io / async / test / MockAsyncUDPSocket.h
1 /*
2  * Copyright 2016 Facebook, Inc.
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 #pragma once
17
18 #include <gmock/gmock.h>
19
20 #include <folly/io/async/AsyncUDPSocket.h>
21
22 namespace folly { namespace test {
23
24 struct MockAsyncUDPSocket : public AsyncUDPSocket {
25   explicit MockAsyncUDPSocket(EventBase* evb) : AsyncUDPSocket(evb) {}
26   virtual ~MockAsyncUDPSocket() {}
27
28   MOCK_CONST_METHOD0(address, const SocketAddress&());
29   MOCK_METHOD1(bind, void(const SocketAddress&));
30   MOCK_METHOD2(setFD, void(int, AsyncUDPSocket::FDOwnership));
31   MOCK_METHOD2(
32    write,
33    ssize_t(const SocketAddress&, const std::unique_ptr<IOBuf>&));
34   MOCK_METHOD3(
35    writev,
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));
43 };
44
45 }}