Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: - Mark all methods in AsyncUDPSocket as virtual - Create new gmock AsyncUDPSocket: MockAsyncUDPSocket Reviewed By: @yfeldblum Differential Revision: D2370668
- Loading branch information
Peter Griess
authored and
facebook-github-bot-4
committed
Aug 24, 2015
1 parent
2d6a824
commit 0c63ead
Showing
3 changed files
with
59 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright 2015 Facebook, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#pragma once | ||
|
||
#include <gmock/gmock.h> | ||
|
||
#include <folly/io/async/AsyncUDPSocket.h> | ||
|
||
namespace folly { namespace test { | ||
|
||
struct MockAsyncUDPSocket : public AsyncUDPSocket { | ||
explicit MockAsyncUDPSocket(EventBase* evb) : AsyncUDPSocket(evb) {} | ||
virtual ~MockAsyncUDPSocket() {} | ||
|
||
MOCK_CONST_METHOD0(address, const SocketAddress&()); | ||
MOCK_METHOD1(bind, void(const SocketAddress&)); | ||
MOCK_METHOD2(setFD, void(int, AsyncUDPSocket::FDOwnership)); | ||
MOCK_METHOD2( | ||
write, | ||
ssize_t(const SocketAddress&, const std::unique_ptr<IOBuf>&)); | ||
MOCK_METHOD3( | ||
writev, | ||
ssize_t(const SocketAddress&, const struct iovec*, size_t)); | ||
MOCK_METHOD1(resumeRead, void(ReadCallback*)); | ||
MOCK_METHOD0(pauseRead, void()); | ||
MOCK_METHOD0(close, void()); | ||
MOCK_CONST_METHOD0(getFD, int()); | ||
MOCK_METHOD1(setReusePort, void(bool)); | ||
MOCK_METHOD1(setReuseAddr, void(bool)); | ||
}; | ||
|
||
}} |