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}
This commit is contained in:
eladalon 2017-07-28 10:05:45 -07:00 committed by Commit Bot
parent 9f0ef390f1
commit e2173d9f0d
5 changed files with 45 additions and 12 deletions

View File

@ -34,7 +34,7 @@ rtc_source_set("call_interfaces") {
}
# 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 @@ if (rtc_include_tests) {
]
deps = [
":call",
":mock_rtp_interfaces",
":rtp_interfaces",
":rtp_receiver",
":rtp_sender",
@ -213,4 +214,18 @@ if (rtc_include_tests) {
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",
]
}
}

View File

@ -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::AtLeast;
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));

View File

@ -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 @@ namespace {
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;

View File

@ -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_

View File

@ -265,6 +265,7 @@ if (rtc_include_tests) {
"../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",