Reland "Enable and fix chromium clang warnings in rtp_rtcp test targets"

This reverts commit 01aa210fad68f1006528d32d388b307c22990734.

Reason for revert: downstream project adjusted

Original change's description:
> Revert "Enable and fix chromium clang warnings in rtp_rtcp test targets"
> 
> This reverts commit 9486b117daac09c9f7ac8450ccda835938cf3150.
> 
> Reason for revert: Breaks downstream project
> 
> Original change's description:
> > Enable and fix chromium clang warnings in rtp_rtcp test targets
> > 
> > Bug: webrtc:163
> > Change-Id: I4ed3e63296d8bf06536a83196d597c7a906ba11c
> > Reviewed-on: https://webrtc-review.googlesource.com/60802
> > Reviewed-by: Björn Terelius <terelius@webrtc.org>
> > Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
> > Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22357}
> 
> TBR=danilchap@webrtc.org,phoglund@webrtc.org,terelius@webrtc.org
> 
> Change-Id: I2c3777ea9f26813bdb395e7fd68f6b49443586ea
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:163
> Reviewed-on: https://webrtc-review.googlesource.com/61060
> Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
> Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22365}

TBR=danilchap@webrtc.org,phoglund@webrtc.org,oprypin@webrtc.org,terelius@webrtc.org

Change-Id: I0b4cb6d05b37caeb52cca9abf95417ad3ad6f76b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:163
Reviewed-on: https://webrtc-review.googlesource.com/61080
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22368}
This commit is contained in:
Danil Chapovalov 2018-03-09 15:37:03 +00:00 committed by Commit Bot
parent 5081c0cc6d
commit dd7e284ce8
32 changed files with 184 additions and 52 deletions

View File

@ -421,6 +421,7 @@ if (rtc_include_tests) {
rtc_source_set("mocks") {
testonly = true
sources = [
"rtc_event_log/mock/mock_rtc_event_log.cc",
"rtc_event_log/mock/mock_rtc_event_log.h",
]
deps = [

View File

@ -0,0 +1,19 @@
/*
* Copyright (c) 2018 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.
*/
#include "logging/rtc_event_log/mock/mock_rtc_event_log.h"
namespace webrtc {
MockRtcEventLog::MockRtcEventLog() = default;
MockRtcEventLog::~MockRtcEventLog() = default;
} // namespace webrtc

View File

@ -20,6 +20,9 @@ namespace webrtc {
class MockRtcEventLog : public RtcEventLog {
public:
MockRtcEventLog();
~MockRtcEventLog();
virtual bool StartLogging(std::unique_ptr<RtcEventLogOutput> output,
int64_t output_period_ms) {
return StartLoggingProxy(output.get(), output_period_ms);

View File

@ -264,15 +264,17 @@ rtc_source_set("fec_test_helper") {
# TODO(jschuh): bugs.webrtc.org/1348: fix this warning.
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
rtc_source_set("mock_rtp_rtcp") {
testonly = true
sources = [
"mocks/mock_recovered_packet_receiver.cc",
"mocks/mock_rtcp_bandwidth_observer.cc",
"mocks/mock_rtcp_rtt_stats.cc",
"mocks/mock_rtp_rtcp.cc",
]
public = [
"mocks/mock_recovered_packet_receiver.h",
"mocks/mock_rtcp_bandwidth_observer.h",
"mocks/mock_rtcp_rtt_stats.h",
@ -317,10 +319,6 @@ if (rtc_include_tests) {
"../../rtc_base:rtc_base_approved",
"../../test:test_support",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
rtc_source_set("rtp_rtcp_unittests") {
@ -422,9 +420,5 @@ if (rtc_include_tests) {
# TODO(jschuh): bugs.webrtc.org/1348: fix this warning.
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
}

View File

@ -0,0 +1,18 @@
/*
* Copyright (c) 2018 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.
*/
#include "modules/rtp_rtcp/mocks/mock_recovered_packet_receiver.h"
namespace webrtc {
MockRecoveredPacketReceiver::MockRecoveredPacketReceiver() = default;
MockRecoveredPacketReceiver::~MockRecoveredPacketReceiver() = default;
} // namespace webrtc

View File

@ -19,6 +19,8 @@ namespace webrtc {
class MockRecoveredPacketReceiver : public RecoveredPacketReceiver {
public:
MockRecoveredPacketReceiver();
~MockRecoveredPacketReceiver();
MOCK_METHOD2(OnRecoveredPacket, void(const uint8_t* packet, size_t length));
};

View File

@ -0,0 +1,18 @@
/*
* Copyright (c) 2018 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.
*/
#include "modules/rtp_rtcp/mocks/mock_rtcp_bandwidth_observer.h"
namespace webrtc {
MockRtcpBandwidthObserver::MockRtcpBandwidthObserver() = default;
MockRtcpBandwidthObserver::~MockRtcpBandwidthObserver() = default;
} // namespace webrtc

View File

@ -18,6 +18,9 @@ namespace webrtc {
class MockRtcpBandwidthObserver : public RtcpBandwidthObserver {
public:
MockRtcpBandwidthObserver();
~MockRtcpBandwidthObserver();
MOCK_METHOD1(OnReceivedEstimatedBitrate, void(uint32_t));
MOCK_METHOD3(OnReceivedRtcpReceiverReport,
void(const ReportBlockList&, int64_t, int64_t));

View File

@ -0,0 +1,18 @@
/*
* Copyright (c) 2018 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.
*/
#include "modules/rtp_rtcp/mocks/mock_rtcp_rtt_stats.h"
namespace webrtc {
MockRtcpRttStats::MockRtcpRttStats() = default;
MockRtcpRttStats::~MockRtcpRttStats() = default;
} // namespace webrtc

View File

@ -18,6 +18,9 @@ namespace webrtc {
class MockRtcpRttStats : public RtcpRttStats {
public:
MockRtcpRttStats();
~MockRtcpRttStats();
MOCK_METHOD1(OnRttUpdate, void(int64_t rtt));
MOCK_CONST_METHOD0(LastProcessedRtt, int64_t());
};

View File

@ -0,0 +1,21 @@
/*
* Copyright (c) 2018 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.
*/
#include "modules/rtp_rtcp/mocks/mock_rtp_rtcp.h"
namespace webrtc {
MockRtpData::MockRtpData() = default;
MockRtpData::~MockRtpData() = default;
MockRtpRtcp::MockRtpRtcp() = default;
MockRtpRtcp::~MockRtpRtcp() = default;
} // namespace webrtc

View File

@ -27,6 +27,9 @@ namespace webrtc {
class MockRtpData : public RtpData {
public:
MockRtpData();
~MockRtpData();
MOCK_METHOD3(OnReceivedPayloadData,
int32_t(const uint8_t* payload_data,
size_t payload_size,
@ -35,6 +38,9 @@ class MockRtpData : public RtpData {
class MockRtpRtcp : public RtpRtcp {
public:
MockRtpRtcp();
~MockRtpRtcp();
MOCK_METHOD1(RegisterDefaultModule, int32_t(RtpRtcp* module));
MOCK_METHOD0(DeRegisterDefaultModule, int32_t());
MOCK_METHOD0(DefaultModuleRegistered, bool());

View File

@ -18,8 +18,8 @@ namespace {
class ByteIoTest : public ::testing::Test {
protected:
ByteIoTest() {}
virtual ~ByteIoTest() {}
ByteIoTest() = default;
~ByteIoTest() override = default;
enum { kAlignments = sizeof(uint64_t) - 1 };

View File

@ -30,6 +30,17 @@ constexpr uint8_t kVp8PayloadType = 120;
constexpr int kPacketTimestampIncrement = 3000;
} // namespace
MediaPacketGenerator::MediaPacketGenerator(uint32_t min_packet_size,
uint32_t max_packet_size,
uint32_t ssrc,
Random* random)
: min_packet_size_(min_packet_size),
max_packet_size_(max_packet_size),
ssrc_(ssrc),
random_(random) {}
MediaPacketGenerator::~MediaPacketGenerator() = default;
ForwardErrorCorrection::PacketList MediaPacketGenerator::ConstructMediaPackets(
int num_media_packets,
uint16_t start_seq_num) {

View File

@ -36,11 +36,8 @@ class MediaPacketGenerator {
MediaPacketGenerator(uint32_t min_packet_size,
uint32_t max_packet_size,
uint32_t ssrc,
Random* random)
: min_packet_size_(min_packet_size),
max_packet_size_(max_packet_size),
ssrc_(ssrc),
random_(random) {}
Random* random);
~MediaPacketGenerator();
// Construct the media packets, up to |num_media_packets| packets.
ForwardErrorCorrection::PacketList ConstructMediaPackets(

View File

@ -211,7 +211,7 @@ TEST_F(FlexfecReceiverTest, ReceivesMultiplePackets) {
}
// Receive FEC packet.
auto fec_packet = fec_packets.front();
auto* fec_packet = fec_packets.front();
std::unique_ptr<Packet> packet_with_rtp_header =
packet_generator_.BuildFlexfecPacket(*fec_packet);
std::unique_ptr<ForwardErrorCorrection::ReceivedPacket> received_packet =
@ -354,7 +354,7 @@ TEST_F(FlexfecReceiverTest, RecoversFrom50PercentLoss) {
// Receive all FEC packets.
media_it = media_packets.begin();
for (const auto& fec_packet : fec_packets) {
for (const auto* fec_packet : fec_packets) {
std::unique_ptr<Packet> fec_packet_with_rtp_header =
packet_generator_.BuildFlexfecPacket(*fec_packet);
++media_it;
@ -453,7 +453,7 @@ TEST_F(FlexfecReceiverTest, SurvivesOldRecoveredPacketBeingReinserted) {
void SetReceiver(FlexfecReceiver* receiver) { receiver_ = receiver; }
// Implements RecoveredPacketReceiver.
void OnRecoveredPacket(const uint8_t* packet, size_t length) {
void OnRecoveredPacket(const uint8_t* packet, size_t length) override {
RtpPacketReceived parsed_packet;
EXPECT_TRUE(parsed_packet.Parse(packet, length));
parsed_packet.set_recovered(true);
@ -567,7 +567,7 @@ TEST_F(FlexfecReceiverTest, RecoveryCallbackDoesNotLoopInfinitely) {
bool DeepRecursion() const { return deep_recursion_; }
// Implements RecoveredPacketReceiver.
void OnRecoveredPacket(const uint8_t* packet, size_t length) {
void OnRecoveredPacket(const uint8_t* packet, size_t length) override {
RtpPacketReceived parsed_packet;
EXPECT_TRUE(parsed_packet.Parse(packet, length));

View File

@ -126,7 +126,7 @@ class RtpRtcpRtxNackTest : public ::testing::Test {
payload_data_length(sizeof(payload_data)),
fake_clock(123456),
retransmission_rate_limiter_(&fake_clock, kMaxRttMs) {}
~RtpRtcpRtxNackTest() {}
~RtpRtcpRtxNackTest() override {}
void SetUp() override {
RtpRtcp::Configuration configuration;

View File

@ -195,7 +195,7 @@ TEST_F(ReceiveStatisticsTest, RtcpCallbacks) {
public:
TestCallback()
: RtcpStatisticsCallback(), num_calls_(0), ssrc_(0), stats_() {}
virtual ~TestCallback() {}
~TestCallback() override {}
void StatisticsUpdated(const RtcpStatistics& statistics,
uint32_t ssrc) override {
@ -283,10 +283,10 @@ class RtpTestCallback : public StreamDataCountersCallback {
public:
RtpTestCallback()
: StreamDataCountersCallback(), num_calls_(0), ssrc_(0), stats_() {}
virtual ~RtpTestCallback() {}
~RtpTestCallback() override = default;
virtual void DataCountersUpdated(const StreamDataCounters& counters,
uint32_t ssrc) {
void DataCountersUpdated(const StreamDataCounters& counters,
uint32_t ssrc) override {
ssrc_ = ssrc;
stats_ = counters;
++num_calls_;

View File

@ -32,7 +32,7 @@ class RemoteNtpTimeEstimatorTest : public ::testing::Test {
: local_clock_(kLocalClockInitialTimeMs * 1000),
remote_clock_(kRemoteClockInitialTimeMs * 1000),
estimator_(new RemoteNtpTimeEstimator(&local_clock_)) {}
~RemoteNtpTimeEstimatorTest() {}
~RemoteNtpTimeEstimatorTest() override = default;
void AdvanceTimeMilliseconds(int64_t ms) {
local_clock_.AdvanceTimeMilliseconds(ms);

View File

@ -185,7 +185,7 @@ TEST(NACKStringBuilderTest, TestCase13) {
class RtcpPacketTypeCounterObserverImpl : public RtcpPacketTypeCounterObserver {
public:
RtcpPacketTypeCounterObserverImpl() : ssrc_(0) {}
virtual ~RtcpPacketTypeCounterObserverImpl() {}
~RtcpPacketTypeCounterObserverImpl() override = default;
void RtcpPacketTypesCounterUpdated(
uint32_t ssrc,
const RtcpPacketTypeCounter& packet_counter) override {

View File

@ -82,7 +82,7 @@ void VerifyExtensions(RTPTypeHeader* type,
class RtpPacketizerVp8Test : public ::testing::Test {
protected:
RtpPacketizerVp8Test() : helper_(NULL) {}
virtual void TearDown() { delete helper_; }
void TearDown() override { delete helper_; }
bool Init(const size_t* partition_sizes, size_t num_partitions) {
hdr_info_.pictureId = kNoPictureId;
hdr_info_.nonReference = false;

View File

@ -127,9 +127,7 @@ class RtpPacketizerVp9Test : public ::testing::Test {
static constexpr size_t kMaxPacketSize = 1200;
RtpPacketizerVp9Test() : packet_(kNoExtensions, kMaxPacketSize) {}
virtual void SetUp() {
expected_.InitRTPVideoHeaderVP9();
}
void SetUp() override { expected_.InitRTPVideoHeaderVP9(); }
RtpPacketToSend packet_;
std::unique_ptr<uint8_t[]> payload_;
@ -584,9 +582,7 @@ class RtpDepacketizerVp9Test : public ::testing::Test {
RtpDepacketizerVp9Test()
: depacketizer_(new RtpDepacketizerVp9()) {}
virtual void SetUp() {
expected_.InitRTPVideoHeaderVP9();
}
void SetUp() override { expected_.InitRTPVideoHeaderVP9(); }
RTPVideoHeaderVP9 expected_;
std::unique_ptr<RtpDepacketizer> depacketizer_;

View File

@ -236,7 +236,7 @@ TEST_F(RtpReceiverTest, GetSourcesRemoveOutdatedSource) {
header.arrOfCSRCs[0] = kCsrc1;
EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(
header, kTestPayload, sizeof(kTestPayload), payload_specific));
auto rtp_receiver_impl = static_cast<RtpReceiverImpl*>(rtp_receiver_.get());
auto* rtp_receiver_impl = static_cast<RtpReceiverImpl*>(rtp_receiver_.get());
auto ssrc_sources = rtp_receiver_impl->ssrc_sources_for_testing();
ASSERT_EQ(1u, ssrc_sources.size());
EXPECT_EQ(kSsrc1, ssrc_sources.begin()->source_id());

View File

@ -42,7 +42,7 @@ const int64_t kMaxRttMs = 1000;
class RtcpRttStatsTestImpl : public RtcpRttStats {
public:
RtcpRttStatsTestImpl() : rtt_ms_(0) {}
virtual ~RtcpRttStatsTestImpl() {}
~RtcpRttStatsTestImpl() override = default;
void OnRttUpdate(int64_t rtt_ms) override { rtt_ms_ = rtt_ms; }
int64_t LastProcessedRtt() const override { return rtt_ms_; }

View File

@ -1196,7 +1196,7 @@ TEST_P(RtpSenderTest, FrameCountCallbacks) {
class TestCallback : public FrameCountObserver {
public:
TestCallback() : FrameCountObserver(), num_calls_(0), ssrc_(0) {}
virtual ~TestCallback() {}
~TestCallback() override = default;
void FrameCountUpdated(const FrameCounts& frame_counts,
uint32_t ssrc) override {
@ -1256,7 +1256,7 @@ TEST_P(RtpSenderTest, BitrateCallbacks) {
ssrc_(0),
total_bitrate_(0),
retransmit_bitrate_(0) {}
virtual ~TestCallback() {}
~TestCallback() override = default;
void Notify(uint32_t total_bitrate,
uint32_t retransmit_bitrate,
@ -1344,7 +1344,7 @@ TEST_P(RtpSenderTestWithoutPacer, StreamDataCountersCallbacks) {
class TestCallback : public StreamDataCountersCallback {
public:
TestCallback() : StreamDataCountersCallback(), ssrc_(0), counters_() {}
virtual ~TestCallback() {}
~TestCallback() override = default;
void DataCountersUpdated(const StreamDataCounters& counters,
uint32_t ssrc) override {

View File

@ -87,7 +87,7 @@ class RtpRtcpAPITest : public ::testing::Test {
test_timestamp_ = 4567;
test_sequence_number_ = 2345;
}
~RtpRtcpAPITest() {}
~RtpRtcpAPITest() override = default;
const uint32_t initial_ssrc = 8888;

View File

@ -91,7 +91,7 @@ class RtpRtcpAudioTest : public ::testing::Test {
test_timestamp = 4567;
test_sequence_number = 2345;
}
~RtpRtcpAudioTest() {}
~RtpRtcpAudioTest() override = default;
void SetUp() override {
receive_statistics1_.reset(ReceiveStatistics::Create(&fake_clock));

View File

@ -35,7 +35,7 @@ class RtcpCallback : public RtcpIntraFrameObserver {
}
virtual void OnLipSyncUpdate(const int32_t id,
const int32_t audioVideoOffset) {}
virtual void OnReceivedIntraFrameRequest(uint32_t ssrc) {}
void OnReceivedIntraFrameRequest(uint32_t ssrc) override {}
private:
RtpRtcp* _rtpRtcpModule;
@ -44,7 +44,7 @@ class RtcpCallback : public RtcpIntraFrameObserver {
class TestRtpFeedback : public NullRtpFeedback {
public:
explicit TestRtpFeedback(RtpRtcp* rtp_rtcp) : rtp_rtcp_(rtp_rtcp) {}
virtual ~TestRtpFeedback() {}
~TestRtpFeedback() override = default;
void OnIncomingSSRCChanged(uint32_t ssrc) override {
rtp_rtcp_->SetRemoteSSRC(ssrc);
@ -64,9 +64,9 @@ class RtpRtcpRtcpTest : public ::testing::Test {
test_timestamp = 4567;
test_sequence_number = 2345;
}
~RtpRtcpRtcpTest() {}
~RtpRtcpRtcpTest() override = default;
virtual void SetUp() {
void SetUp() override {
receiver = new TestRtpReceiver();
transport1 = new LoopBackTransport();
transport2 = new LoopBackTransport();
@ -149,7 +149,7 @@ class RtpRtcpRtcpTest : public ::testing::Test {
test, 8, nullptr, nullptr, nullptr));
}
virtual void TearDown() {
void TearDown() override {
delete module1;
delete module2;
delete myRTCPFeedback1;

View File

@ -40,9 +40,9 @@ class RtpRtcpVideoTest : public ::testing::Test {
test_sequence_number_(2345),
fake_clock(123456),
retransmission_rate_limiter_(&fake_clock, 1000) {}
~RtpRtcpVideoTest() {}
~RtpRtcpVideoTest() override = default;
virtual void SetUp() {
void SetUp() override {
transport_ = new LoopBackTransport();
receiver_ = new TestRtpReceiver();
receive_statistics_.reset(ReceiveStatistics::Create(&fake_clock));
@ -118,7 +118,7 @@ class RtpRtcpVideoTest : public ::testing::Test {
return padding_bytes_in_packet + header_length;
}
virtual void TearDown() {
void TearDown() override {
delete video_module_;
delete transport_;
delete receiver_;

View File

@ -567,6 +567,7 @@ rtc_source_set("test_common") {
"fake_videorenderer.h",
"layer_filtering_transport.cc",
"layer_filtering_transport.h",
"mock_transport.cc",
"mock_transport.h",
"null_transport.cc",
"null_transport.h",

18
test/mock_transport.cc Normal file
View File

@ -0,0 +1,18 @@
/*
* Copyright (c) 2018 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.
*/
#include "test/mock_transport.h"
namespace webrtc {
MockTransport::MockTransport() = default;
MockTransport::~MockTransport() = default;
} // namespace webrtc

View File

@ -18,6 +18,9 @@ namespace webrtc {
class MockTransport : public Transport {
public:
MockTransport();
~MockTransport();
MOCK_METHOD3(SendRtp,
bool(const uint8_t* data,
size_t len,