Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(833)

Unified Diff: webrtc/pc/statscollector_unittest.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/pc/statscollector_unittest.cc
diff --git a/webrtc/pc/statscollector_unittest.cc b/webrtc/pc/statscollector_unittest.cc
index 1bb6d1de4c19e38aa963c4b530958f045ef50f3a..2b36bc552bbd6e5652cc393795d3b917d0127146 100644
--- a/webrtc/pc/statscollector_unittest.cc
+++ b/webrtc/pc/statscollector_unittest.cc
@@ -98,7 +98,7 @@ class FakeAudioTrack
: webrtc::MediaStreamTrack<webrtc::AudioTrackInterface>(id),
processor_(new rtc::RefCountedObject<FakeAudioProcessor>()) {}
std::string kind() const override { return "audio"; }
- webrtc::AudioSourceInterface* GetSource() const override { return NULL; }
+ webrtc::AudioSourceInterface* GetSource() const override { return nullptr; }
void AddSink(webrtc::AudioTrackSinkInterface* sink) override {}
void RemoveSink(webrtc::AudioTrackSinkInterface* sink) override {}
bool GetSignalLevel(int* level) override {
@@ -140,7 +140,7 @@ class FakeAudioTrackWithInitValue
processor_(
new rtc::RefCountedObject<FakeAudioProcessorWithInitValue>()) {}
std::string kind() const override { return "audio"; }
- webrtc::AudioSourceInterface* GetSource() const override { return NULL; }
+ webrtc::AudioSourceInterface* GetSource() const override { return nullptr; }
void AddSink(webrtc::AudioTrackSinkInterface* sink) override {}
void RemoveSink(webrtc::AudioTrackSinkInterface* sink) override {}
bool GetSignalLevel(int* level) override {
@@ -258,7 +258,7 @@ void CheckCertChainReports(const StatsReports& reports,
size_t i = 0;
while (true) {
const StatsReport* report = FindReportById(reports, *certificate_id);
- ASSERT_TRUE(report != NULL);
+ ASSERT_TRUE(report != nullptr);
std::string der_base64;
EXPECT_TRUE(GetValue(
@@ -566,7 +566,7 @@ class StatsCollectorTest : public testing::Test {
// Adds a outgoing audio track with a given SSRC into the stats.
void AddOutgoingAudioTrackStats() {
- if (stream_ == NULL)
+ if (stream_ == nullptr)
stream_ = webrtc::MediaStream::Create("streamlabel");
audio_track_ = new rtc::RefCountedObject<FakeAudioTrack>(
@@ -578,7 +578,7 @@ class StatsCollectorTest : public testing::Test {
// Adds a incoming audio track with a given SSRC into the stats.
void AddIncomingAudioTrackStats() {
- if (stream_ == NULL)
+ if (stream_ == nullptr)
stream_ = webrtc::MediaStream::Create("streamlabel");
audio_track_ = new rtc::RefCountedObject<FakeAudioTrack>(
@@ -617,7 +617,8 @@ class StatsCollectorTest : public testing::Test {
StatsReports* reports) {
// A track can't have both sender report and recv report at the same time
// for now, this might change in the future though.
- EXPECT_TRUE((voice_sender_info == NULL) ^ (voice_receiver_info == NULL));
+ EXPECT_TRUE((voice_sender_info == nullptr) ^
+ (voice_receiver_info == nullptr));
// Instruct the session to return stats containing the transport channel.
InitSessionStats(vc_name);
@@ -641,12 +642,12 @@ class StatsCollectorTest : public testing::Test {
stats->UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
stats->ClearUpdateStatsCacheForTest();
- stats->GetStats(NULL, reports);
+ stats->GetStats(nullptr, reports);
// Verify the existence of the track report.
const StatsReport* report = FindNthReportByType(
*reports, StatsReport::kStatsReportTypeSsrc, 1);
- EXPECT_FALSE(report == NULL);
+ EXPECT_FALSE(report == nullptr);
EXPECT_EQ(stats->GetTimeNow(), report->timestamp());
std::string track_id = ExtractSsrcStatsValue(
*reports, StatsReport::kStatsValueNameTrackId);
@@ -731,11 +732,11 @@ class StatsCollectorTest : public testing::Test {
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
const StatsReport* channel_report = FindNthReportByType(
reports, StatsReport::kStatsReportTypeComponent, 1);
- EXPECT_TRUE(channel_report != NULL);
+ EXPECT_TRUE(channel_report != nullptr);
// Check local certificate chain.
std::string local_certificate_id = ExtractStatsValue(
@@ -806,7 +807,7 @@ TEST_F(StatsCollectorTest, FilterOutNegativeDataChannelId) {
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
StatsReports reports;
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
const StatsReport* report =
FindNthReportByType(reports, StatsReport::kStatsReportTypeDataChannel, 1);
@@ -829,7 +830,7 @@ TEST_F(StatsCollectorTest, ExtractDataInfo) {
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
StatsReports reports;
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
const StatsReport* report =
FindNthReportByType(reports, StatsReport::kStatsReportTypeDataChannel, 1);
@@ -897,7 +898,7 @@ TEST_F(StatsCollectorTest, BytesCounterHandles64Bits) {
.WillOnce(DoAll(SetArgPointee<0>(stats_read),
Return(true)));
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
std::string result = ExtractSsrcStatsValue(reports,
StatsReport::kStatsValueNameBytesSent);
EXPECT_EQ(kBytesSentString, result);
@@ -953,7 +954,7 @@ TEST_F(StatsCollectorTest, BandwidthEstimationInfoIsReported) {
.WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true)));
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
std::string result = ExtractSsrcStatsValue(reports,
StatsReport::kStatsValueNameBytesSent);
EXPECT_EQ(kBytesSentString, result);
@@ -969,10 +970,10 @@ TEST_F(StatsCollectorTest, SessionObjectExists) {
StatsReports reports; // returned values.
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
const StatsReport* session_report = FindNthReportByType(
reports, StatsReport::kStatsReportTypeSession, 1);
- EXPECT_FALSE(session_report == NULL);
+ EXPECT_FALSE(session_report == nullptr);
}
// This test verifies that only one object of type "googSession" exists
@@ -983,13 +984,13 @@ TEST_F(StatsCollectorTest, OnlyOneSessionObjectExists) {
StatsReports reports; // returned values.
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
const StatsReport* session_report = FindNthReportByType(
reports, StatsReport::kStatsReportTypeSession, 1);
- EXPECT_FALSE(session_report == NULL);
+ EXPECT_FALSE(session_report == nullptr);
session_report = FindNthReportByType(
reports, StatsReport::kStatsReportTypeSession, 2);
- EXPECT_EQ(NULL, session_report);
+ EXPECT_EQ(nullptr, session_report);
}
// This test verifies that the empty track report exists in the returned stats
@@ -1006,7 +1007,7 @@ TEST_F(StatsCollectorTest, TrackObjectExistsWithoutUpdateStats) {
// Verfies the existence of the track report.
StatsReports reports;
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
EXPECT_EQ((size_t)1, reports.size());
EXPECT_EQ(StatsReport::kStatsReportTypeTrack, reports[0]->type());
EXPECT_EQ(0, reports[0]->timestamp());
@@ -1061,7 +1062,7 @@ TEST_F(StatsCollectorTest, TrackAndSsrcObjectExistAfterUpdateSsrcStats) {
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
StatsReports reports;
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
// |reports| should contain at least one session report, one track report,
// and one ssrc report.
EXPECT_LE((size_t)3, reports.size());
@@ -1137,7 +1138,7 @@ TEST_F(StatsCollectorTest, TransportObjectLinkedFromSsrcObject) {
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
StatsReports reports;
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
std::string transport_id = ExtractStatsValue(
StatsReport::kStatsReportTypeSsrc,
reports,
@@ -1156,7 +1157,7 @@ TEST_F(StatsCollectorTest, TransportObjectLinkedFromSsrcObject) {
StatsReport::Id id(StatsReport::NewComponentId(content, 1));
ASSERT_EQ(transport_id, id->ToString());
const StatsReport* transport_report = FindReportById(reports, id);
- ASSERT_FALSE(transport_report == NULL);
+ ASSERT_FALSE(transport_report == nullptr);
}
// This test verifies that a remote stats object will not be created for
@@ -1175,10 +1176,10 @@ TEST_F(StatsCollectorTest, RemoteSsrcInfoIsAbsent) {
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
StatsReports reports;
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
const StatsReport* remote_report = FindNthReportByType(reports,
StatsReport::kStatsReportTypeRemoteSsrc, 1);
- EXPECT_TRUE(remote_report == NULL);
+ EXPECT_TRUE(remote_report == nullptr);
}
// This test verifies that a remote stats object will be created for
@@ -1227,11 +1228,11 @@ TEST_F(StatsCollectorTest, RemoteSsrcInfoIsPresent) {
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
StatsReports reports;
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
const StatsReport* remote_report = FindNthReportByType(reports,
StatsReport::kStatsReportTypeRemoteSsrc, 1);
- EXPECT_FALSE(remote_report == NULL);
+ EXPECT_FALSE(remote_report == nullptr);
EXPECT_EQ(12345.678, remote_report->timestamp());
}
@@ -1278,7 +1279,7 @@ TEST_F(StatsCollectorTest, ReportsFromRemoteTrack) {
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
StatsReports reports;
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
// |reports| should contain at least one session report, one track report,
// and one ssrc report.
EXPECT_LE(static_cast<size_t>(3), reports.size());
@@ -1333,7 +1334,7 @@ TEST_F(StatsCollectorTest, IceCandidateReport) {
report_id = AddCandidateReport(&stats, c, false)->id()->ToString();
EXPECT_EQ("Cand-" + c.id(), report_id);
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
// Verify the local candidate report is populated correctly.
EXPECT_EQ(
@@ -1462,7 +1463,7 @@ TEST_F(StatsCollectorTest, NoTransport) {
}));
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
// Check that the local certificate is absent.
std::string local_certificate_id = ExtractStatsValue(
@@ -1520,7 +1521,7 @@ TEST_F(StatsCollectorTest, NoCertificates) {
new SessionStats(session_stats));
}));
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
// Check that the local certificate is absent.
std::string local_certificate_id = ExtractStatsValue(
@@ -1572,7 +1573,7 @@ TEST_F(StatsCollectorTest, FilterOutNegativeInitialValues) {
kVcName, kDefaultRtcpMuxRequired, kDefaultSrtpRequired);
// Create a local stream with a local audio track and adds it to the stats.
- if (stream_ == NULL)
+ if (stream_ == nullptr)
stream_ = webrtc::MediaStream::Create("streamlabel");
rtc::scoped_refptr<FakeAudioTrackWithInitValue> local_track(
@@ -1691,13 +1692,13 @@ TEST_F(StatsCollectorTest, GetStatsFromLocalAudioTrack) {
StatsReports reports; // returned values.
SetupAndVerifyAudioTrackStats(
audio_track_.get(), stream_.get(), &stats, &voice_channel, kVcName,
- media_channel, &voice_sender_info, NULL, &stats_read, &reports);
+ media_channel, &voice_sender_info, nullptr, &stats_read, &reports);
// Verify that there is no remote report for the local audio track because
// we did not set it up.
const StatsReport* remote_report = FindNthReportByType(reports,
StatsReport::kStatsReportTypeRemoteSsrc, 1);
- EXPECT_TRUE(remote_report == NULL);
+ EXPECT_TRUE(remote_report == nullptr);
}
// This test verifies that audio receive streams populate stats reports
@@ -1725,9 +1726,9 @@ TEST_F(StatsCollectorTest, GetStatsFromRemoteStream) {
cricket::VoiceMediaInfo stats_read;
StatsReports reports; // returned values.
- SetupAndVerifyAudioTrackStats(
- audio_track_.get(), stream_.get(), &stats, &voice_channel, kVcName,
- media_channel, NULL, &voice_receiver_info, &stats_read, &reports);
+ SetupAndVerifyAudioTrackStats(audio_track_.get(), stream_.get(), &stats,
+ &voice_channel, kVcName, media_channel, nullptr,
+ &voice_receiver_info, &stats_read, &reports);
}
// This test verifies that a local stats object won't update its statistics
@@ -1774,12 +1775,12 @@ TEST_F(StatsCollectorTest, GetStatsAfterRemoveAudioStream) {
StatsReports reports; // returned values.
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
// The report will exist since we don't remove them in RemoveStream().
const StatsReport* report = FindNthReportByType(
reports, StatsReport::kStatsReportTypeSsrc, 1);
- EXPECT_FALSE(report == NULL);
+ EXPECT_FALSE(report == nullptr);
EXPECT_EQ(stats.GetTimeNow(), report->timestamp());
std::string track_id = ExtractSsrcStatsValue(
reports, StatsReport::kStatsValueNameTrackId);
@@ -1913,7 +1914,7 @@ TEST_F(StatsCollectorTest, TwoLocalTracksWithSameSsrc) {
StatsReports reports; // returned values.
SetupAndVerifyAudioTrackStats(
audio_track_.get(), stream_.get(), &stats, &voice_channel, kVcName,
- media_channel, &voice_sender_info, NULL, &stats_read, &reports);
+ media_channel, &voice_sender_info, nullptr, &stats_read, &reports);
// Remove the previous audio track from the stream.
stream_->RemoveTrack(audio_track_.get());
@@ -1933,9 +1934,10 @@ TEST_F(StatsCollectorTest, TwoLocalTracksWithSameSsrc) {
InitVoiceSenderInfo(&new_voice_sender_info);
cricket::VoiceMediaInfo new_stats_read;
reports.clear();
- SetupAndVerifyAudioTrackStats(
- new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName,
- media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports);
+ SetupAndVerifyAudioTrackStats(new_audio_track.get(), stream_.get(), &stats,
+ &voice_channel, kVcName, media_channel,
+ &new_voice_sender_info, nullptr,
+ &new_stats_read, &reports);
}
// This test verifies that stats are correctly set in video send ssrc stats.
@@ -1978,7 +1980,7 @@ TEST_F(StatsCollectorTest, VerifyVideoSendSsrcStats) {
EXPECT_CALL(*media_channel, GetStats(_))
.WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true)));
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
EXPECT_EQ(rtc::ToString(video_sender_info.frames_encoded),
ExtractSsrcStatsValue(reports,
StatsReport::kStatsValueNameFramesEncoded));
@@ -2026,7 +2028,7 @@ TEST_F(StatsCollectorTest, VerifyVideoReceiveSsrcStats) {
EXPECT_CALL(*media_channel, GetStats(_))
.WillOnce(DoAll(SetArgPointee<0>(stats_read), Return(true)));
stats.UpdateStats(PeerConnectionInterface::kStatsOutputLevelStandard);
- stats.GetStats(NULL, &reports);
+ stats.GetStats(nullptr, &reports);
EXPECT_EQ(rtc::ToString(video_receiver_info.frames_decoded),
ExtractSsrcStatsValue(reports,
StatsReport::kStatsValueNameFramesDecoded));

Powered by Google App Engine
This is Rietveld 408576698