Cleanup mocks for Video (en|de)coder factories

In particular remove proxy mocks in favor of lambdas and Return(ByMove(...))

Bug: None
Change-Id: If6b79601437e82a7116479d128d538e965622fab
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174701
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31179}
This commit is contained in:
Danil Chapovalov
2020-05-07 11:52:45 +02:00
committed by Commit Bot
parent 1e83d34fc1
commit b63331bb8f
5 changed files with 78 additions and 92 deletions

View File

@ -22,20 +22,17 @@ namespace webrtc {
class MockVideoDecoderFactory : public webrtc::VideoDecoderFactory {
public:
MOCK_CONST_METHOD0(GetSupportedFormats,
std::vector<webrtc::SdpVideoFormat>());
~MockVideoDecoderFactory() override { Die(); }
// We need to proxy to a return type that is copyable.
std::unique_ptr<webrtc::VideoDecoder> CreateVideoDecoder(
const webrtc::SdpVideoFormat& format) {
return std::unique_ptr<webrtc::VideoDecoder>(
CreateVideoDecoderProxy(format));
}
MOCK_METHOD1(CreateVideoDecoderProxy,
webrtc::VideoDecoder*(const webrtc::SdpVideoFormat&));
MOCK_METHOD0(Die, void());
~MockVideoDecoderFactory() { Die(); }
MOCK_METHOD(std::vector<webrtc::SdpVideoFormat>,
GetSupportedFormats,
(),
(const override));
MOCK_METHOD(std::unique_ptr<webrtc::VideoDecoder>,
CreateVideoDecoder,
(const webrtc::SdpVideoFormat&),
(override));
MOCK_METHOD(void, Die, (), ());
};
} // namespace webrtc