OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 "a_local_host's protocol", | 920 "a_local_host's protocol", |
921 cricket::LOCAL_PORT_TYPE, | 921 cricket::LOCAL_PORT_TYPE, |
922 0); | 922 0); |
923 RTCLocalIceCandidateStats expected_a_local_host( | 923 RTCLocalIceCandidateStats expected_a_local_host( |
924 "RTCIceCandidate_" + a_local_host->id(), 0); | 924 "RTCIceCandidate_" + a_local_host->id(), 0); |
925 expected_a_local_host.ip = "1.2.3.4"; | 925 expected_a_local_host.ip = "1.2.3.4"; |
926 expected_a_local_host.port = 5; | 926 expected_a_local_host.port = 5; |
927 expected_a_local_host.protocol = "a_local_host's protocol"; | 927 expected_a_local_host.protocol = "a_local_host's protocol"; |
928 expected_a_local_host.candidate_type = "host"; | 928 expected_a_local_host.candidate_type = "host"; |
929 expected_a_local_host.priority = 0; | 929 expected_a_local_host.priority = 0; |
| 930 EXPECT_FALSE(*expected_a_local_host.is_remote); |
930 | 931 |
931 std::unique_ptr<cricket::Candidate> a_remote_srflx = CreateFakeCandidate( | 932 std::unique_ptr<cricket::Candidate> a_remote_srflx = CreateFakeCandidate( |
932 "6.7.8.9", 10, | 933 "6.7.8.9", 10, |
933 "remote_srflx's protocol", | 934 "remote_srflx's protocol", |
934 cricket::STUN_PORT_TYPE, | 935 cricket::STUN_PORT_TYPE, |
935 1); | 936 1); |
936 RTCRemoteIceCandidateStats expected_a_remote_srflx( | 937 RTCRemoteIceCandidateStats expected_a_remote_srflx( |
937 "RTCIceCandidate_" + a_remote_srflx->id(), 0); | 938 "RTCIceCandidate_" + a_remote_srflx->id(), 0); |
938 expected_a_remote_srflx.ip = "6.7.8.9"; | 939 expected_a_remote_srflx.ip = "6.7.8.9"; |
939 expected_a_remote_srflx.port = 10; | 940 expected_a_remote_srflx.port = 10; |
940 expected_a_remote_srflx.protocol = "remote_srflx's protocol"; | 941 expected_a_remote_srflx.protocol = "remote_srflx's protocol"; |
941 expected_a_remote_srflx.candidate_type = "srflx"; | 942 expected_a_remote_srflx.candidate_type = "srflx"; |
942 expected_a_remote_srflx.priority = 1; | 943 expected_a_remote_srflx.priority = 1; |
| 944 EXPECT_TRUE(*expected_a_remote_srflx.is_remote); |
943 | 945 |
944 std::unique_ptr<cricket::Candidate> a_local_prflx = CreateFakeCandidate( | 946 std::unique_ptr<cricket::Candidate> a_local_prflx = CreateFakeCandidate( |
945 "11.12.13.14", 15, | 947 "11.12.13.14", 15, |
946 "a_local_prflx's protocol", | 948 "a_local_prflx's protocol", |
947 cricket::PRFLX_PORT_TYPE, | 949 cricket::PRFLX_PORT_TYPE, |
948 2); | 950 2); |
949 RTCLocalIceCandidateStats expected_a_local_prflx( | 951 RTCLocalIceCandidateStats expected_a_local_prflx( |
950 "RTCIceCandidate_" + a_local_prflx->id(), 0); | 952 "RTCIceCandidate_" + a_local_prflx->id(), 0); |
951 expected_a_local_prflx.ip = "11.12.13.14"; | 953 expected_a_local_prflx.ip = "11.12.13.14"; |
952 expected_a_local_prflx.port = 15; | 954 expected_a_local_prflx.port = 15; |
953 expected_a_local_prflx.protocol = "a_local_prflx's protocol"; | 955 expected_a_local_prflx.protocol = "a_local_prflx's protocol"; |
954 expected_a_local_prflx.candidate_type = "prflx"; | 956 expected_a_local_prflx.candidate_type = "prflx"; |
955 expected_a_local_prflx.priority = 2; | 957 expected_a_local_prflx.priority = 2; |
| 958 EXPECT_FALSE(*expected_a_local_prflx.is_remote); |
956 | 959 |
957 std::unique_ptr<cricket::Candidate> a_remote_relay = CreateFakeCandidate( | 960 std::unique_ptr<cricket::Candidate> a_remote_relay = CreateFakeCandidate( |
958 "16.17.18.19", 20, | 961 "16.17.18.19", 20, |
959 "a_remote_relay's protocol", | 962 "a_remote_relay's protocol", |
960 cricket::RELAY_PORT_TYPE, | 963 cricket::RELAY_PORT_TYPE, |
961 3); | 964 3); |
962 RTCRemoteIceCandidateStats expected_a_remote_relay( | 965 RTCRemoteIceCandidateStats expected_a_remote_relay( |
963 "RTCIceCandidate_" + a_remote_relay->id(), 0); | 966 "RTCIceCandidate_" + a_remote_relay->id(), 0); |
964 expected_a_remote_relay.ip = "16.17.18.19"; | 967 expected_a_remote_relay.ip = "16.17.18.19"; |
965 expected_a_remote_relay.port = 20; | 968 expected_a_remote_relay.port = 20; |
966 expected_a_remote_relay.protocol = "a_remote_relay's protocol"; | 969 expected_a_remote_relay.protocol = "a_remote_relay's protocol"; |
967 expected_a_remote_relay.candidate_type = "relay"; | 970 expected_a_remote_relay.candidate_type = "relay"; |
968 expected_a_remote_relay.priority = 3; | 971 expected_a_remote_relay.priority = 3; |
| 972 EXPECT_TRUE(*expected_a_remote_relay.is_remote); |
969 | 973 |
970 // Candidates in the second transport stats. | 974 // Candidates in the second transport stats. |
971 std::unique_ptr<cricket::Candidate> b_local = CreateFakeCandidate( | 975 std::unique_ptr<cricket::Candidate> b_local = CreateFakeCandidate( |
972 "42.42.42.42", 42, | 976 "42.42.42.42", 42, |
973 "b_local's protocol", | 977 "b_local's protocol", |
974 cricket::LOCAL_PORT_TYPE, | 978 cricket::LOCAL_PORT_TYPE, |
975 42); | 979 42); |
976 RTCLocalIceCandidateStats expected_b_local( | 980 RTCLocalIceCandidateStats expected_b_local( |
977 "RTCIceCandidate_" + b_local->id(), 0); | 981 "RTCIceCandidate_" + b_local->id(), 0); |
978 expected_b_local.ip = "42.42.42.42"; | 982 expected_b_local.ip = "42.42.42.42"; |
979 expected_b_local.port = 42; | 983 expected_b_local.port = 42; |
980 expected_b_local.protocol = "b_local's protocol"; | 984 expected_b_local.protocol = "b_local's protocol"; |
981 expected_b_local.candidate_type = "host"; | 985 expected_b_local.candidate_type = "host"; |
982 expected_b_local.priority = 42; | 986 expected_b_local.priority = 42; |
| 987 EXPECT_FALSE(*expected_b_local.is_remote); |
983 | 988 |
984 std::unique_ptr<cricket::Candidate> b_remote = CreateFakeCandidate( | 989 std::unique_ptr<cricket::Candidate> b_remote = CreateFakeCandidate( |
985 "42.42.42.42", 42, | 990 "42.42.42.42", 42, |
986 "b_remote's protocol", | 991 "b_remote's protocol", |
987 cricket::LOCAL_PORT_TYPE, | 992 cricket::LOCAL_PORT_TYPE, |
988 42); | 993 42); |
989 RTCRemoteIceCandidateStats expected_b_remote( | 994 RTCRemoteIceCandidateStats expected_b_remote( |
990 "RTCIceCandidate_" + b_remote->id(), 0); | 995 "RTCIceCandidate_" + b_remote->id(), 0); |
991 expected_b_remote.ip = "42.42.42.42"; | 996 expected_b_remote.ip = "42.42.42.42"; |
992 expected_b_remote.port = 42; | 997 expected_b_remote.port = 42; |
993 expected_b_remote.protocol = "b_remote's protocol"; | 998 expected_b_remote.protocol = "b_remote's protocol"; |
994 expected_b_remote.candidate_type = "host"; | 999 expected_b_remote.candidate_type = "host"; |
995 expected_b_remote.priority = 42; | 1000 expected_b_remote.priority = 42; |
| 1001 EXPECT_TRUE(*expected_b_remote.is_remote); |
996 | 1002 |
997 SessionStats session_stats; | 1003 SessionStats session_stats; |
998 | 1004 |
999 cricket::TransportChannelStats a_transport_channel_stats; | 1005 cricket::TransportChannelStats a_transport_channel_stats; |
1000 a_transport_channel_stats.connection_infos.push_back( | 1006 a_transport_channel_stats.connection_infos.push_back( |
1001 cricket::ConnectionInfo()); | 1007 cricket::ConnectionInfo()); |
1002 a_transport_channel_stats.connection_infos[0].local_candidate = | 1008 a_transport_channel_stats.connection_infos[0].local_candidate = |
1003 *a_local_host.get(); | 1009 *a_local_host.get(); |
1004 a_transport_channel_stats.connection_infos[0].remote_candidate = | 1010 a_transport_channel_stats.connection_infos[0].remote_candidate = |
1005 *a_remote_srflx.get(); | 1011 *a_remote_srflx.get(); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 expected_pair, | 1125 expected_pair, |
1120 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>()); | 1126 report->Get(expected_pair.id())->cast_to<RTCIceCandidatePairStats>()); |
1121 | 1127 |
1122 RTCLocalIceCandidateStats expected_local_candidate( | 1128 RTCLocalIceCandidateStats expected_local_candidate( |
1123 *expected_pair.local_candidate_id, report->timestamp_us()); | 1129 *expected_pair.local_candidate_id, report->timestamp_us()); |
1124 expected_local_candidate.ip = "42.42.42.42"; | 1130 expected_local_candidate.ip = "42.42.42.42"; |
1125 expected_local_candidate.port = 42; | 1131 expected_local_candidate.port = 42; |
1126 expected_local_candidate.protocol = "protocol"; | 1132 expected_local_candidate.protocol = "protocol"; |
1127 expected_local_candidate.candidate_type = "host"; | 1133 expected_local_candidate.candidate_type = "host"; |
1128 expected_local_candidate.priority = 42; | 1134 expected_local_candidate.priority = 42; |
| 1135 EXPECT_FALSE(*expected_local_candidate.is_remote); |
1129 ASSERT_TRUE(report->Get(expected_local_candidate.id())); | 1136 ASSERT_TRUE(report->Get(expected_local_candidate.id())); |
1130 EXPECT_EQ(expected_local_candidate, | 1137 EXPECT_EQ(expected_local_candidate, |
1131 report->Get(expected_local_candidate.id())->cast_to< | 1138 report->Get(expected_local_candidate.id())->cast_to< |
1132 RTCLocalIceCandidateStats>()); | 1139 RTCLocalIceCandidateStats>()); |
1133 | 1140 |
1134 RTCRemoteIceCandidateStats expected_remote_candidate( | 1141 RTCRemoteIceCandidateStats expected_remote_candidate( |
1135 *expected_pair.remote_candidate_id, report->timestamp_us()); | 1142 *expected_pair.remote_candidate_id, report->timestamp_us()); |
1136 expected_remote_candidate.ip = "42.42.42.42"; | 1143 expected_remote_candidate.ip = "42.42.42.42"; |
1137 expected_remote_candidate.port = 42; | 1144 expected_remote_candidate.port = 42; |
1138 expected_remote_candidate.protocol = "protocol"; | 1145 expected_remote_candidate.protocol = "protocol"; |
1139 expected_remote_candidate.candidate_type = "host"; | 1146 expected_remote_candidate.candidate_type = "host"; |
1140 expected_remote_candidate.priority = 42; | 1147 expected_remote_candidate.priority = 42; |
| 1148 EXPECT_TRUE(*expected_remote_candidate.is_remote); |
1141 ASSERT_TRUE(report->Get(expected_remote_candidate.id())); | 1149 ASSERT_TRUE(report->Get(expected_remote_candidate.id())); |
1142 EXPECT_EQ(expected_remote_candidate, | 1150 EXPECT_EQ(expected_remote_candidate, |
1143 report->Get(expected_remote_candidate.id())->cast_to< | 1151 report->Get(expected_remote_candidate.id())->cast_to< |
1144 RTCRemoteIceCandidateStats>()); | 1152 RTCRemoteIceCandidateStats>()); |
1145 } | 1153 } |
1146 | 1154 |
1147 TEST_F(RTCStatsCollectorTest, CollectRTCPeerConnectionStats) { | 1155 TEST_F(RTCStatsCollectorTest, CollectRTCPeerConnectionStats) { |
1148 { | 1156 { |
1149 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 1157 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
1150 RTCPeerConnectionStats expected("RTCPeerConnection", | 1158 RTCPeerConnectionStats expected("RTCPeerConnection", |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1986 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; | 1994 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; |
1987 }; | 1995 }; |
1988 | 1996 |
1989 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { | 1997 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { |
1990 collector_->VerifyThreadUsageAndResultsMerging(); | 1998 collector_->VerifyThreadUsageAndResultsMerging(); |
1991 } | 1999 } |
1992 | 2000 |
1993 } // namespace | 2001 } // namespace |
1994 | 2002 |
1995 } // namespace webrtc | 2003 } // namespace webrtc |
OLD | NEW |