| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 bool remove_msid_ = false; // True if MSID should be removed in received SDP. | 901 bool remove_msid_ = false; // True if MSID should be removed in received SDP. |
| 902 bool remove_bundle_ = | 902 bool remove_bundle_ = |
| 903 false; // True if bundle should be removed in received SDP. | 903 false; // True if bundle should be removed in received SDP. |
| 904 bool remove_sdes_ = | 904 bool remove_sdes_ = |
| 905 false; // True if a=crypto should be removed in received SDP. | 905 false; // True if a=crypto should be removed in received SDP. |
| 906 | 906 |
| 907 rtc::scoped_refptr<DataChannelInterface> data_channel_; | 907 rtc::scoped_refptr<DataChannelInterface> data_channel_; |
| 908 rtc::scoped_ptr<MockDataChannelObserver> data_observer_; | 908 rtc::scoped_ptr<MockDataChannelObserver> data_observer_; |
| 909 }; | 909 }; |
| 910 | 910 |
| 911 // TODO(deadbeef): Rename this to P2PTestConductor once the Linux memcheck and | 911 class P2PTestConductor : public testing::Test { |
| 912 // Windows DrMemory Full bots' blacklists are updated. | |
| 913 class JsepPeerConnectionP2PTestClient : public testing::Test { | |
| 914 public: | 912 public: |
| 915 JsepPeerConnectionP2PTestClient() | 913 P2PTestConductor() |
| 916 : pss_(new rtc::PhysicalSocketServer), | 914 : pss_(new rtc::PhysicalSocketServer), |
| 917 ss_(new rtc::VirtualSocketServer(pss_.get())), | 915 ss_(new rtc::VirtualSocketServer(pss_.get())), |
| 918 ss_scope_(ss_.get()) {} | 916 ss_scope_(ss_.get()) {} |
| 919 | 917 |
| 920 bool SessionActive() { | 918 bool SessionActive() { |
| 921 return initiating_client_->SessionActive() && | 919 return initiating_client_->SessionActive() && |
| 922 receiving_client_->SessionActive(); | 920 receiving_client_->SessionActive(); |
| 923 } | 921 } |
| 924 | 922 |
| 925 // Return true if the number of frames provided have been received or it is | 923 // Return true if the number of frames provided have been received or it is |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 EXPECT_EQ(height, initializing_client()->rendered_height()); | 958 EXPECT_EQ(height, initializing_client()->rendered_height()); |
| 961 } | 959 } |
| 962 | 960 |
| 963 void VerifySessionDescriptions() { | 961 void VerifySessionDescriptions() { |
| 964 initiating_client_->VerifyRejectedMediaInSessionDescription(); | 962 initiating_client_->VerifyRejectedMediaInSessionDescription(); |
| 965 receiving_client_->VerifyRejectedMediaInSessionDescription(); | 963 receiving_client_->VerifyRejectedMediaInSessionDescription(); |
| 966 initiating_client_->VerifyLocalIceUfragAndPassword(); | 964 initiating_client_->VerifyLocalIceUfragAndPassword(); |
| 967 receiving_client_->VerifyLocalIceUfragAndPassword(); | 965 receiving_client_->VerifyLocalIceUfragAndPassword(); |
| 968 } | 966 } |
| 969 | 967 |
| 970 ~JsepPeerConnectionP2PTestClient() { | 968 ~P2PTestConductor() { |
| 971 if (initiating_client_) { | 969 if (initiating_client_) { |
| 972 initiating_client_->set_signaling_message_receiver(nullptr); | 970 initiating_client_->set_signaling_message_receiver(nullptr); |
| 973 } | 971 } |
| 974 if (receiving_client_) { | 972 if (receiving_client_) { |
| 975 receiving_client_->set_signaling_message_receiver(nullptr); | 973 receiving_client_->set_signaling_message_receiver(nullptr); |
| 976 } | 974 } |
| 977 } | 975 } |
| 978 | 976 |
| 979 bool CreateTestClients() { return CreateTestClients(nullptr, nullptr); } | 977 bool CreateTestClients() { return CreateTestClients(nullptr, nullptr); } |
| 980 | 978 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 rtc::scoped_ptr<PeerConnectionTestClient> receiving_client_; | 1144 rtc::scoped_ptr<PeerConnectionTestClient> receiving_client_; |
| 1147 }; | 1145 }; |
| 1148 | 1146 |
| 1149 // Disable for TSan v2, see | 1147 // Disable for TSan v2, see |
| 1150 // https://code.google.com/p/webrtc/issues/detail?id=1205 for details. | 1148 // https://code.google.com/p/webrtc/issues/detail?id=1205 for details. |
| 1151 #if !defined(THREAD_SANITIZER) | 1149 #if !defined(THREAD_SANITIZER) |
| 1152 | 1150 |
| 1153 // This test sets up a Jsep call between two parties and test Dtmf. | 1151 // This test sets up a Jsep call between two parties and test Dtmf. |
| 1154 // TODO(holmer): Disabled due to sometimes crashing on buildbots. | 1152 // TODO(holmer): Disabled due to sometimes crashing on buildbots. |
| 1155 // See issue webrtc/2378. | 1153 // See issue webrtc/2378. |
| 1156 TEST_F(JsepPeerConnectionP2PTestClient, DISABLED_LocalP2PTestDtmf) { | 1154 TEST_F(P2PTestConductor, DISABLED_LocalP2PTestDtmf) { |
| 1157 ASSERT_TRUE(CreateTestClients()); | 1155 ASSERT_TRUE(CreateTestClients()); |
| 1158 LocalP2PTest(); | 1156 LocalP2PTest(); |
| 1159 VerifyDtmf(); | 1157 VerifyDtmf(); |
| 1160 } | 1158 } |
| 1161 | 1159 |
| 1162 // This test sets up a Jsep call between two parties and test that we can get a | 1160 // This test sets up a Jsep call between two parties and test that we can get a |
| 1163 // video aspect ratio of 16:9. | 1161 // video aspect ratio of 16:9. |
| 1164 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTest16To9) { | 1162 TEST_F(P2PTestConductor, LocalP2PTest16To9) { |
| 1165 ASSERT_TRUE(CreateTestClients()); | 1163 ASSERT_TRUE(CreateTestClients()); |
| 1166 FakeConstraints constraint; | 1164 FakeConstraints constraint; |
| 1167 double requested_ratio = 640.0/360; | 1165 double requested_ratio = 640.0/360; |
| 1168 constraint.SetMandatoryMinAspectRatio(requested_ratio); | 1166 constraint.SetMandatoryMinAspectRatio(requested_ratio); |
| 1169 SetVideoConstraints(constraint, constraint); | 1167 SetVideoConstraints(constraint, constraint); |
| 1170 LocalP2PTest(); | 1168 LocalP2PTest(); |
| 1171 | 1169 |
| 1172 ASSERT_LE(0, initializing_client()->rendered_height()); | 1170 ASSERT_LE(0, initializing_client()->rendered_height()); |
| 1173 double initiating_video_ratio = | 1171 double initiating_video_ratio = |
| 1174 static_cast<double>(initializing_client()->rendered_width()) / | 1172 static_cast<double>(initializing_client()->rendered_width()) / |
| 1175 initializing_client()->rendered_height(); | 1173 initializing_client()->rendered_height(); |
| 1176 EXPECT_LE(requested_ratio, initiating_video_ratio); | 1174 EXPECT_LE(requested_ratio, initiating_video_ratio); |
| 1177 | 1175 |
| 1178 ASSERT_LE(0, receiving_client()->rendered_height()); | 1176 ASSERT_LE(0, receiving_client()->rendered_height()); |
| 1179 double receiving_video_ratio = | 1177 double receiving_video_ratio = |
| 1180 static_cast<double>(receiving_client()->rendered_width()) / | 1178 static_cast<double>(receiving_client()->rendered_width()) / |
| 1181 receiving_client()->rendered_height(); | 1179 receiving_client()->rendered_height(); |
| 1182 EXPECT_LE(requested_ratio, receiving_video_ratio); | 1180 EXPECT_LE(requested_ratio, receiving_video_ratio); |
| 1183 } | 1181 } |
| 1184 | 1182 |
| 1185 // This test sets up a Jsep call between two parties and test that the | 1183 // This test sets up a Jsep call between two parties and test that the |
| 1186 // received video has a resolution of 1280*720. | 1184 // received video has a resolution of 1280*720. |
| 1187 // TODO(mallinath): Enable when | 1185 // TODO(mallinath): Enable when |
| 1188 // http://code.google.com/p/webrtc/issues/detail?id=981 is fixed. | 1186 // http://code.google.com/p/webrtc/issues/detail?id=981 is fixed. |
| 1189 TEST_F(JsepPeerConnectionP2PTestClient, DISABLED_LocalP2PTest1280By720) { | 1187 TEST_F(P2PTestConductor, DISABLED_LocalP2PTest1280By720) { |
| 1190 ASSERT_TRUE(CreateTestClients()); | 1188 ASSERT_TRUE(CreateTestClients()); |
| 1191 FakeConstraints constraint; | 1189 FakeConstraints constraint; |
| 1192 constraint.SetMandatoryMinWidth(1280); | 1190 constraint.SetMandatoryMinWidth(1280); |
| 1193 constraint.SetMandatoryMinHeight(720); | 1191 constraint.SetMandatoryMinHeight(720); |
| 1194 SetVideoConstraints(constraint, constraint); | 1192 SetVideoConstraints(constraint, constraint); |
| 1195 LocalP2PTest(); | 1193 LocalP2PTest(); |
| 1196 VerifyRenderedSize(1280, 720); | 1194 VerifyRenderedSize(1280, 720); |
| 1197 } | 1195 } |
| 1198 | 1196 |
| 1199 // This test sets up a call between two endpoints that are configured to use | 1197 // This test sets up a call between two endpoints that are configured to use |
| 1200 // DTLS key agreement. As a result, DTLS is negotiated and used for transport. | 1198 // DTLS key agreement. As a result, DTLS is negotiated and used for transport. |
| 1201 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestDtls) { | 1199 TEST_F(P2PTestConductor, LocalP2PTestDtls) { |
| 1202 SetupAndVerifyDtlsCall(); | 1200 SetupAndVerifyDtlsCall(); |
| 1203 } | 1201 } |
| 1204 | 1202 |
| 1205 // This test sets up a audio call initially and then upgrades to audio/video, | 1203 // This test sets up a audio call initially and then upgrades to audio/video, |
| 1206 // using DTLS. | 1204 // using DTLS. |
| 1207 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestDtlsRenegotiate) { | 1205 TEST_F(P2PTestConductor, LocalP2PTestDtlsRenegotiate) { |
| 1208 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1206 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1209 FakeConstraints setup_constraints; | 1207 FakeConstraints setup_constraints; |
| 1210 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | 1208 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
| 1211 true); | 1209 true); |
| 1212 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1210 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1213 receiving_client()->SetReceiveAudioVideo(true, false); | 1211 receiving_client()->SetReceiveAudioVideo(true, false); |
| 1214 LocalP2PTest(); | 1212 LocalP2PTest(); |
| 1215 receiving_client()->SetReceiveAudioVideo(true, true); | 1213 receiving_client()->SetReceiveAudioVideo(true, true); |
| 1216 receiving_client()->Negotiate(); | 1214 receiving_client()->Negotiate(); |
| 1217 } | 1215 } |
| 1218 | 1216 |
| 1219 // This test sets up a call transfer to a new caller with a different DTLS | 1217 // This test sets up a call transfer to a new caller with a different DTLS |
| 1220 // fingerprint. | 1218 // fingerprint. |
| 1221 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestDtlsTransferCallee) { | 1219 TEST_F(P2PTestConductor, LocalP2PTestDtlsTransferCallee) { |
| 1222 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1220 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1223 SetupAndVerifyDtlsCall(); | 1221 SetupAndVerifyDtlsCall(); |
| 1224 | 1222 |
| 1225 // Keeping the original peer around which will still send packets to the | 1223 // Keeping the original peer around which will still send packets to the |
| 1226 // receiving client. These SRTP packets will be dropped. | 1224 // receiving client. These SRTP packets will be dropped. |
| 1227 rtc::scoped_ptr<PeerConnectionTestClient> original_peer( | 1225 rtc::scoped_ptr<PeerConnectionTestClient> original_peer( |
| 1228 set_initializing_client(CreateDtlsClientWithAlternateKey())); | 1226 set_initializing_client(CreateDtlsClientWithAlternateKey())); |
| 1229 original_peer->pc()->Close(); | 1227 original_peer->pc()->Close(); |
| 1230 | 1228 |
| 1231 SetSignalingReceivers(); | 1229 SetSignalingReceivers(); |
| 1232 receiving_client()->SetExpectIceRestart(true); | 1230 receiving_client()->SetExpectIceRestart(true); |
| 1233 LocalP2PTest(); | 1231 LocalP2PTest(); |
| 1234 VerifyRenderedSize(640, 480); | 1232 VerifyRenderedSize(640, 480); |
| 1235 } | 1233 } |
| 1236 | 1234 |
| 1237 // This test sets up a call transfer to a new callee with a different DTLS | 1235 // This test sets up a call transfer to a new callee with a different DTLS |
| 1238 // fingerprint. | 1236 // fingerprint. |
| 1239 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestDtlsTransferCaller) { | 1237 TEST_F(P2PTestConductor, LocalP2PTestDtlsTransferCaller) { |
| 1240 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1238 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1241 SetupAndVerifyDtlsCall(); | 1239 SetupAndVerifyDtlsCall(); |
| 1242 | 1240 |
| 1243 // Keeping the original peer around which will still send packets to the | 1241 // Keeping the original peer around which will still send packets to the |
| 1244 // receiving client. These SRTP packets will be dropped. | 1242 // receiving client. These SRTP packets will be dropped. |
| 1245 rtc::scoped_ptr<PeerConnectionTestClient> original_peer( | 1243 rtc::scoped_ptr<PeerConnectionTestClient> original_peer( |
| 1246 set_receiving_client(CreateDtlsClientWithAlternateKey())); | 1244 set_receiving_client(CreateDtlsClientWithAlternateKey())); |
| 1247 original_peer->pc()->Close(); | 1245 original_peer->pc()->Close(); |
| 1248 | 1246 |
| 1249 SetSignalingReceivers(); | 1247 SetSignalingReceivers(); |
| 1250 initializing_client()->IceRestart(); | 1248 initializing_client()->IceRestart(); |
| 1251 LocalP2PTest(); | 1249 LocalP2PTest(); |
| 1252 VerifyRenderedSize(640, 480); | 1250 VerifyRenderedSize(640, 480); |
| 1253 } | 1251 } |
| 1254 | 1252 |
| 1255 // This test sets up a call between two endpoints that are configured to use | 1253 // This test sets up a call between two endpoints that are configured to use |
| 1256 // DTLS key agreement. The offerer don't support SDES. As a result, DTLS is | 1254 // DTLS key agreement. The offerer don't support SDES. As a result, DTLS is |
| 1257 // negotiated and used for transport. | 1255 // negotiated and used for transport. |
| 1258 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestOfferDtlsButNotSdes) { | 1256 TEST_F(P2PTestConductor, LocalP2PTestOfferDtlsButNotSdes) { |
| 1259 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1257 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1260 FakeConstraints setup_constraints; | 1258 FakeConstraints setup_constraints; |
| 1261 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | 1259 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
| 1262 true); | 1260 true); |
| 1263 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1261 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1264 receiving_client()->RemoveSdesCryptoFromReceivedSdp(true); | 1262 receiving_client()->RemoveSdesCryptoFromReceivedSdp(true); |
| 1265 LocalP2PTest(); | 1263 LocalP2PTest(); |
| 1266 VerifyRenderedSize(640, 480); | 1264 VerifyRenderedSize(640, 480); |
| 1267 } | 1265 } |
| 1268 | 1266 |
| 1269 // This test sets up a Jsep call between two parties, and the callee only | 1267 // This test sets up a Jsep call between two parties, and the callee only |
| 1270 // accept to receive video. | 1268 // accept to receive video. |
| 1271 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestAnswerVideo) { | 1269 TEST_F(P2PTestConductor, LocalP2PTestAnswerVideo) { |
| 1272 ASSERT_TRUE(CreateTestClients()); | 1270 ASSERT_TRUE(CreateTestClients()); |
| 1273 receiving_client()->SetReceiveAudioVideo(false, true); | 1271 receiving_client()->SetReceiveAudioVideo(false, true); |
| 1274 LocalP2PTest(); | 1272 LocalP2PTest(); |
| 1275 } | 1273 } |
| 1276 | 1274 |
| 1277 // This test sets up a Jsep call between two parties, and the callee only | 1275 // This test sets up a Jsep call between two parties, and the callee only |
| 1278 // accept to receive audio. | 1276 // accept to receive audio. |
| 1279 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestAnswerAudio) { | 1277 TEST_F(P2PTestConductor, LocalP2PTestAnswerAudio) { |
| 1280 ASSERT_TRUE(CreateTestClients()); | 1278 ASSERT_TRUE(CreateTestClients()); |
| 1281 receiving_client()->SetReceiveAudioVideo(true, false); | 1279 receiving_client()->SetReceiveAudioVideo(true, false); |
| 1282 LocalP2PTest(); | 1280 LocalP2PTest(); |
| 1283 } | 1281 } |
| 1284 | 1282 |
| 1285 // This test sets up a Jsep call between two parties, and the callee reject both | 1283 // This test sets up a Jsep call between two parties, and the callee reject both |
| 1286 // audio and video. | 1284 // audio and video. |
| 1287 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestAnswerNone) { | 1285 TEST_F(P2PTestConductor, LocalP2PTestAnswerNone) { |
| 1288 ASSERT_TRUE(CreateTestClients()); | 1286 ASSERT_TRUE(CreateTestClients()); |
| 1289 receiving_client()->SetReceiveAudioVideo(false, false); | 1287 receiving_client()->SetReceiveAudioVideo(false, false); |
| 1290 LocalP2PTest(); | 1288 LocalP2PTest(); |
| 1291 } | 1289 } |
| 1292 | 1290 |
| 1293 // This test sets up an audio and video call between two parties. After the call | 1291 // This test sets up an audio and video call between two parties. After the call |
| 1294 // runs for a while (10 frames), the caller sends an update offer with video | 1292 // runs for a while (10 frames), the caller sends an update offer with video |
| 1295 // being rejected. Once the re-negotiation is done, the video flow should stop | 1293 // being rejected. Once the re-negotiation is done, the video flow should stop |
| 1296 // and the audio flow should continue. | 1294 // and the audio flow should continue. |
| 1297 // Disabled due to b/14955157. | 1295 // Disabled due to b/14955157. |
| 1298 TEST_F(JsepPeerConnectionP2PTestClient, | 1296 TEST_F(P2PTestConductor, DISABLED_UpdateOfferWithRejectedContent) { |
| 1299 DISABLED_UpdateOfferWithRejectedContent) { | |
| 1300 ASSERT_TRUE(CreateTestClients()); | 1297 ASSERT_TRUE(CreateTestClients()); |
| 1301 LocalP2PTest(); | 1298 LocalP2PTest(); |
| 1302 TestUpdateOfferWithRejectedContent(); | 1299 TestUpdateOfferWithRejectedContent(); |
| 1303 } | 1300 } |
| 1304 | 1301 |
| 1305 // This test sets up a Jsep call between two parties. The MSID is removed from | 1302 // This test sets up a Jsep call between two parties. The MSID is removed from |
| 1306 // the SDP strings from the caller. | 1303 // the SDP strings from the caller. |
| 1307 // Disabled due to b/14955157. | 1304 // Disabled due to b/14955157. |
| 1308 TEST_F(JsepPeerConnectionP2PTestClient, | 1305 TEST_F(P2PTestConductor, DISABLED_LocalP2PTestWithoutMsid) { |
| 1309 DISABLED_LocalP2PTestWithoutMsid) { | |
| 1310 ASSERT_TRUE(CreateTestClients()); | 1306 ASSERT_TRUE(CreateTestClients()); |
| 1311 receiving_client()->RemoveMsidFromReceivedSdp(true); | 1307 receiving_client()->RemoveMsidFromReceivedSdp(true); |
| 1312 // TODO(perkj): Currently there is a bug that cause audio to stop playing if | 1308 // TODO(perkj): Currently there is a bug that cause audio to stop playing if |
| 1313 // audio and video is muxed when MSID is disabled. Remove | 1309 // audio and video is muxed when MSID is disabled. Remove |
| 1314 // SetRemoveBundleFromSdp once | 1310 // SetRemoveBundleFromSdp once |
| 1315 // https://code.google.com/p/webrtc/issues/detail?id=1193 is fixed. | 1311 // https://code.google.com/p/webrtc/issues/detail?id=1193 is fixed. |
| 1316 receiving_client()->RemoveBundleFromReceivedSdp(true); | 1312 receiving_client()->RemoveBundleFromReceivedSdp(true); |
| 1317 LocalP2PTest(); | 1313 LocalP2PTest(); |
| 1318 } | 1314 } |
| 1319 | 1315 |
| 1320 // This test sets up a Jsep call between two parties and the initiating peer | 1316 // This test sets up a Jsep call between two parties and the initiating peer |
| 1321 // sends two steams. | 1317 // sends two steams. |
| 1322 // TODO(perkj): Disabled due to | 1318 // TODO(perkj): Disabled due to |
| 1323 // https://code.google.com/p/webrtc/issues/detail?id=1454 | 1319 // https://code.google.com/p/webrtc/issues/detail?id=1454 |
| 1324 TEST_F(JsepPeerConnectionP2PTestClient, DISABLED_LocalP2PTestTwoStreams) { | 1320 TEST_F(P2PTestConductor, DISABLED_LocalP2PTestTwoStreams) { |
| 1325 ASSERT_TRUE(CreateTestClients()); | 1321 ASSERT_TRUE(CreateTestClients()); |
| 1326 // Set optional video constraint to max 320pixels to decrease CPU usage. | 1322 // Set optional video constraint to max 320pixels to decrease CPU usage. |
| 1327 FakeConstraints constraint; | 1323 FakeConstraints constraint; |
| 1328 constraint.SetOptionalMaxWidth(320); | 1324 constraint.SetOptionalMaxWidth(320); |
| 1329 SetVideoConstraints(constraint, constraint); | 1325 SetVideoConstraints(constraint, constraint); |
| 1330 initializing_client()->AddMediaStream(true, true); | 1326 initializing_client()->AddMediaStream(true, true); |
| 1331 initializing_client()->AddMediaStream(false, true); | 1327 initializing_client()->AddMediaStream(false, true); |
| 1332 ASSERT_EQ(2u, initializing_client()->NumberOfLocalMediaStreams()); | 1328 ASSERT_EQ(2u, initializing_client()->NumberOfLocalMediaStreams()); |
| 1333 LocalP2PTest(); | 1329 LocalP2PTest(); |
| 1334 EXPECT_EQ(2u, receiving_client()->number_of_remote_streams()); | 1330 EXPECT_EQ(2u, receiving_client()->number_of_remote_streams()); |
| 1335 } | 1331 } |
| 1336 | 1332 |
| 1337 // Test that we can receive the audio output level from a remote audio track. | 1333 // Test that we can receive the audio output level from a remote audio track. |
| 1338 TEST_F(JsepPeerConnectionP2PTestClient, GetAudioOutputLevelStats) { | 1334 TEST_F(P2PTestConductor, GetAudioOutputLevelStats) { |
| 1339 ASSERT_TRUE(CreateTestClients()); | 1335 ASSERT_TRUE(CreateTestClients()); |
| 1340 LocalP2PTest(); | 1336 LocalP2PTest(); |
| 1341 | 1337 |
| 1342 StreamCollectionInterface* remote_streams = | 1338 StreamCollectionInterface* remote_streams = |
| 1343 initializing_client()->remote_streams(); | 1339 initializing_client()->remote_streams(); |
| 1344 ASSERT_GT(remote_streams->count(), 0u); | 1340 ASSERT_GT(remote_streams->count(), 0u); |
| 1345 ASSERT_GT(remote_streams->at(0)->GetAudioTracks().size(), 0u); | 1341 ASSERT_GT(remote_streams->at(0)->GetAudioTracks().size(), 0u); |
| 1346 MediaStreamTrackInterface* remote_audio_track = | 1342 MediaStreamTrackInterface* remote_audio_track = |
| 1347 remote_streams->at(0)->GetAudioTracks()[0]; | 1343 remote_streams->at(0)->GetAudioTracks()[0]; |
| 1348 | 1344 |
| 1349 // Get the audio output level stats. Note that the level is not available | 1345 // Get the audio output level stats. Note that the level is not available |
| 1350 // until a RTCP packet has been received. | 1346 // until a RTCP packet has been received. |
| 1351 EXPECT_TRUE_WAIT( | 1347 EXPECT_TRUE_WAIT( |
| 1352 initializing_client()->GetAudioOutputLevelStats(remote_audio_track) > 0, | 1348 initializing_client()->GetAudioOutputLevelStats(remote_audio_track) > 0, |
| 1353 kMaxWaitForStatsMs); | 1349 kMaxWaitForStatsMs); |
| 1354 } | 1350 } |
| 1355 | 1351 |
| 1356 // Test that an audio input level is reported. | 1352 // Test that an audio input level is reported. |
| 1357 TEST_F(JsepPeerConnectionP2PTestClient, GetAudioInputLevelStats) { | 1353 TEST_F(P2PTestConductor, GetAudioInputLevelStats) { |
| 1358 ASSERT_TRUE(CreateTestClients()); | 1354 ASSERT_TRUE(CreateTestClients()); |
| 1359 LocalP2PTest(); | 1355 LocalP2PTest(); |
| 1360 | 1356 |
| 1361 // Get the audio input level stats. The level should be available very | 1357 // Get the audio input level stats. The level should be available very |
| 1362 // soon after the test starts. | 1358 // soon after the test starts. |
| 1363 EXPECT_TRUE_WAIT(initializing_client()->GetAudioInputLevelStats() > 0, | 1359 EXPECT_TRUE_WAIT(initializing_client()->GetAudioInputLevelStats() > 0, |
| 1364 kMaxWaitForStatsMs); | 1360 kMaxWaitForStatsMs); |
| 1365 } | 1361 } |
| 1366 | 1362 |
| 1367 // Test that we can get incoming byte counts from both audio and video tracks. | 1363 // Test that we can get incoming byte counts from both audio and video tracks. |
| 1368 TEST_F(JsepPeerConnectionP2PTestClient, GetBytesReceivedStats) { | 1364 TEST_F(P2PTestConductor, GetBytesReceivedStats) { |
| 1369 ASSERT_TRUE(CreateTestClients()); | 1365 ASSERT_TRUE(CreateTestClients()); |
| 1370 LocalP2PTest(); | 1366 LocalP2PTest(); |
| 1371 | 1367 |
| 1372 StreamCollectionInterface* remote_streams = | 1368 StreamCollectionInterface* remote_streams = |
| 1373 initializing_client()->remote_streams(); | 1369 initializing_client()->remote_streams(); |
| 1374 ASSERT_GT(remote_streams->count(), 0u); | 1370 ASSERT_GT(remote_streams->count(), 0u); |
| 1375 ASSERT_GT(remote_streams->at(0)->GetAudioTracks().size(), 0u); | 1371 ASSERT_GT(remote_streams->at(0)->GetAudioTracks().size(), 0u); |
| 1376 MediaStreamTrackInterface* remote_audio_track = | 1372 MediaStreamTrackInterface* remote_audio_track = |
| 1377 remote_streams->at(0)->GetAudioTracks()[0]; | 1373 remote_streams->at(0)->GetAudioTracks()[0]; |
| 1378 EXPECT_TRUE_WAIT( | 1374 EXPECT_TRUE_WAIT( |
| 1379 initializing_client()->GetBytesReceivedStats(remote_audio_track) > 0, | 1375 initializing_client()->GetBytesReceivedStats(remote_audio_track) > 0, |
| 1380 kMaxWaitForStatsMs); | 1376 kMaxWaitForStatsMs); |
| 1381 | 1377 |
| 1382 MediaStreamTrackInterface* remote_video_track = | 1378 MediaStreamTrackInterface* remote_video_track = |
| 1383 remote_streams->at(0)->GetVideoTracks()[0]; | 1379 remote_streams->at(0)->GetVideoTracks()[0]; |
| 1384 EXPECT_TRUE_WAIT( | 1380 EXPECT_TRUE_WAIT( |
| 1385 initializing_client()->GetBytesReceivedStats(remote_video_track) > 0, | 1381 initializing_client()->GetBytesReceivedStats(remote_video_track) > 0, |
| 1386 kMaxWaitForStatsMs); | 1382 kMaxWaitForStatsMs); |
| 1387 } | 1383 } |
| 1388 | 1384 |
| 1389 // Test that we can get outgoing byte counts from both audio and video tracks. | 1385 // Test that we can get outgoing byte counts from both audio and video tracks. |
| 1390 TEST_F(JsepPeerConnectionP2PTestClient, GetBytesSentStats) { | 1386 TEST_F(P2PTestConductor, GetBytesSentStats) { |
| 1391 ASSERT_TRUE(CreateTestClients()); | 1387 ASSERT_TRUE(CreateTestClients()); |
| 1392 LocalP2PTest(); | 1388 LocalP2PTest(); |
| 1393 | 1389 |
| 1394 StreamCollectionInterface* local_streams = | 1390 StreamCollectionInterface* local_streams = |
| 1395 initializing_client()->local_streams(); | 1391 initializing_client()->local_streams(); |
| 1396 ASSERT_GT(local_streams->count(), 0u); | 1392 ASSERT_GT(local_streams->count(), 0u); |
| 1397 ASSERT_GT(local_streams->at(0)->GetAudioTracks().size(), 0u); | 1393 ASSERT_GT(local_streams->at(0)->GetAudioTracks().size(), 0u); |
| 1398 MediaStreamTrackInterface* local_audio_track = | 1394 MediaStreamTrackInterface* local_audio_track = |
| 1399 local_streams->at(0)->GetAudioTracks()[0]; | 1395 local_streams->at(0)->GetAudioTracks()[0]; |
| 1400 EXPECT_TRUE_WAIT( | 1396 EXPECT_TRUE_WAIT( |
| 1401 initializing_client()->GetBytesSentStats(local_audio_track) > 0, | 1397 initializing_client()->GetBytesSentStats(local_audio_track) > 0, |
| 1402 kMaxWaitForStatsMs); | 1398 kMaxWaitForStatsMs); |
| 1403 | 1399 |
| 1404 MediaStreamTrackInterface* local_video_track = | 1400 MediaStreamTrackInterface* local_video_track = |
| 1405 local_streams->at(0)->GetVideoTracks()[0]; | 1401 local_streams->at(0)->GetVideoTracks()[0]; |
| 1406 EXPECT_TRUE_WAIT( | 1402 EXPECT_TRUE_WAIT( |
| 1407 initializing_client()->GetBytesSentStats(local_video_track) > 0, | 1403 initializing_client()->GetBytesSentStats(local_video_track) > 0, |
| 1408 kMaxWaitForStatsMs); | 1404 kMaxWaitForStatsMs); |
| 1409 } | 1405 } |
| 1410 | 1406 |
| 1411 // Test that DTLS 1.0 is used if both sides only support DTLS 1.0. | 1407 // Test that DTLS 1.0 is used if both sides only support DTLS 1.0. |
| 1412 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12None) { | 1408 TEST_F(P2PTestConductor, GetDtls12None) { |
| 1413 PeerConnectionFactory::Options init_options; | 1409 PeerConnectionFactory::Options init_options; |
| 1414 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; | 1410 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; |
| 1415 PeerConnectionFactory::Options recv_options; | 1411 PeerConnectionFactory::Options recv_options; |
| 1416 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; | 1412 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; |
| 1417 ASSERT_TRUE( | 1413 ASSERT_TRUE( |
| 1418 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); | 1414 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); |
| 1419 rtc::scoped_refptr<webrtc::FakeMetricsObserver> | 1415 rtc::scoped_refptr<webrtc::FakeMetricsObserver> |
| 1420 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); | 1416 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); |
| 1421 initializing_client()->pc()->RegisterUMAObserver(init_observer); | 1417 initializing_client()->pc()->RegisterUMAObserver(init_observer); |
| 1422 LocalP2PTest(); | 1418 LocalP2PTest(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1433 | 1429 |
| 1434 EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(kDefaultSrtpCryptoSuite), | 1430 EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(kDefaultSrtpCryptoSuite), |
| 1435 initializing_client()->GetSrtpCipherStats(), | 1431 initializing_client()->GetSrtpCipherStats(), |
| 1436 kMaxWaitForStatsMs); | 1432 kMaxWaitForStatsMs); |
| 1437 EXPECT_EQ(1, | 1433 EXPECT_EQ(1, |
| 1438 init_observer->GetEnumCounter(webrtc::kEnumCounterAudioSrtpCipher, | 1434 init_observer->GetEnumCounter(webrtc::kEnumCounterAudioSrtpCipher, |
| 1439 kDefaultSrtpCryptoSuite)); | 1435 kDefaultSrtpCryptoSuite)); |
| 1440 } | 1436 } |
| 1441 | 1437 |
| 1442 // Test that DTLS 1.2 is used if both ends support it. | 1438 // Test that DTLS 1.2 is used if both ends support it. |
| 1443 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Both) { | 1439 TEST_F(P2PTestConductor, GetDtls12Both) { |
| 1444 PeerConnectionFactory::Options init_options; | 1440 PeerConnectionFactory::Options init_options; |
| 1445 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1441 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
| 1446 PeerConnectionFactory::Options recv_options; | 1442 PeerConnectionFactory::Options recv_options; |
| 1447 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1443 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
| 1448 ASSERT_TRUE( | 1444 ASSERT_TRUE( |
| 1449 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); | 1445 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); |
| 1450 rtc::scoped_refptr<webrtc::FakeMetricsObserver> | 1446 rtc::scoped_refptr<webrtc::FakeMetricsObserver> |
| 1451 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); | 1447 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); |
| 1452 initializing_client()->pc()->RegisterUMAObserver(init_observer); | 1448 initializing_client()->pc()->RegisterUMAObserver(init_observer); |
| 1453 LocalP2PTest(); | 1449 LocalP2PTest(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1465 EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(kDefaultSrtpCryptoSuite), | 1461 EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(kDefaultSrtpCryptoSuite), |
| 1466 initializing_client()->GetSrtpCipherStats(), | 1462 initializing_client()->GetSrtpCipherStats(), |
| 1467 kMaxWaitForStatsMs); | 1463 kMaxWaitForStatsMs); |
| 1468 EXPECT_EQ(1, | 1464 EXPECT_EQ(1, |
| 1469 init_observer->GetEnumCounter(webrtc::kEnumCounterAudioSrtpCipher, | 1465 init_observer->GetEnumCounter(webrtc::kEnumCounterAudioSrtpCipher, |
| 1470 kDefaultSrtpCryptoSuite)); | 1466 kDefaultSrtpCryptoSuite)); |
| 1471 } | 1467 } |
| 1472 | 1468 |
| 1473 // Test that DTLS 1.0 is used if the initator supports DTLS 1.2 and the | 1469 // Test that DTLS 1.0 is used if the initator supports DTLS 1.2 and the |
| 1474 // received supports 1.0. | 1470 // received supports 1.0. |
| 1475 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Init) { | 1471 TEST_F(P2PTestConductor, GetDtls12Init) { |
| 1476 PeerConnectionFactory::Options init_options; | 1472 PeerConnectionFactory::Options init_options; |
| 1477 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1473 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
| 1478 PeerConnectionFactory::Options recv_options; | 1474 PeerConnectionFactory::Options recv_options; |
| 1479 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; | 1475 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; |
| 1480 ASSERT_TRUE( | 1476 ASSERT_TRUE( |
| 1481 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); | 1477 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); |
| 1482 rtc::scoped_refptr<webrtc::FakeMetricsObserver> | 1478 rtc::scoped_refptr<webrtc::FakeMetricsObserver> |
| 1483 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); | 1479 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); |
| 1484 initializing_client()->pc()->RegisterUMAObserver(init_observer); | 1480 initializing_client()->pc()->RegisterUMAObserver(init_observer); |
| 1485 LocalP2PTest(); | 1481 LocalP2PTest(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1497 EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(kDefaultSrtpCryptoSuite), | 1493 EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(kDefaultSrtpCryptoSuite), |
| 1498 initializing_client()->GetSrtpCipherStats(), | 1494 initializing_client()->GetSrtpCipherStats(), |
| 1499 kMaxWaitForStatsMs); | 1495 kMaxWaitForStatsMs); |
| 1500 EXPECT_EQ(1, | 1496 EXPECT_EQ(1, |
| 1501 init_observer->GetEnumCounter(webrtc::kEnumCounterAudioSrtpCipher, | 1497 init_observer->GetEnumCounter(webrtc::kEnumCounterAudioSrtpCipher, |
| 1502 kDefaultSrtpCryptoSuite)); | 1498 kDefaultSrtpCryptoSuite)); |
| 1503 } | 1499 } |
| 1504 | 1500 |
| 1505 // Test that DTLS 1.0 is used if the initator supports DTLS 1.0 and the | 1501 // Test that DTLS 1.0 is used if the initator supports DTLS 1.0 and the |
| 1506 // received supports 1.2. | 1502 // received supports 1.2. |
| 1507 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Recv) { | 1503 TEST_F(P2PTestConductor, GetDtls12Recv) { |
| 1508 PeerConnectionFactory::Options init_options; | 1504 PeerConnectionFactory::Options init_options; |
| 1509 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; | 1505 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; |
| 1510 PeerConnectionFactory::Options recv_options; | 1506 PeerConnectionFactory::Options recv_options; |
| 1511 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1507 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
| 1512 ASSERT_TRUE( | 1508 ASSERT_TRUE( |
| 1513 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); | 1509 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); |
| 1514 rtc::scoped_refptr<webrtc::FakeMetricsObserver> | 1510 rtc::scoped_refptr<webrtc::FakeMetricsObserver> |
| 1515 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); | 1511 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); |
| 1516 initializing_client()->pc()->RegisterUMAObserver(init_observer); | 1512 initializing_client()->pc()->RegisterUMAObserver(init_observer); |
| 1517 LocalP2PTest(); | 1513 LocalP2PTest(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1529 EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(kDefaultSrtpCryptoSuite), | 1525 EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(kDefaultSrtpCryptoSuite), |
| 1530 initializing_client()->GetSrtpCipherStats(), | 1526 initializing_client()->GetSrtpCipherStats(), |
| 1531 kMaxWaitForStatsMs); | 1527 kMaxWaitForStatsMs); |
| 1532 EXPECT_EQ(1, | 1528 EXPECT_EQ(1, |
| 1533 init_observer->GetEnumCounter(webrtc::kEnumCounterAudioSrtpCipher, | 1529 init_observer->GetEnumCounter(webrtc::kEnumCounterAudioSrtpCipher, |
| 1534 kDefaultSrtpCryptoSuite)); | 1530 kDefaultSrtpCryptoSuite)); |
| 1535 } | 1531 } |
| 1536 | 1532 |
| 1537 // This test sets up a call between two parties with audio, video and an RTP | 1533 // This test sets up a call between two parties with audio, video and an RTP |
| 1538 // data channel. | 1534 // data channel. |
| 1539 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestRtpDataChannel) { | 1535 TEST_F(P2PTestConductor, LocalP2PTestRtpDataChannel) { |
| 1540 FakeConstraints setup_constraints; | 1536 FakeConstraints setup_constraints; |
| 1541 setup_constraints.SetAllowRtpDataChannels(); | 1537 setup_constraints.SetAllowRtpDataChannels(); |
| 1542 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1538 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1543 initializing_client()->CreateDataChannel(); | 1539 initializing_client()->CreateDataChannel(); |
| 1544 LocalP2PTest(); | 1540 LocalP2PTest(); |
| 1545 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); | 1541 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); |
| 1546 ASSERT_TRUE(receiving_client()->data_channel() != nullptr); | 1542 ASSERT_TRUE(receiving_client()->data_channel() != nullptr); |
| 1547 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), | 1543 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), |
| 1548 kMaxWaitMs); | 1544 kMaxWaitMs); |
| 1549 EXPECT_TRUE_WAIT(receiving_client()->data_observer()->IsOpen(), | 1545 EXPECT_TRUE_WAIT(receiving_client()->data_observer()->IsOpen(), |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1561 | 1557 |
| 1562 receiving_client()->data_channel()->Close(); | 1558 receiving_client()->data_channel()->Close(); |
| 1563 // Send new offer and answer. | 1559 // Send new offer and answer. |
| 1564 receiving_client()->Negotiate(); | 1560 receiving_client()->Negotiate(); |
| 1565 EXPECT_FALSE(initializing_client()->data_observer()->IsOpen()); | 1561 EXPECT_FALSE(initializing_client()->data_observer()->IsOpen()); |
| 1566 EXPECT_FALSE(receiving_client()->data_observer()->IsOpen()); | 1562 EXPECT_FALSE(receiving_client()->data_observer()->IsOpen()); |
| 1567 } | 1563 } |
| 1568 | 1564 |
| 1569 // This test sets up a call between two parties with audio, video and an SCTP | 1565 // This test sets up a call between two parties with audio, video and an SCTP |
| 1570 // data channel. | 1566 // data channel. |
| 1571 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestSctpDataChannel) { | 1567 TEST_F(P2PTestConductor, LocalP2PTestSctpDataChannel) { |
| 1572 ASSERT_TRUE(CreateTestClients()); | 1568 ASSERT_TRUE(CreateTestClients()); |
| 1573 initializing_client()->CreateDataChannel(); | 1569 initializing_client()->CreateDataChannel(); |
| 1574 LocalP2PTest(); | 1570 LocalP2PTest(); |
| 1575 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); | 1571 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); |
| 1576 EXPECT_TRUE_WAIT(receiving_client()->data_channel() != nullptr, kMaxWaitMs); | 1572 EXPECT_TRUE_WAIT(receiving_client()->data_channel() != nullptr, kMaxWaitMs); |
| 1577 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), | 1573 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), |
| 1578 kMaxWaitMs); | 1574 kMaxWaitMs); |
| 1579 EXPECT_TRUE_WAIT(receiving_client()->data_observer()->IsOpen(), kMaxWaitMs); | 1575 EXPECT_TRUE_WAIT(receiving_client()->data_observer()->IsOpen(), kMaxWaitMs); |
| 1580 | 1576 |
| 1581 std::string data = "hello world"; | 1577 std::string data = "hello world"; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1595 EXPECT_FALSE(receiving_client()->data_observer()->IsOpen()); | 1591 EXPECT_FALSE(receiving_client()->data_observer()->IsOpen()); |
| 1596 } | 1592 } |
| 1597 | 1593 |
| 1598 // This test sets up a call between two parties and creates a data channel. | 1594 // This test sets up a call between two parties and creates a data channel. |
| 1599 // The test tests that received data is buffered unless an observer has been | 1595 // The test tests that received data is buffered unless an observer has been |
| 1600 // registered. | 1596 // registered. |
| 1601 // Rtp data channels can receive data before the underlying | 1597 // Rtp data channels can receive data before the underlying |
| 1602 // transport has detected that a channel is writable and thus data can be | 1598 // transport has detected that a channel is writable and thus data can be |
| 1603 // received before the data channel state changes to open. That is hard to test | 1599 // received before the data channel state changes to open. That is hard to test |
| 1604 // but the same buffering is used in that case. | 1600 // but the same buffering is used in that case. |
| 1605 TEST_F(JsepPeerConnectionP2PTestClient, RegisterDataChannelObserver) { | 1601 TEST_F(P2PTestConductor, RegisterDataChannelObserver) { |
| 1606 FakeConstraints setup_constraints; | 1602 FakeConstraints setup_constraints; |
| 1607 setup_constraints.SetAllowRtpDataChannels(); | 1603 setup_constraints.SetAllowRtpDataChannels(); |
| 1608 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1604 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1609 initializing_client()->CreateDataChannel(); | 1605 initializing_client()->CreateDataChannel(); |
| 1610 initializing_client()->Negotiate(); | 1606 initializing_client()->Negotiate(); |
| 1611 | 1607 |
| 1612 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); | 1608 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); |
| 1613 ASSERT_TRUE(receiving_client()->data_channel() != nullptr); | 1609 ASSERT_TRUE(receiving_client()->data_channel() != nullptr); |
| 1614 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), | 1610 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), |
| 1615 kMaxWaitMs); | 1611 kMaxWaitMs); |
| 1616 EXPECT_EQ_WAIT(DataChannelInterface::kOpen, | 1612 EXPECT_EQ_WAIT(DataChannelInterface::kOpen, |
| 1617 receiving_client()->data_channel()->state(), kMaxWaitMs); | 1613 receiving_client()->data_channel()->state(), kMaxWaitMs); |
| 1618 | 1614 |
| 1619 // Unregister the existing observer. | 1615 // Unregister the existing observer. |
| 1620 receiving_client()->data_channel()->UnregisterObserver(); | 1616 receiving_client()->data_channel()->UnregisterObserver(); |
| 1621 | 1617 |
| 1622 std::string data = "hello world"; | 1618 std::string data = "hello world"; |
| 1623 SendRtpData(initializing_client()->data_channel(), data); | 1619 SendRtpData(initializing_client()->data_channel(), data); |
| 1624 | 1620 |
| 1625 // Wait a while to allow the sent data to arrive before an observer is | 1621 // Wait a while to allow the sent data to arrive before an observer is |
| 1626 // registered.. | 1622 // registered.. |
| 1627 rtc::Thread::Current()->ProcessMessages(100); | 1623 rtc::Thread::Current()->ProcessMessages(100); |
| 1628 | 1624 |
| 1629 MockDataChannelObserver new_observer(receiving_client()->data_channel()); | 1625 MockDataChannelObserver new_observer(receiving_client()->data_channel()); |
| 1630 EXPECT_EQ_WAIT(data, new_observer.last_message(), kMaxWaitMs); | 1626 EXPECT_EQ_WAIT(data, new_observer.last_message(), kMaxWaitMs); |
| 1631 } | 1627 } |
| 1632 | 1628 |
| 1633 // This test sets up a call between two parties with audio, video and but only | 1629 // This test sets up a call between two parties with audio, video and but only |
| 1634 // the initiating client support data. | 1630 // the initiating client support data. |
| 1635 TEST_F(JsepPeerConnectionP2PTestClient, | 1631 TEST_F(P2PTestConductor, LocalP2PTestReceiverDoesntSupportData) { |
| 1636 LocalP2PTestReceiverDoesntSupportData) { | |
| 1637 FakeConstraints setup_constraints_1; | 1632 FakeConstraints setup_constraints_1; |
| 1638 setup_constraints_1.SetAllowRtpDataChannels(); | 1633 setup_constraints_1.SetAllowRtpDataChannels(); |
| 1639 // Must disable DTLS to make negotiation succeed. | 1634 // Must disable DTLS to make negotiation succeed. |
| 1640 setup_constraints_1.SetMandatory( | 1635 setup_constraints_1.SetMandatory( |
| 1641 MediaConstraintsInterface::kEnableDtlsSrtp, false); | 1636 MediaConstraintsInterface::kEnableDtlsSrtp, false); |
| 1642 FakeConstraints setup_constraints_2; | 1637 FakeConstraints setup_constraints_2; |
| 1643 setup_constraints_2.SetMandatory( | 1638 setup_constraints_2.SetMandatory( |
| 1644 MediaConstraintsInterface::kEnableDtlsSrtp, false); | 1639 MediaConstraintsInterface::kEnableDtlsSrtp, false); |
| 1645 ASSERT_TRUE(CreateTestClients(&setup_constraints_1, &setup_constraints_2)); | 1640 ASSERT_TRUE(CreateTestClients(&setup_constraints_1, &setup_constraints_2)); |
| 1646 initializing_client()->CreateDataChannel(); | 1641 initializing_client()->CreateDataChannel(); |
| 1647 LocalP2PTest(); | 1642 LocalP2PTest(); |
| 1648 EXPECT_TRUE(initializing_client()->data_channel() != nullptr); | 1643 EXPECT_TRUE(initializing_client()->data_channel() != nullptr); |
| 1649 EXPECT_FALSE(receiving_client()->data_channel()); | 1644 EXPECT_FALSE(receiving_client()->data_channel()); |
| 1650 EXPECT_FALSE(initializing_client()->data_observer()->IsOpen()); | 1645 EXPECT_FALSE(initializing_client()->data_observer()->IsOpen()); |
| 1651 } | 1646 } |
| 1652 | 1647 |
| 1653 // This test sets up a call between two parties with audio, video. When audio | 1648 // This test sets up a call between two parties with audio, video. When audio |
| 1654 // and video is setup and flowing and data channel is negotiated. | 1649 // and video is setup and flowing and data channel is negotiated. |
| 1655 TEST_F(JsepPeerConnectionP2PTestClient, | 1650 TEST_F(P2PTestConductor, AddDataChannelAfterRenegotiation) { |
| 1656 AddDataChannelAfterRenegotiation) { | |
| 1657 FakeConstraints setup_constraints; | 1651 FakeConstraints setup_constraints; |
| 1658 setup_constraints.SetAllowRtpDataChannels(); | 1652 setup_constraints.SetAllowRtpDataChannels(); |
| 1659 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1653 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1660 LocalP2PTest(); | 1654 LocalP2PTest(); |
| 1661 initializing_client()->CreateDataChannel(); | 1655 initializing_client()->CreateDataChannel(); |
| 1662 // Send new offer and answer. | 1656 // Send new offer and answer. |
| 1663 initializing_client()->Negotiate(); | 1657 initializing_client()->Negotiate(); |
| 1664 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); | 1658 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); |
| 1665 ASSERT_TRUE(receiving_client()->data_channel() != nullptr); | 1659 ASSERT_TRUE(receiving_client()->data_channel() != nullptr); |
| 1666 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), | 1660 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), |
| 1667 kMaxWaitMs); | 1661 kMaxWaitMs); |
| 1668 EXPECT_TRUE_WAIT(receiving_client()->data_observer()->IsOpen(), | 1662 EXPECT_TRUE_WAIT(receiving_client()->data_observer()->IsOpen(), |
| 1669 kMaxWaitMs); | 1663 kMaxWaitMs); |
| 1670 } | 1664 } |
| 1671 | 1665 |
| 1672 // This test sets up a Jsep call with SCTP DataChannel and verifies the | 1666 // This test sets up a Jsep call with SCTP DataChannel and verifies the |
| 1673 // negotiation is completed without error. | 1667 // negotiation is completed without error. |
| 1674 #ifdef HAVE_SCTP | 1668 #ifdef HAVE_SCTP |
| 1675 TEST_F(JsepPeerConnectionP2PTestClient, CreateOfferWithSctpDataChannel) { | 1669 TEST_F(P2PTestConductor, CreateOfferWithSctpDataChannel) { |
| 1676 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1670 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1677 FakeConstraints constraints; | 1671 FakeConstraints constraints; |
| 1678 constraints.SetMandatory( | 1672 constraints.SetMandatory( |
| 1679 MediaConstraintsInterface::kEnableDtlsSrtp, true); | 1673 MediaConstraintsInterface::kEnableDtlsSrtp, true); |
| 1680 ASSERT_TRUE(CreateTestClients(&constraints, &constraints)); | 1674 ASSERT_TRUE(CreateTestClients(&constraints, &constraints)); |
| 1681 initializing_client()->CreateDataChannel(); | 1675 initializing_client()->CreateDataChannel(); |
| 1682 initializing_client()->Negotiate(false, false); | 1676 initializing_client()->Negotiate(false, false); |
| 1683 } | 1677 } |
| 1684 #endif | 1678 #endif |
| 1685 | 1679 |
| 1686 // This test sets up a call between two parties with audio, and video. | 1680 // This test sets up a call between two parties with audio, and video. |
| 1687 // During the call, the initializing side restart ice and the test verifies that | 1681 // During the call, the initializing side restart ice and the test verifies that |
| 1688 // new ice candidates are generated and audio and video still can flow. | 1682 // new ice candidates are generated and audio and video still can flow. |
| 1689 TEST_F(JsepPeerConnectionP2PTestClient, IceRestart) { | 1683 TEST_F(P2PTestConductor, IceRestart) { |
| 1690 ASSERT_TRUE(CreateTestClients()); | 1684 ASSERT_TRUE(CreateTestClients()); |
| 1691 | 1685 |
| 1692 // Negotiate and wait for ice completion and make sure audio and video plays. | 1686 // Negotiate and wait for ice completion and make sure audio and video plays. |
| 1693 LocalP2PTest(); | 1687 LocalP2PTest(); |
| 1694 | 1688 |
| 1695 // Create a SDP string of the first audio candidate for both clients. | 1689 // Create a SDP string of the first audio candidate for both clients. |
| 1696 const webrtc::IceCandidateCollection* audio_candidates_initiator = | 1690 const webrtc::IceCandidateCollection* audio_candidates_initiator = |
| 1697 initializing_client()->pc()->local_description()->candidates(0); | 1691 initializing_client()->pc()->local_description()->candidates(0); |
| 1698 const webrtc::IceCandidateCollection* audio_candidates_receiver = | 1692 const webrtc::IceCandidateCollection* audio_candidates_receiver = |
| 1699 receiving_client()->pc()->local_description()->candidates(0); | 1693 receiving_client()->pc()->local_description()->candidates(0); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1729 | 1723 |
| 1730 // Verify that the first candidates in the local session descriptions has | 1724 // Verify that the first candidates in the local session descriptions has |
| 1731 // changed. | 1725 // changed. |
| 1732 EXPECT_NE(initiator_candidate, initiator_candidate_restart); | 1726 EXPECT_NE(initiator_candidate, initiator_candidate_restart); |
| 1733 EXPECT_NE(receiver_candidate, receiver_candidate_restart); | 1727 EXPECT_NE(receiver_candidate, receiver_candidate_restart); |
| 1734 } | 1728 } |
| 1735 | 1729 |
| 1736 // This test sets up a call between two parties with audio, and video. | 1730 // This test sets up a call between two parties with audio, and video. |
| 1737 // It then renegotiates setting the video m-line to "port 0", then later | 1731 // It then renegotiates setting the video m-line to "port 0", then later |
| 1738 // renegotiates again, enabling video. | 1732 // renegotiates again, enabling video. |
| 1739 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestVideoDisableEnable) { | 1733 TEST_F(P2PTestConductor, LocalP2PTestVideoDisableEnable) { |
| 1740 ASSERT_TRUE(CreateTestClients()); | 1734 ASSERT_TRUE(CreateTestClients()); |
| 1741 | 1735 |
| 1742 // Do initial negotiation. Will result in video and audio sendonly m-lines. | 1736 // Do initial negotiation. Will result in video and audio sendonly m-lines. |
| 1743 receiving_client()->set_auto_add_stream(false); | 1737 receiving_client()->set_auto_add_stream(false); |
| 1744 initializing_client()->AddMediaStream(true, true); | 1738 initializing_client()->AddMediaStream(true, true); |
| 1745 initializing_client()->Negotiate(); | 1739 initializing_client()->Negotiate(); |
| 1746 | 1740 |
| 1747 // Negotiate again, disabling the video m-line (receiving client will | 1741 // Negotiate again, disabling the video m-line (receiving client will |
| 1748 // set port to 0 due to mandatory "OfferToReceiveVideo: false" constraint). | 1742 // set port to 0 due to mandatory "OfferToReceiveVideo: false" constraint). |
| 1749 receiving_client()->SetReceiveVideo(false); | 1743 receiving_client()->SetReceiveVideo(false); |
| 1750 initializing_client()->Negotiate(); | 1744 initializing_client()->Negotiate(); |
| 1751 | 1745 |
| 1752 // Enable video and do negotiation again, making sure video is received | 1746 // Enable video and do negotiation again, making sure video is received |
| 1753 // end-to-end. | 1747 // end-to-end. |
| 1754 receiving_client()->SetReceiveVideo(true); | 1748 receiving_client()->SetReceiveVideo(true); |
| 1755 receiving_client()->AddMediaStream(true, true); | 1749 receiving_client()->AddMediaStream(true, true); |
| 1756 LocalP2PTest(); | 1750 LocalP2PTest(); |
| 1757 } | 1751 } |
| 1758 | 1752 |
| 1759 // This test sets up a Jsep call between two parties with external | 1753 // This test sets up a Jsep call between two parties with external |
| 1760 // VideoDecoderFactory. | 1754 // VideoDecoderFactory. |
| 1761 // TODO(holmer): Disabled due to sometimes crashing on buildbots. | 1755 // TODO(holmer): Disabled due to sometimes crashing on buildbots. |
| 1762 // See issue webrtc/2378. | 1756 // See issue webrtc/2378. |
| 1763 TEST_F(JsepPeerConnectionP2PTestClient, | 1757 TEST_F(P2PTestConductor, DISABLED_LocalP2PTestWithVideoDecoderFactory) { |
| 1764 DISABLED_LocalP2PTestWithVideoDecoderFactory) { | |
| 1765 ASSERT_TRUE(CreateTestClients()); | 1758 ASSERT_TRUE(CreateTestClients()); |
| 1766 EnableVideoDecoderFactory(); | 1759 EnableVideoDecoderFactory(); |
| 1767 LocalP2PTest(); | 1760 LocalP2PTest(); |
| 1768 } | 1761 } |
| 1769 | 1762 |
| 1770 // This tests that if we negotiate after calling CreateSender but before we | 1763 // This tests that if we negotiate after calling CreateSender but before we |
| 1771 // have a track, then set a track later, frames from the newly-set track are | 1764 // have a track, then set a track later, frames from the newly-set track are |
| 1772 // received end-to-end. | 1765 // received end-to-end. |
| 1773 TEST_F(JsepPeerConnectionP2PTestClient, EarlyWarmupTest) { | 1766 TEST_F(P2PTestConductor, EarlyWarmupTest) { |
| 1774 ASSERT_TRUE(CreateTestClients()); | 1767 ASSERT_TRUE(CreateTestClients()); |
| 1775 auto audio_sender = initializing_client()->pc()->CreateSender("audio"); | 1768 auto audio_sender = initializing_client()->pc()->CreateSender("audio"); |
| 1776 auto video_sender = initializing_client()->pc()->CreateSender("video"); | 1769 auto video_sender = initializing_client()->pc()->CreateSender("video"); |
| 1777 initializing_client()->Negotiate(); | 1770 initializing_client()->Negotiate(); |
| 1778 // Wait for ICE connection to complete, without any tracks. | 1771 // Wait for ICE connection to complete, without any tracks. |
| 1779 // Note that the receiving client WILL (in HandleIncomingOffer) create | 1772 // Note that the receiving client WILL (in HandleIncomingOffer) create |
| 1780 // tracks, so it's only the initiator here that's doing early warmup. | 1773 // tracks, so it's only the initiator here that's doing early warmup. |
| 1781 ASSERT_TRUE_WAIT(SessionActive(), kMaxWaitForActivationMs); | 1774 ASSERT_TRUE_WAIT(SessionActive(), kMaxWaitForActivationMs); |
| 1782 VerifySessionDescriptions(); | 1775 VerifySessionDescriptions(); |
| 1783 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted, | 1776 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted, |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1965 server.urls.push_back("stun:hostname"); | 1958 server.urls.push_back("stun:hostname"); |
| 1966 server.urls.push_back("turn:hostname"); | 1959 server.urls.push_back("turn:hostname"); |
| 1967 servers.push_back(server); | 1960 servers.push_back(server); |
| 1968 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_configurations_, | 1961 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_configurations_, |
| 1969 &turn_configurations_)); | 1962 &turn_configurations_)); |
| 1970 EXPECT_EQ(1U, stun_configurations_.size()); | 1963 EXPECT_EQ(1U, stun_configurations_.size()); |
| 1971 EXPECT_EQ(1U, turn_configurations_.size()); | 1964 EXPECT_EQ(1U, turn_configurations_.size()); |
| 1972 } | 1965 } |
| 1973 | 1966 |
| 1974 #endif // if !defined(THREAD_SANITIZER) | 1967 #endif // if !defined(THREAD_SANITIZER) |
| OLD | NEW |