Chromium Code Reviews| Index: webrtc/api/rtcstatscollector_unittest.cc | 
| diff --git a/webrtc/api/rtcstatscollector_unittest.cc b/webrtc/api/rtcstatscollector_unittest.cc | 
| index 89161363a258668fd6fec90332f16b7b8a92579b..3823dc32ed0d3a9206d8d617eeef2bf5d8aa95d7 100644 | 
| --- a/webrtc/api/rtcstatscollector_unittest.cc | 
| +++ b/webrtc/api/rtcstatscollector_unittest.cc | 
| @@ -159,12 +159,16 @@ std::unique_ptr<cricket::Candidate> CreateFakeCandidate( | 
| int port, | 
| const std::string& protocol, | 
| const std::string& candidate_type, | 
| - uint32_t priority) { | 
| + uint32_t priority, | 
| + int component = 0, | 
| + const std::string& transport_name = "") { | 
| 
 
Taylor Brandstetter
2016/12/22 19:28:31
As mentioned in other comments, I wouldn't use the
 
hbos
2016/12/23 14:25:17
Done.
 
 | 
| std::unique_ptr<cricket::Candidate> candidate(new cricket::Candidate()); | 
| candidate->set_address(rtc::SocketAddress(hostname, port)); | 
| candidate->set_protocol(protocol); | 
| candidate->set_type(candidate_type); | 
| candidate->set_priority(priority); | 
| + candidate->set_component(component); | 
| + candidate->set_transport_name(transport_name); | 
| return candidate; | 
| } | 
| @@ -919,7 +923,9 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) { | 
| "1.2.3.4", 5, | 
| "a_local_host's protocol", | 
| cricket::LOCAL_PORT_TYPE, | 
| - 0); | 
| + 0, | 
| + cricket::ICE_CANDIDATE_COMPONENT_RTP, | 
| + "a"); | 
| RTCLocalIceCandidateStats expected_a_local_host( | 
| "RTCIceCandidate_" + a_local_host->id(), 0); | 
| expected_a_local_host.ip = "1.2.3.4"; | 
| @@ -927,12 +933,16 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) { | 
| expected_a_local_host.protocol = "a_local_host's protocol"; | 
| expected_a_local_host.candidate_type = "host"; | 
| expected_a_local_host.priority = 0; | 
| + expected_a_local_host.transport_id = "RTCTransport_a_" + | 
| + rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP); | 
| std::unique_ptr<cricket::Candidate> a_remote_srflx = CreateFakeCandidate( | 
| "6.7.8.9", 10, | 
| "remote_srflx's protocol", | 
| cricket::STUN_PORT_TYPE, | 
| - 1); | 
| + 1, | 
| + cricket::ICE_CANDIDATE_COMPONENT_RTP, | 
| + "a"); | 
| RTCRemoteIceCandidateStats expected_a_remote_srflx( | 
| "RTCIceCandidate_" + a_remote_srflx->id(), 0); | 
| expected_a_remote_srflx.ip = "6.7.8.9"; | 
| @@ -940,12 +950,16 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) { | 
| expected_a_remote_srflx.protocol = "remote_srflx's protocol"; | 
| expected_a_remote_srflx.candidate_type = "srflx"; | 
| expected_a_remote_srflx.priority = 1; | 
| + expected_a_remote_srflx.transport_id = "RTCTransport_a_" + | 
| + rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP); | 
| std::unique_ptr<cricket::Candidate> a_local_prflx = CreateFakeCandidate( | 
| "11.12.13.14", 15, | 
| "a_local_prflx's protocol", | 
| cricket::PRFLX_PORT_TYPE, | 
| - 2); | 
| + 2, | 
| + cricket::ICE_CANDIDATE_COMPONENT_RTCP, | 
| + "a"); | 
| RTCLocalIceCandidateStats expected_a_local_prflx( | 
| "RTCIceCandidate_" + a_local_prflx->id(), 0); | 
| expected_a_local_prflx.ip = "11.12.13.14"; | 
| @@ -953,12 +967,16 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) { | 
| expected_a_local_prflx.protocol = "a_local_prflx's protocol"; | 
| expected_a_local_prflx.candidate_type = "prflx"; | 
| expected_a_local_prflx.priority = 2; | 
| + expected_a_local_prflx.transport_id = "RTCTransport_a_" + | 
| + rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 
| std::unique_ptr<cricket::Candidate> a_remote_relay = CreateFakeCandidate( | 
| "16.17.18.19", 20, | 
| "a_remote_relay's protocol", | 
| cricket::RELAY_PORT_TYPE, | 
| - 3); | 
| + 3, | 
| + cricket::ICE_CANDIDATE_COMPONENT_RTCP, | 
| + "a"); | 
| RTCRemoteIceCandidateStats expected_a_remote_relay( | 
| "RTCIceCandidate_" + a_remote_relay->id(), 0); | 
| expected_a_remote_relay.ip = "16.17.18.19"; | 
| @@ -966,6 +984,8 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) { | 
| expected_a_remote_relay.protocol = "a_remote_relay's protocol"; | 
| expected_a_remote_relay.candidate_type = "relay"; | 
| expected_a_remote_relay.priority = 3; | 
| + expected_a_remote_relay.transport_id = "RTCTransport_a_" + | 
| + rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 
| // Candidates in the second transport stats. | 
| std::unique_ptr<cricket::Candidate> b_local = CreateFakeCandidate( | 
| @@ -996,22 +1016,29 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) { | 
| SessionStats session_stats; | 
| - cricket::TransportChannelStats a_transport_channel_stats; | 
| - a_transport_channel_stats.connection_infos.push_back( | 
| + cricket::TransportChannelStats a_transport_channel_stats_rtp; | 
| + a_transport_channel_stats_rtp.component = | 
| + cricket::ICE_CANDIDATE_COMPONENT_RTP; | 
| + a_transport_channel_stats_rtp.connection_infos.push_back( | 
| cricket::ConnectionInfo()); | 
| - a_transport_channel_stats.connection_infos[0].local_candidate = | 
| + a_transport_channel_stats_rtp.connection_infos[0].local_candidate = | 
| *a_local_host.get(); | 
| - a_transport_channel_stats.connection_infos[0].remote_candidate = | 
| + a_transport_channel_stats_rtp.connection_infos[0].remote_candidate = | 
| *a_remote_srflx.get(); | 
| - a_transport_channel_stats.connection_infos.push_back( | 
| + cricket::TransportChannelStats a_transport_channel_stats_rtcp; | 
| + a_transport_channel_stats_rtcp.component = | 
| + cricket::ICE_CANDIDATE_COMPONENT_RTCP; | 
| + a_transport_channel_stats_rtcp.connection_infos.push_back( | 
| cricket::ConnectionInfo()); | 
| - a_transport_channel_stats.connection_infos[1].local_candidate = | 
| + a_transport_channel_stats_rtcp.connection_infos[0].local_candidate = | 
| *a_local_prflx.get(); | 
| - a_transport_channel_stats.connection_infos[1].remote_candidate = | 
| + a_transport_channel_stats_rtcp.connection_infos[0].remote_candidate = | 
| *a_remote_relay.get(); | 
| session_stats.transport_stats["a"].transport_name = "a"; | 
| session_stats.transport_stats["a"].channel_stats.push_back( | 
| - a_transport_channel_stats); | 
| + a_transport_channel_stats_rtp); | 
| + session_stats.transport_stats["a"].channel_stats.push_back( | 
| + a_transport_channel_stats_rtcp); | 
| cricket::TransportChannelStats b_transport_channel_stats; | 
| b_transport_channel_stats.connection_infos.push_back( | 
| @@ -1056,6 +1083,11 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidateStats) { | 
| EXPECT_EQ(expected_b_remote, | 
| report->Get(expected_b_remote.id())->cast_to< | 
| RTCRemoteIceCandidateStats>()); | 
| + | 
| + EXPECT_TRUE(report->Get(*expected_a_local_host.transport_id)); | 
| + EXPECT_TRUE(report->Get(*expected_a_remote_srflx.transport_id)); | 
| + EXPECT_TRUE(report->Get(*expected_a_local_prflx.transport_id)); | 
| + EXPECT_TRUE(report->Get(*expected_a_remote_relay.transport_id)); | 
| } | 
| TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidatePairStats) { |