Only one implementation of MockRtpPacketSink once MockRtpPacketSink has three identical implementations now, so time to move it to its own file. BUG=None Review-Url: https://codereview.webrtc.org/2988853002 Cr-Commit-Position: refs/heads/master@{#19183}
diff --git a/webrtc/call/BUILD.gn b/webrtc/call/BUILD.gn index c40b557..62b8ac4 100644 --- a/webrtc/call/BUILD.gn +++ b/webrtc/call/BUILD.gn
@@ -34,7 +34,7 @@ } # TODO(nisse): These RTP targets should be moved elsewhere -# when interfaces have stabilized. +# when interfaces have stabilized. See also TODO for |mock_rtp_interfaces|. rtc_source_set("rtp_interfaces") { sources = [ "rtcp_packet_sink_interface.h", @@ -144,6 +144,7 @@ ] deps = [ ":call", + ":mock_rtp_interfaces", ":rtp_interfaces", ":rtp_receiver", ":rtp_sender", @@ -213,4 +214,18 @@ suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] } } + + # TODO(eladalon): This should be moved, as with the TODO for |rtp_interfaces|. + rtc_source_set("mock_rtp_interfaces") { + testonly = true + + sources = [ + "test/mock_rtp_packet_sink_interface.h", + ] + deps = [ + ":rtp_interfaces", + "../test:test_support", + "//testing/gmock", + ] + } }
diff --git a/webrtc/call/rtp_demuxer_unittest.cc b/webrtc/call/rtp_demuxer_unittest.cc index 8c2eab1..a2b4578 100644 --- a/webrtc/call/rtp_demuxer_unittest.cc +++ b/webrtc/call/rtp_demuxer_unittest.cc
@@ -14,7 +14,7 @@ #include <string> #include "webrtc/call/rsid_resolution_observer.h" -#include "webrtc/call/rtp_packet_sink_interface.h" +#include "webrtc/call/test/mock_rtp_packet_sink_interface.h" #include "webrtc/common_types.h" #include "webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h" #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" @@ -35,11 +35,6 @@ using ::testing::InSequence; using ::testing::NiceMock; -class MockRtpPacketSink : public RtpPacketSinkInterface { - public: - MOCK_METHOD1(OnRtpPacket, void(const RtpPacketReceived&)); -}; - class MockRsidResolutionObserver : public RsidResolutionObserver { public: MOCK_METHOD2(OnRsidResolved, void(const std::string& rsid, uint32_t ssrc));
diff --git a/webrtc/call/rtx_receive_stream_unittest.cc b/webrtc/call/rtx_receive_stream_unittest.cc index 91ed2ca..e9c8210 100644 --- a/webrtc/call/rtx_receive_stream_unittest.cc +++ b/webrtc/call/rtx_receive_stream_unittest.cc
@@ -9,6 +9,7 @@ */ #include "webrtc/call/rtx_receive_stream.h" +#include "webrtc/call/test/mock_rtp_packet_sink_interface.h" #include "webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h" #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" @@ -22,11 +23,6 @@ using ::testing::_; using ::testing::StrictMock; -class MockRtpPacketSink : public RtpPacketSinkInterface { - public: - MOCK_METHOD1(OnRtpPacket, void(const RtpPacketReceived&)); -}; - constexpr int kMediaPayloadType = 100; constexpr int kRtxPayloadType = 98; constexpr uint32_t kMediaSSRC = 0x3333333;
diff --git a/webrtc/call/test/mock_rtp_packet_sink_interface.h b/webrtc/call/test/mock_rtp_packet_sink_interface.h new file mode 100644 index 0000000..a139004 --- /dev/null +++ b/webrtc/call/test/mock_rtp_packet_sink_interface.h
@@ -0,0 +1,26 @@ +/* + * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ +#ifndef WEBRTC_CALL_TEST_MOCK_RTP_PACKET_SINK_INTERFACE_H_ +#define WEBRTC_CALL_TEST_MOCK_RTP_PACKET_SINK_INTERFACE_H_ + +#include "webrtc/call/rtp_packet_sink_interface.h" + +#include "webrtc/test/gmock.h" + +namespace webrtc { + +class MockRtpPacketSink : public RtpPacketSinkInterface { + public: + MOCK_METHOD1(OnRtpPacket, void(const RtpPacketReceived&)); +}; + +} // namespace webrtc + +#endif // WEBRTC_CALL_TEST_MOCK_RTP_PACKET_SINK_INTERFACE_H_
diff --git a/webrtc/video/BUILD.gn b/webrtc/video/BUILD.gn index 77ba8e9..f9c3453 100644 --- a/webrtc/video/BUILD.gn +++ b/webrtc/video/BUILD.gn
@@ -265,6 +265,7 @@ "../api:video_frame_api", "../api/video_codecs:video_codecs_api", "../call:call_interfaces", + "../call:mock_rtp_interfaces", "../call:rtp_receiver", "../common_video", "../logging:rtc_event_log_api",