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

Side by Side Diff: talk/app/webrtc/statscollector_unittest.cc

Issue 1307633007: add mediaType field to ssrc stat (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: add tests Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 *reports, StatsReport::kStatsReportTypeSsrc, 1); 598 *reports, StatsReport::kStatsReportTypeSsrc, 1);
599 EXPECT_FALSE(report == NULL); 599 EXPECT_FALSE(report == NULL);
600 EXPECT_EQ(stats->GetTimeNow(), report->timestamp()); 600 EXPECT_EQ(stats->GetTimeNow(), report->timestamp());
601 std::string track_id = ExtractSsrcStatsValue( 601 std::string track_id = ExtractSsrcStatsValue(
602 *reports, StatsReport::kStatsValueNameTrackId); 602 *reports, StatsReport::kStatsValueNameTrackId);
603 EXPECT_EQ(audio_track->id(), track_id); 603 EXPECT_EQ(audio_track->id(), track_id);
604 std::string ssrc_id = ExtractSsrcStatsValue( 604 std::string ssrc_id = ExtractSsrcStatsValue(
605 *reports, StatsReport::kStatsValueNameSsrc); 605 *reports, StatsReport::kStatsValueNameSsrc);
606 EXPECT_EQ(rtc::ToString<uint32>(kSsrcOfTrack), ssrc_id); 606 EXPECT_EQ(rtc::ToString<uint32>(kSsrcOfTrack), ssrc_id);
607 607
608 std::string media_type = ExtractSsrcStatsValue(*reports,
609 StatsReport::kStatsValueNameMediaType);
610 EXPECT_EQ("audio", media_type);
611
608 // Verifies the values in the track report. 612 // Verifies the values in the track report.
609 if (voice_sender_info) { 613 if (voice_sender_info) {
610 UpdateVoiceSenderInfoFromAudioTrack(audio_track, voice_sender_info); 614 UpdateVoiceSenderInfoFromAudioTrack(audio_track, voice_sender_info);
611 VerifyVoiceSenderInfoReport(report, *voice_sender_info); 615 VerifyVoiceSenderInfoReport(report, *voice_sender_info);
612 } 616 }
613 if (voice_receiver_info) { 617 if (voice_receiver_info) {
614 VerifyVoiceReceiverInfoReport(report, *voice_receiver_info); 618 VerifyVoiceReceiverInfoReport(report, *voice_receiver_info);
615 } 619 }
616 620
617 // Verify we get the same result by passing a track to GetStats(). 621 // Verify we get the same result by passing a track to GetStats().
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 EXPECT_TRUE(track_report); 1002 EXPECT_TRUE(track_report);
999 EXPECT_EQ(stats.GetTimeNow(), track_report->timestamp()); 1003 EXPECT_EQ(stats.GetTimeNow(), track_report->timestamp());
1000 1004
1001 std::string ssrc_id = ExtractSsrcStatsValue( 1005 std::string ssrc_id = ExtractSsrcStatsValue(
1002 reports, StatsReport::kStatsValueNameSsrc); 1006 reports, StatsReport::kStatsValueNameSsrc);
1003 EXPECT_EQ(rtc::ToString<uint32>(kSsrcOfTrack), ssrc_id); 1007 EXPECT_EQ(rtc::ToString<uint32>(kSsrcOfTrack), ssrc_id);
1004 1008
1005 std::string track_id = ExtractSsrcStatsValue( 1009 std::string track_id = ExtractSsrcStatsValue(
1006 reports, StatsReport::kStatsValueNameTrackId); 1010 reports, StatsReport::kStatsValueNameTrackId);
1007 EXPECT_EQ(kLocalTrackId, track_id); 1011 EXPECT_EQ(kLocalTrackId, track_id);
1012
1013 std::string media_type = ExtractSsrcStatsValue(reports,
1014 StatsReport::kStatsValueNameMediaType);
1015 EXPECT_EQ("video", media_type);
1008 } 1016 }
1009 1017
1010 // This test verifies that an SSRC object has the identifier of a Transport 1018 // This test verifies that an SSRC object has the identifier of a Transport
1011 // stats object, and that this transport stats object exists in stats. 1019 // stats object, and that this transport stats object exists in stats.
1012 TEST_F(StatsCollectorTest, TransportObjectLinkedFromSsrcObject) { 1020 TEST_F(StatsCollectorTest, TransportObjectLinkedFromSsrcObject) {
1013 StatsCollectorForTest stats(&session_); 1021 StatsCollectorForTest stats(&session_);
1014 1022
1015 // Ignore unused callback (logspam). 1023 // Ignore unused callback (logspam).
1016 EXPECT_CALL(session_, GetTransport(_)) 1024 EXPECT_CALL(session_, GetTransport(_))
1017 .WillRepeatedly(Return(static_cast<cricket::Transport*>(NULL))); 1025 .WillRepeatedly(Return(static_cast<cricket::Transport*>(NULL)));
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 cricket::VoiceSenderInfo new_voice_sender_info; 1712 cricket::VoiceSenderInfo new_voice_sender_info;
1705 InitVoiceSenderInfo(&new_voice_sender_info); 1713 InitVoiceSenderInfo(&new_voice_sender_info);
1706 cricket::VoiceMediaInfo new_stats_read; 1714 cricket::VoiceMediaInfo new_stats_read;
1707 reports.clear(); 1715 reports.clear();
1708 SetupAndVerifyAudioTrackStats( 1716 SetupAndVerifyAudioTrackStats(
1709 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName, 1717 new_audio_track.get(), stream_.get(), &stats, &voice_channel, kVcName,
1710 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports); 1718 media_channel, &new_voice_sender_info, NULL, &new_stats_read, &reports);
1711 } 1719 }
1712 1720
1713 } // namespace webrtc 1721 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698