| 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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 bool remove_msid_ = false; // True if MSID should be removed in received SDP. | 839 bool remove_msid_ = false; // True if MSID should be removed in received SDP. |
| 840 bool remove_bundle_ = | 840 bool remove_bundle_ = |
| 841 false; // True if bundle should be removed in received SDP. | 841 false; // True if bundle should be removed in received SDP. |
| 842 bool remove_sdes_ = | 842 bool remove_sdes_ = |
| 843 false; // True if a=crypto should be removed in received SDP. | 843 false; // True if a=crypto should be removed in received SDP. |
| 844 | 844 |
| 845 rtc::scoped_refptr<DataChannelInterface> data_channel_; | 845 rtc::scoped_refptr<DataChannelInterface> data_channel_; |
| 846 rtc::scoped_ptr<MockDataChannelObserver> data_observer_; | 846 rtc::scoped_ptr<MockDataChannelObserver> data_observer_; |
| 847 }; | 847 }; |
| 848 | 848 |
| 849 class P2PTestConductor : public testing::Test { | 849 // TODO(deadbeef): Rename this to P2PTestConductor once the Linux memcheck and |
| 850 // Windows DrMemory Full bots' blacklists are updated. |
| 851 class JsepPeerConnectionP2PTestClient : public testing::Test { |
| 850 public: | 852 public: |
| 851 P2PTestConductor() | 853 JsepPeerConnectionP2PTestClient() |
| 852 : pss_(new rtc::PhysicalSocketServer), | 854 : pss_(new rtc::PhysicalSocketServer), |
| 853 ss_(new rtc::VirtualSocketServer(pss_.get())), | 855 ss_(new rtc::VirtualSocketServer(pss_.get())), |
| 854 ss_scope_(ss_.get()) {} | 856 ss_scope_(ss_.get()) {} |
| 855 | 857 |
| 856 bool SessionActive() { | 858 bool SessionActive() { |
| 857 return initiating_client_->SessionActive() && | 859 return initiating_client_->SessionActive() && |
| 858 receiving_client_->SessionActive(); | 860 receiving_client_->SessionActive(); |
| 859 } | 861 } |
| 860 | 862 |
| 861 // Return true if the number of frames provided have been received or it is | 863 // 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... |
| 896 EXPECT_EQ(height, initializing_client()->rendered_height()); | 898 EXPECT_EQ(height, initializing_client()->rendered_height()); |
| 897 } | 899 } |
| 898 | 900 |
| 899 void VerifySessionDescriptions() { | 901 void VerifySessionDescriptions() { |
| 900 initiating_client_->VerifyRejectedMediaInSessionDescription(); | 902 initiating_client_->VerifyRejectedMediaInSessionDescription(); |
| 901 receiving_client_->VerifyRejectedMediaInSessionDescription(); | 903 receiving_client_->VerifyRejectedMediaInSessionDescription(); |
| 902 initiating_client_->VerifyLocalIceUfragAndPassword(); | 904 initiating_client_->VerifyLocalIceUfragAndPassword(); |
| 903 receiving_client_->VerifyLocalIceUfragAndPassword(); | 905 receiving_client_->VerifyLocalIceUfragAndPassword(); |
| 904 } | 906 } |
| 905 | 907 |
| 906 ~P2PTestConductor() { | 908 ~JsepPeerConnectionP2PTestClient() { |
| 907 if (initiating_client_) { | 909 if (initiating_client_) { |
| 908 initiating_client_->set_signaling_message_receiver(nullptr); | 910 initiating_client_->set_signaling_message_receiver(nullptr); |
| 909 } | 911 } |
| 910 if (receiving_client_) { | 912 if (receiving_client_) { |
| 911 receiving_client_->set_signaling_message_receiver(nullptr); | 913 receiving_client_->set_signaling_message_receiver(nullptr); |
| 912 } | 914 } |
| 913 } | 915 } |
| 914 | 916 |
| 915 bool CreateTestClients() { return CreateTestClients(nullptr, nullptr); } | 917 bool CreateTestClients() { return CreateTestClients(nullptr, nullptr); } |
| 916 | 918 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 rtc::scoped_ptr<PeerConnectionTestClient> receiving_client_; | 1038 rtc::scoped_ptr<PeerConnectionTestClient> receiving_client_; |
| 1037 }; | 1039 }; |
| 1038 | 1040 |
| 1039 // Disable for TSan v2, see | 1041 // Disable for TSan v2, see |
| 1040 // https://code.google.com/p/webrtc/issues/detail?id=1205 for details. | 1042 // https://code.google.com/p/webrtc/issues/detail?id=1205 for details. |
| 1041 #if !defined(THREAD_SANITIZER) | 1043 #if !defined(THREAD_SANITIZER) |
| 1042 | 1044 |
| 1043 // This test sets up a Jsep call between two parties and test Dtmf. | 1045 // This test sets up a Jsep call between two parties and test Dtmf. |
| 1044 // TODO(holmer): Disabled due to sometimes crashing on buildbots. | 1046 // TODO(holmer): Disabled due to sometimes crashing on buildbots. |
| 1045 // See issue webrtc/2378. | 1047 // See issue webrtc/2378. |
| 1046 TEST_F(P2PTestConductor, DISABLED_LocalP2PTestDtmf) { | 1048 TEST_F(JsepPeerConnectionP2PTestClient, DISABLED_LocalP2PTestDtmf) { |
| 1047 ASSERT_TRUE(CreateTestClients()); | 1049 ASSERT_TRUE(CreateTestClients()); |
| 1048 LocalP2PTest(); | 1050 LocalP2PTest(); |
| 1049 VerifyDtmf(); | 1051 VerifyDtmf(); |
| 1050 } | 1052 } |
| 1051 | 1053 |
| 1052 // This test sets up a Jsep call between two parties and test that we can get a | 1054 // This test sets up a Jsep call between two parties and test that we can get a |
| 1053 // video aspect ratio of 16:9. | 1055 // video aspect ratio of 16:9. |
| 1054 TEST_F(P2PTestConductor, LocalP2PTest16To9) { | 1056 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTest16To9) { |
| 1055 ASSERT_TRUE(CreateTestClients()); | 1057 ASSERT_TRUE(CreateTestClients()); |
| 1056 FakeConstraints constraint; | 1058 FakeConstraints constraint; |
| 1057 double requested_ratio = 640.0/360; | 1059 double requested_ratio = 640.0/360; |
| 1058 constraint.SetMandatoryMinAspectRatio(requested_ratio); | 1060 constraint.SetMandatoryMinAspectRatio(requested_ratio); |
| 1059 SetVideoConstraints(constraint, constraint); | 1061 SetVideoConstraints(constraint, constraint); |
| 1060 LocalP2PTest(); | 1062 LocalP2PTest(); |
| 1061 | 1063 |
| 1062 ASSERT_LE(0, initializing_client()->rendered_height()); | 1064 ASSERT_LE(0, initializing_client()->rendered_height()); |
| 1063 double initiating_video_ratio = | 1065 double initiating_video_ratio = |
| 1064 static_cast<double>(initializing_client()->rendered_width()) / | 1066 static_cast<double>(initializing_client()->rendered_width()) / |
| 1065 initializing_client()->rendered_height(); | 1067 initializing_client()->rendered_height(); |
| 1066 EXPECT_LE(requested_ratio, initiating_video_ratio); | 1068 EXPECT_LE(requested_ratio, initiating_video_ratio); |
| 1067 | 1069 |
| 1068 ASSERT_LE(0, receiving_client()->rendered_height()); | 1070 ASSERT_LE(0, receiving_client()->rendered_height()); |
| 1069 double receiving_video_ratio = | 1071 double receiving_video_ratio = |
| 1070 static_cast<double>(receiving_client()->rendered_width()) / | 1072 static_cast<double>(receiving_client()->rendered_width()) / |
| 1071 receiving_client()->rendered_height(); | 1073 receiving_client()->rendered_height(); |
| 1072 EXPECT_LE(requested_ratio, receiving_video_ratio); | 1074 EXPECT_LE(requested_ratio, receiving_video_ratio); |
| 1073 } | 1075 } |
| 1074 | 1076 |
| 1075 // This test sets up a Jsep call between two parties and test that the | 1077 // This test sets up a Jsep call between two parties and test that the |
| 1076 // received video has a resolution of 1280*720. | 1078 // received video has a resolution of 1280*720. |
| 1077 // TODO(mallinath): Enable when | 1079 // TODO(mallinath): Enable when |
| 1078 // http://code.google.com/p/webrtc/issues/detail?id=981 is fixed. | 1080 // http://code.google.com/p/webrtc/issues/detail?id=981 is fixed. |
| 1079 TEST_F(P2PTestConductor, DISABLED_LocalP2PTest1280By720) { | 1081 TEST_F(JsepPeerConnectionP2PTestClient, DISABLED_LocalP2PTest1280By720) { |
| 1080 ASSERT_TRUE(CreateTestClients()); | 1082 ASSERT_TRUE(CreateTestClients()); |
| 1081 FakeConstraints constraint; | 1083 FakeConstraints constraint; |
| 1082 constraint.SetMandatoryMinWidth(1280); | 1084 constraint.SetMandatoryMinWidth(1280); |
| 1083 constraint.SetMandatoryMinHeight(720); | 1085 constraint.SetMandatoryMinHeight(720); |
| 1084 SetVideoConstraints(constraint, constraint); | 1086 SetVideoConstraints(constraint, constraint); |
| 1085 LocalP2PTest(); | 1087 LocalP2PTest(); |
| 1086 VerifyRenderedSize(1280, 720); | 1088 VerifyRenderedSize(1280, 720); |
| 1087 } | 1089 } |
| 1088 | 1090 |
| 1089 // This test sets up a call between two endpoints that are configured to use | 1091 // This test sets up a call between two endpoints that are configured to use |
| 1090 // DTLS key agreement. As a result, DTLS is negotiated and used for transport. | 1092 // DTLS key agreement. As a result, DTLS is negotiated and used for transport. |
| 1091 TEST_F(P2PTestConductor, LocalP2PTestDtls) { | 1093 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestDtls) { |
| 1092 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1094 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1093 FakeConstraints setup_constraints; | 1095 FakeConstraints setup_constraints; |
| 1094 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | 1096 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
| 1095 true); | 1097 true); |
| 1096 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1098 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1097 LocalP2PTest(); | 1099 LocalP2PTest(); |
| 1098 VerifyRenderedSize(640, 480); | 1100 VerifyRenderedSize(640, 480); |
| 1099 } | 1101 } |
| 1100 | 1102 |
| 1101 // This test sets up a audio call initially and then upgrades to audio/video, | 1103 // This test sets up a audio call initially and then upgrades to audio/video, |
| 1102 // using DTLS. | 1104 // using DTLS. |
| 1103 TEST_F(P2PTestConductor, LocalP2PTestDtlsRenegotiate) { | 1105 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestDtlsRenegotiate) { |
| 1104 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1106 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1105 FakeConstraints setup_constraints; | 1107 FakeConstraints setup_constraints; |
| 1106 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | 1108 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
| 1107 true); | 1109 true); |
| 1108 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1110 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1109 receiving_client()->SetReceiveAudioVideo(true, false); | 1111 receiving_client()->SetReceiveAudioVideo(true, false); |
| 1110 LocalP2PTest(); | 1112 LocalP2PTest(); |
| 1111 receiving_client()->SetReceiveAudioVideo(true, true); | 1113 receiving_client()->SetReceiveAudioVideo(true, true); |
| 1112 receiving_client()->Negotiate(); | 1114 receiving_client()->Negotiate(); |
| 1113 } | 1115 } |
| 1114 | 1116 |
| 1115 // This test sets up a call between two endpoints that are configured to use | 1117 // This test sets up a call between two endpoints that are configured to use |
| 1116 // DTLS key agreement. The offerer don't support SDES. As a result, DTLS is | 1118 // DTLS key agreement. The offerer don't support SDES. As a result, DTLS is |
| 1117 // negotiated and used for transport. | 1119 // negotiated and used for transport. |
| 1118 TEST_F(P2PTestConductor, LocalP2PTestOfferDtlsButNotSdes) { | 1120 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestOfferDtlsButNotSdes) { |
| 1119 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1121 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1120 FakeConstraints setup_constraints; | 1122 FakeConstraints setup_constraints; |
| 1121 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | 1123 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
| 1122 true); | 1124 true); |
| 1123 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1125 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1124 receiving_client()->RemoveSdesCryptoFromReceivedSdp(true); | 1126 receiving_client()->RemoveSdesCryptoFromReceivedSdp(true); |
| 1125 LocalP2PTest(); | 1127 LocalP2PTest(); |
| 1126 VerifyRenderedSize(640, 480); | 1128 VerifyRenderedSize(640, 480); |
| 1127 } | 1129 } |
| 1128 | 1130 |
| 1129 // This test sets up a Jsep call between two parties, and the callee only | 1131 // This test sets up a Jsep call between two parties, and the callee only |
| 1130 // accept to receive video. | 1132 // accept to receive video. |
| 1131 TEST_F(P2PTestConductor, LocalP2PTestAnswerVideo) { | 1133 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestAnswerVideo) { |
| 1132 ASSERT_TRUE(CreateTestClients()); | 1134 ASSERT_TRUE(CreateTestClients()); |
| 1133 receiving_client()->SetReceiveAudioVideo(false, true); | 1135 receiving_client()->SetReceiveAudioVideo(false, true); |
| 1134 LocalP2PTest(); | 1136 LocalP2PTest(); |
| 1135 } | 1137 } |
| 1136 | 1138 |
| 1137 // This test sets up a Jsep call between two parties, and the callee only | 1139 // This test sets up a Jsep call between two parties, and the callee only |
| 1138 // accept to receive audio. | 1140 // accept to receive audio. |
| 1139 TEST_F(P2PTestConductor, LocalP2PTestAnswerAudio) { | 1141 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestAnswerAudio) { |
| 1140 ASSERT_TRUE(CreateTestClients()); | 1142 ASSERT_TRUE(CreateTestClients()); |
| 1141 receiving_client()->SetReceiveAudioVideo(true, false); | 1143 receiving_client()->SetReceiveAudioVideo(true, false); |
| 1142 LocalP2PTest(); | 1144 LocalP2PTest(); |
| 1143 } | 1145 } |
| 1144 | 1146 |
| 1145 // This test sets up a Jsep call between two parties, and the callee reject both | 1147 // This test sets up a Jsep call between two parties, and the callee reject both |
| 1146 // audio and video. | 1148 // audio and video. |
| 1147 TEST_F(P2PTestConductor, LocalP2PTestAnswerNone) { | 1149 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestAnswerNone) { |
| 1148 ASSERT_TRUE(CreateTestClients()); | 1150 ASSERT_TRUE(CreateTestClients()); |
| 1149 receiving_client()->SetReceiveAudioVideo(false, false); | 1151 receiving_client()->SetReceiveAudioVideo(false, false); |
| 1150 LocalP2PTest(); | 1152 LocalP2PTest(); |
| 1151 } | 1153 } |
| 1152 | 1154 |
| 1153 // This test sets up an audio and video call between two parties. After the call | 1155 // This test sets up an audio and video call between two parties. After the call |
| 1154 // runs for a while (10 frames), the caller sends an update offer with video | 1156 // runs for a while (10 frames), the caller sends an update offer with video |
| 1155 // being rejected. Once the re-negotiation is done, the video flow should stop | 1157 // being rejected. Once the re-negotiation is done, the video flow should stop |
| 1156 // and the audio flow should continue. | 1158 // and the audio flow should continue. |
| 1157 // Disabled due to b/14955157. | 1159 // Disabled due to b/14955157. |
| 1158 TEST_F(P2PTestConductor, DISABLED_UpdateOfferWithRejectedContent) { | 1160 TEST_F(JsepPeerConnectionP2PTestClient, |
| 1161 DISABLED_UpdateOfferWithRejectedContent) { |
| 1159 ASSERT_TRUE(CreateTestClients()); | 1162 ASSERT_TRUE(CreateTestClients()); |
| 1160 LocalP2PTest(); | 1163 LocalP2PTest(); |
| 1161 TestUpdateOfferWithRejectedContent(); | 1164 TestUpdateOfferWithRejectedContent(); |
| 1162 } | 1165 } |
| 1163 | 1166 |
| 1164 // This test sets up a Jsep call between two parties. The MSID is removed from | 1167 // This test sets up a Jsep call between two parties. The MSID is removed from |
| 1165 // the SDP strings from the caller. | 1168 // the SDP strings from the caller. |
| 1166 // Disabled due to b/14955157. | 1169 // Disabled due to b/14955157. |
| 1167 TEST_F(P2PTestConductor, DISABLED_LocalP2PTestWithoutMsid) { | 1170 TEST_F(JsepPeerConnectionP2PTestClient, DISABLED_LocalP2PTestWithoutMsid) { |
| 1168 ASSERT_TRUE(CreateTestClients()); | 1171 ASSERT_TRUE(CreateTestClients()); |
| 1169 receiving_client()->RemoveMsidFromReceivedSdp(true); | 1172 receiving_client()->RemoveMsidFromReceivedSdp(true); |
| 1170 // TODO(perkj): Currently there is a bug that cause audio to stop playing if | 1173 // TODO(perkj): Currently there is a bug that cause audio to stop playing if |
| 1171 // audio and video is muxed when MSID is disabled. Remove | 1174 // audio and video is muxed when MSID is disabled. Remove |
| 1172 // SetRemoveBundleFromSdp once | 1175 // SetRemoveBundleFromSdp once |
| 1173 // https://code.google.com/p/webrtc/issues/detail?id=1193 is fixed. | 1176 // https://code.google.com/p/webrtc/issues/detail?id=1193 is fixed. |
| 1174 receiving_client()->RemoveBundleFromReceivedSdp(true); | 1177 receiving_client()->RemoveBundleFromReceivedSdp(true); |
| 1175 LocalP2PTest(); | 1178 LocalP2PTest(); |
| 1176 } | 1179 } |
| 1177 | 1180 |
| 1178 // This test sets up a Jsep call between two parties and the initiating peer | 1181 // This test sets up a Jsep call between two parties and the initiating peer |
| 1179 // sends two steams. | 1182 // sends two steams. |
| 1180 // TODO(perkj): Disabled due to | 1183 // TODO(perkj): Disabled due to |
| 1181 // https://code.google.com/p/webrtc/issues/detail?id=1454 | 1184 // https://code.google.com/p/webrtc/issues/detail?id=1454 |
| 1182 TEST_F(P2PTestConductor, DISABLED_LocalP2PTestTwoStreams) { | 1185 TEST_F(JsepPeerConnectionP2PTestClient, DISABLED_LocalP2PTestTwoStreams) { |
| 1183 ASSERT_TRUE(CreateTestClients()); | 1186 ASSERT_TRUE(CreateTestClients()); |
| 1184 // Set optional video constraint to max 320pixels to decrease CPU usage. | 1187 // Set optional video constraint to max 320pixels to decrease CPU usage. |
| 1185 FakeConstraints constraint; | 1188 FakeConstraints constraint; |
| 1186 constraint.SetOptionalMaxWidth(320); | 1189 constraint.SetOptionalMaxWidth(320); |
| 1187 SetVideoConstraints(constraint, constraint); | 1190 SetVideoConstraints(constraint, constraint); |
| 1188 initializing_client()->AddMediaStream(true, true); | 1191 initializing_client()->AddMediaStream(true, true); |
| 1189 initializing_client()->AddMediaStream(false, true); | 1192 initializing_client()->AddMediaStream(false, true); |
| 1190 ASSERT_EQ(2u, initializing_client()->NumberOfLocalMediaStreams()); | 1193 ASSERT_EQ(2u, initializing_client()->NumberOfLocalMediaStreams()); |
| 1191 LocalP2PTest(); | 1194 LocalP2PTest(); |
| 1192 EXPECT_EQ(2u, receiving_client()->number_of_remote_streams()); | 1195 EXPECT_EQ(2u, receiving_client()->number_of_remote_streams()); |
| 1193 } | 1196 } |
| 1194 | 1197 |
| 1195 // Test that we can receive the audio output level from a remote audio track. | 1198 // Test that we can receive the audio output level from a remote audio track. |
| 1196 TEST_F(P2PTestConductor, GetAudioOutputLevelStats) { | 1199 TEST_F(JsepPeerConnectionP2PTestClient, GetAudioOutputLevelStats) { |
| 1197 ASSERT_TRUE(CreateTestClients()); | 1200 ASSERT_TRUE(CreateTestClients()); |
| 1198 LocalP2PTest(); | 1201 LocalP2PTest(); |
| 1199 | 1202 |
| 1200 StreamCollectionInterface* remote_streams = | 1203 StreamCollectionInterface* remote_streams = |
| 1201 initializing_client()->remote_streams(); | 1204 initializing_client()->remote_streams(); |
| 1202 ASSERT_GT(remote_streams->count(), 0u); | 1205 ASSERT_GT(remote_streams->count(), 0u); |
| 1203 ASSERT_GT(remote_streams->at(0)->GetAudioTracks().size(), 0u); | 1206 ASSERT_GT(remote_streams->at(0)->GetAudioTracks().size(), 0u); |
| 1204 MediaStreamTrackInterface* remote_audio_track = | 1207 MediaStreamTrackInterface* remote_audio_track = |
| 1205 remote_streams->at(0)->GetAudioTracks()[0]; | 1208 remote_streams->at(0)->GetAudioTracks()[0]; |
| 1206 | 1209 |
| 1207 // Get the audio output level stats. Note that the level is not available | 1210 // Get the audio output level stats. Note that the level is not available |
| 1208 // until a RTCP packet has been received. | 1211 // until a RTCP packet has been received. |
| 1209 EXPECT_TRUE_WAIT( | 1212 EXPECT_TRUE_WAIT( |
| 1210 initializing_client()->GetAudioOutputLevelStats(remote_audio_track) > 0, | 1213 initializing_client()->GetAudioOutputLevelStats(remote_audio_track) > 0, |
| 1211 kMaxWaitForStatsMs); | 1214 kMaxWaitForStatsMs); |
| 1212 } | 1215 } |
| 1213 | 1216 |
| 1214 // Test that an audio input level is reported. | 1217 // Test that an audio input level is reported. |
| 1215 TEST_F(P2PTestConductor, GetAudioInputLevelStats) { | 1218 TEST_F(JsepPeerConnectionP2PTestClient, GetAudioInputLevelStats) { |
| 1216 ASSERT_TRUE(CreateTestClients()); | 1219 ASSERT_TRUE(CreateTestClients()); |
| 1217 LocalP2PTest(); | 1220 LocalP2PTest(); |
| 1218 | 1221 |
| 1219 // Get the audio input level stats. The level should be available very | 1222 // Get the audio input level stats. The level should be available very |
| 1220 // soon after the test starts. | 1223 // soon after the test starts. |
| 1221 EXPECT_TRUE_WAIT(initializing_client()->GetAudioInputLevelStats() > 0, | 1224 EXPECT_TRUE_WAIT(initializing_client()->GetAudioInputLevelStats() > 0, |
| 1222 kMaxWaitForStatsMs); | 1225 kMaxWaitForStatsMs); |
| 1223 } | 1226 } |
| 1224 | 1227 |
| 1225 // Test that we can get incoming byte counts from both audio and video tracks. | 1228 // Test that we can get incoming byte counts from both audio and video tracks. |
| 1226 TEST_F(P2PTestConductor, GetBytesReceivedStats) { | 1229 TEST_F(JsepPeerConnectionP2PTestClient, GetBytesReceivedStats) { |
| 1227 ASSERT_TRUE(CreateTestClients()); | 1230 ASSERT_TRUE(CreateTestClients()); |
| 1228 LocalP2PTest(); | 1231 LocalP2PTest(); |
| 1229 | 1232 |
| 1230 StreamCollectionInterface* remote_streams = | 1233 StreamCollectionInterface* remote_streams = |
| 1231 initializing_client()->remote_streams(); | 1234 initializing_client()->remote_streams(); |
| 1232 ASSERT_GT(remote_streams->count(), 0u); | 1235 ASSERT_GT(remote_streams->count(), 0u); |
| 1233 ASSERT_GT(remote_streams->at(0)->GetAudioTracks().size(), 0u); | 1236 ASSERT_GT(remote_streams->at(0)->GetAudioTracks().size(), 0u); |
| 1234 MediaStreamTrackInterface* remote_audio_track = | 1237 MediaStreamTrackInterface* remote_audio_track = |
| 1235 remote_streams->at(0)->GetAudioTracks()[0]; | 1238 remote_streams->at(0)->GetAudioTracks()[0]; |
| 1236 EXPECT_TRUE_WAIT( | 1239 EXPECT_TRUE_WAIT( |
| 1237 initializing_client()->GetBytesReceivedStats(remote_audio_track) > 0, | 1240 initializing_client()->GetBytesReceivedStats(remote_audio_track) > 0, |
| 1238 kMaxWaitForStatsMs); | 1241 kMaxWaitForStatsMs); |
| 1239 | 1242 |
| 1240 MediaStreamTrackInterface* remote_video_track = | 1243 MediaStreamTrackInterface* remote_video_track = |
| 1241 remote_streams->at(0)->GetVideoTracks()[0]; | 1244 remote_streams->at(0)->GetVideoTracks()[0]; |
| 1242 EXPECT_TRUE_WAIT( | 1245 EXPECT_TRUE_WAIT( |
| 1243 initializing_client()->GetBytesReceivedStats(remote_video_track) > 0, | 1246 initializing_client()->GetBytesReceivedStats(remote_video_track) > 0, |
| 1244 kMaxWaitForStatsMs); | 1247 kMaxWaitForStatsMs); |
| 1245 } | 1248 } |
| 1246 | 1249 |
| 1247 // Test that we can get outgoing byte counts from both audio and video tracks. | 1250 // Test that we can get outgoing byte counts from both audio and video tracks. |
| 1248 TEST_F(P2PTestConductor, GetBytesSentStats) { | 1251 TEST_F(JsepPeerConnectionP2PTestClient, GetBytesSentStats) { |
| 1249 ASSERT_TRUE(CreateTestClients()); | 1252 ASSERT_TRUE(CreateTestClients()); |
| 1250 LocalP2PTest(); | 1253 LocalP2PTest(); |
| 1251 | 1254 |
| 1252 StreamCollectionInterface* local_streams = | 1255 StreamCollectionInterface* local_streams = |
| 1253 initializing_client()->local_streams(); | 1256 initializing_client()->local_streams(); |
| 1254 ASSERT_GT(local_streams->count(), 0u); | 1257 ASSERT_GT(local_streams->count(), 0u); |
| 1255 ASSERT_GT(local_streams->at(0)->GetAudioTracks().size(), 0u); | 1258 ASSERT_GT(local_streams->at(0)->GetAudioTracks().size(), 0u); |
| 1256 MediaStreamTrackInterface* local_audio_track = | 1259 MediaStreamTrackInterface* local_audio_track = |
| 1257 local_streams->at(0)->GetAudioTracks()[0]; | 1260 local_streams->at(0)->GetAudioTracks()[0]; |
| 1258 EXPECT_TRUE_WAIT( | 1261 EXPECT_TRUE_WAIT( |
| 1259 initializing_client()->GetBytesSentStats(local_audio_track) > 0, | 1262 initializing_client()->GetBytesSentStats(local_audio_track) > 0, |
| 1260 kMaxWaitForStatsMs); | 1263 kMaxWaitForStatsMs); |
| 1261 | 1264 |
| 1262 MediaStreamTrackInterface* local_video_track = | 1265 MediaStreamTrackInterface* local_video_track = |
| 1263 local_streams->at(0)->GetVideoTracks()[0]; | 1266 local_streams->at(0)->GetVideoTracks()[0]; |
| 1264 EXPECT_TRUE_WAIT( | 1267 EXPECT_TRUE_WAIT( |
| 1265 initializing_client()->GetBytesSentStats(local_video_track) > 0, | 1268 initializing_client()->GetBytesSentStats(local_video_track) > 0, |
| 1266 kMaxWaitForStatsMs); | 1269 kMaxWaitForStatsMs); |
| 1267 } | 1270 } |
| 1268 | 1271 |
| 1269 // Test that DTLS 1.0 is used if both sides only support DTLS 1.0. | 1272 // Test that DTLS 1.0 is used if both sides only support DTLS 1.0. |
| 1270 TEST_F(P2PTestConductor, GetDtls12None) { | 1273 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12None) { |
| 1271 PeerConnectionFactory::Options init_options; | 1274 PeerConnectionFactory::Options init_options; |
| 1272 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; | 1275 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; |
| 1273 PeerConnectionFactory::Options recv_options; | 1276 PeerConnectionFactory::Options recv_options; |
| 1274 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; | 1277 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; |
| 1275 ASSERT_TRUE( | 1278 ASSERT_TRUE( |
| 1276 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); | 1279 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); |
| 1277 rtc::scoped_refptr<webrtc::FakeMetricsObserver> | 1280 rtc::scoped_refptr<webrtc::FakeMetricsObserver> |
| 1278 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); | 1281 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); |
| 1279 initializing_client()->pc()->RegisterUMAObserver(init_observer); | 1282 initializing_client()->pc()->RegisterUMAObserver(init_observer); |
| 1280 LocalP2PTest(); | 1283 LocalP2PTest(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1291 | 1294 |
| 1292 EXPECT_EQ_WAIT(kDefaultSrtpCipher, | 1295 EXPECT_EQ_WAIT(kDefaultSrtpCipher, |
| 1293 initializing_client()->GetSrtpCipherStats(), | 1296 initializing_client()->GetSrtpCipherStats(), |
| 1294 kMaxWaitForStatsMs); | 1297 kMaxWaitForStatsMs); |
| 1295 EXPECT_EQ(1, init_observer->GetEnumCounter( | 1298 EXPECT_EQ(1, init_observer->GetEnumCounter( |
| 1296 webrtc::kEnumCounterAudioSrtpCipher, | 1299 webrtc::kEnumCounterAudioSrtpCipher, |
| 1297 rtc::GetSrtpCryptoSuiteFromName(kDefaultSrtpCipher))); | 1300 rtc::GetSrtpCryptoSuiteFromName(kDefaultSrtpCipher))); |
| 1298 } | 1301 } |
| 1299 | 1302 |
| 1300 // Test that DTLS 1.2 is used if both ends support it. | 1303 // Test that DTLS 1.2 is used if both ends support it. |
| 1301 TEST_F(P2PTestConductor, GetDtls12Both) { | 1304 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Both) { |
| 1302 PeerConnectionFactory::Options init_options; | 1305 PeerConnectionFactory::Options init_options; |
| 1303 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1306 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
| 1304 PeerConnectionFactory::Options recv_options; | 1307 PeerConnectionFactory::Options recv_options; |
| 1305 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1308 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
| 1306 ASSERT_TRUE( | 1309 ASSERT_TRUE( |
| 1307 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); | 1310 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); |
| 1308 rtc::scoped_refptr<webrtc::FakeMetricsObserver> | 1311 rtc::scoped_refptr<webrtc::FakeMetricsObserver> |
| 1309 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); | 1312 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); |
| 1310 initializing_client()->pc()->RegisterUMAObserver(init_observer); | 1313 initializing_client()->pc()->RegisterUMAObserver(init_observer); |
| 1311 LocalP2PTest(); | 1314 LocalP2PTest(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1323 EXPECT_EQ_WAIT(kDefaultSrtpCipher, | 1326 EXPECT_EQ_WAIT(kDefaultSrtpCipher, |
| 1324 initializing_client()->GetSrtpCipherStats(), | 1327 initializing_client()->GetSrtpCipherStats(), |
| 1325 kMaxWaitForStatsMs); | 1328 kMaxWaitForStatsMs); |
| 1326 EXPECT_EQ(1, init_observer->GetEnumCounter( | 1329 EXPECT_EQ(1, init_observer->GetEnumCounter( |
| 1327 webrtc::kEnumCounterAudioSrtpCipher, | 1330 webrtc::kEnumCounterAudioSrtpCipher, |
| 1328 rtc::GetSrtpCryptoSuiteFromName(kDefaultSrtpCipher))); | 1331 rtc::GetSrtpCryptoSuiteFromName(kDefaultSrtpCipher))); |
| 1329 } | 1332 } |
| 1330 | 1333 |
| 1331 // Test that DTLS 1.0 is used if the initator supports DTLS 1.2 and the | 1334 // Test that DTLS 1.0 is used if the initator supports DTLS 1.2 and the |
| 1332 // received supports 1.0. | 1335 // received supports 1.0. |
| 1333 TEST_F(P2PTestConductor, GetDtls12Init) { | 1336 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Init) { |
| 1334 PeerConnectionFactory::Options init_options; | 1337 PeerConnectionFactory::Options init_options; |
| 1335 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1338 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
| 1336 PeerConnectionFactory::Options recv_options; | 1339 PeerConnectionFactory::Options recv_options; |
| 1337 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; | 1340 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; |
| 1338 ASSERT_TRUE( | 1341 ASSERT_TRUE( |
| 1339 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); | 1342 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); |
| 1340 rtc::scoped_refptr<webrtc::FakeMetricsObserver> | 1343 rtc::scoped_refptr<webrtc::FakeMetricsObserver> |
| 1341 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); | 1344 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); |
| 1342 initializing_client()->pc()->RegisterUMAObserver(init_observer); | 1345 initializing_client()->pc()->RegisterUMAObserver(init_observer); |
| 1343 LocalP2PTest(); | 1346 LocalP2PTest(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1355 EXPECT_EQ_WAIT(kDefaultSrtpCipher, | 1358 EXPECT_EQ_WAIT(kDefaultSrtpCipher, |
| 1356 initializing_client()->GetSrtpCipherStats(), | 1359 initializing_client()->GetSrtpCipherStats(), |
| 1357 kMaxWaitForStatsMs); | 1360 kMaxWaitForStatsMs); |
| 1358 EXPECT_EQ(1, init_observer->GetEnumCounter( | 1361 EXPECT_EQ(1, init_observer->GetEnumCounter( |
| 1359 webrtc::kEnumCounterAudioSrtpCipher, | 1362 webrtc::kEnumCounterAudioSrtpCipher, |
| 1360 rtc::GetSrtpCryptoSuiteFromName(kDefaultSrtpCipher))); | 1363 rtc::GetSrtpCryptoSuiteFromName(kDefaultSrtpCipher))); |
| 1361 } | 1364 } |
| 1362 | 1365 |
| 1363 // Test that DTLS 1.0 is used if the initator supports DTLS 1.0 and the | 1366 // Test that DTLS 1.0 is used if the initator supports DTLS 1.0 and the |
| 1364 // received supports 1.2. | 1367 // received supports 1.2. |
| 1365 TEST_F(P2PTestConductor, GetDtls12Recv) { | 1368 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Recv) { |
| 1366 PeerConnectionFactory::Options init_options; | 1369 PeerConnectionFactory::Options init_options; |
| 1367 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; | 1370 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; |
| 1368 PeerConnectionFactory::Options recv_options; | 1371 PeerConnectionFactory::Options recv_options; |
| 1369 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1372 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
| 1370 ASSERT_TRUE( | 1373 ASSERT_TRUE( |
| 1371 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); | 1374 CreateTestClients(nullptr, &init_options, nullptr, &recv_options)); |
| 1372 rtc::scoped_refptr<webrtc::FakeMetricsObserver> | 1375 rtc::scoped_refptr<webrtc::FakeMetricsObserver> |
| 1373 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); | 1376 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); |
| 1374 initializing_client()->pc()->RegisterUMAObserver(init_observer); | 1377 initializing_client()->pc()->RegisterUMAObserver(init_observer); |
| 1375 LocalP2PTest(); | 1378 LocalP2PTest(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1386 | 1389 |
| 1387 EXPECT_EQ_WAIT(kDefaultSrtpCipher, | 1390 EXPECT_EQ_WAIT(kDefaultSrtpCipher, |
| 1388 initializing_client()->GetSrtpCipherStats(), | 1391 initializing_client()->GetSrtpCipherStats(), |
| 1389 kMaxWaitForStatsMs); | 1392 kMaxWaitForStatsMs); |
| 1390 EXPECT_EQ(1, init_observer->GetEnumCounter( | 1393 EXPECT_EQ(1, init_observer->GetEnumCounter( |
| 1391 webrtc::kEnumCounterAudioSrtpCipher, | 1394 webrtc::kEnumCounterAudioSrtpCipher, |
| 1392 rtc::GetSrtpCryptoSuiteFromName(kDefaultSrtpCipher))); | 1395 rtc::GetSrtpCryptoSuiteFromName(kDefaultSrtpCipher))); |
| 1393 } | 1396 } |
| 1394 | 1397 |
| 1395 // This test sets up a call between two parties with audio, video and data. | 1398 // This test sets up a call between two parties with audio, video and data. |
| 1396 TEST_F(P2PTestConductor, LocalP2PTestDataChannel) { | 1399 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestDataChannel) { |
| 1397 FakeConstraints setup_constraints; | 1400 FakeConstraints setup_constraints; |
| 1398 setup_constraints.SetAllowRtpDataChannels(); | 1401 setup_constraints.SetAllowRtpDataChannels(); |
| 1399 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1402 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1400 initializing_client()->CreateDataChannel(); | 1403 initializing_client()->CreateDataChannel(); |
| 1401 LocalP2PTest(); | 1404 LocalP2PTest(); |
| 1402 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); | 1405 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); |
| 1403 ASSERT_TRUE(receiving_client()->data_channel() != nullptr); | 1406 ASSERT_TRUE(receiving_client()->data_channel() != nullptr); |
| 1404 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), | 1407 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), |
| 1405 kMaxWaitMs); | 1408 kMaxWaitMs); |
| 1406 EXPECT_TRUE_WAIT(receiving_client()->data_observer()->IsOpen(), | 1409 EXPECT_TRUE_WAIT(receiving_client()->data_observer()->IsOpen(), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1423 EXPECT_FALSE(receiving_client()->data_observer()->IsOpen()); | 1426 EXPECT_FALSE(receiving_client()->data_observer()->IsOpen()); |
| 1424 } | 1427 } |
| 1425 | 1428 |
| 1426 // This test sets up a call between two parties and creates a data channel. | 1429 // This test sets up a call between two parties and creates a data channel. |
| 1427 // The test tests that received data is buffered unless an observer has been | 1430 // The test tests that received data is buffered unless an observer has been |
| 1428 // registered. | 1431 // registered. |
| 1429 // Rtp data channels can receive data before the underlying | 1432 // Rtp data channels can receive data before the underlying |
| 1430 // transport has detected that a channel is writable and thus data can be | 1433 // transport has detected that a channel is writable and thus data can be |
| 1431 // received before the data channel state changes to open. That is hard to test | 1434 // received before the data channel state changes to open. That is hard to test |
| 1432 // but the same buffering is used in that case. | 1435 // but the same buffering is used in that case. |
| 1433 TEST_F(P2PTestConductor, RegisterDataChannelObserver) { | 1436 TEST_F(JsepPeerConnectionP2PTestClient, RegisterDataChannelObserver) { |
| 1434 FakeConstraints setup_constraints; | 1437 FakeConstraints setup_constraints; |
| 1435 setup_constraints.SetAllowRtpDataChannels(); | 1438 setup_constraints.SetAllowRtpDataChannels(); |
| 1436 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1439 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1437 initializing_client()->CreateDataChannel(); | 1440 initializing_client()->CreateDataChannel(); |
| 1438 initializing_client()->Negotiate(); | 1441 initializing_client()->Negotiate(); |
| 1439 | 1442 |
| 1440 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); | 1443 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); |
| 1441 ASSERT_TRUE(receiving_client()->data_channel() != nullptr); | 1444 ASSERT_TRUE(receiving_client()->data_channel() != nullptr); |
| 1442 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), | 1445 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), |
| 1443 kMaxWaitMs); | 1446 kMaxWaitMs); |
| 1444 EXPECT_EQ_WAIT(DataChannelInterface::kOpen, | 1447 EXPECT_EQ_WAIT(DataChannelInterface::kOpen, |
| 1445 receiving_client()->data_channel()->state(), kMaxWaitMs); | 1448 receiving_client()->data_channel()->state(), kMaxWaitMs); |
| 1446 | 1449 |
| 1447 // Unregister the existing observer. | 1450 // Unregister the existing observer. |
| 1448 receiving_client()->data_channel()->UnregisterObserver(); | 1451 receiving_client()->data_channel()->UnregisterObserver(); |
| 1449 | 1452 |
| 1450 std::string data = "hello world"; | 1453 std::string data = "hello world"; |
| 1451 SendRtpData(initializing_client()->data_channel(), data); | 1454 SendRtpData(initializing_client()->data_channel(), data); |
| 1452 | 1455 |
| 1453 // Wait a while to allow the sent data to arrive before an observer is | 1456 // Wait a while to allow the sent data to arrive before an observer is |
| 1454 // registered.. | 1457 // registered.. |
| 1455 rtc::Thread::Current()->ProcessMessages(100); | 1458 rtc::Thread::Current()->ProcessMessages(100); |
| 1456 | 1459 |
| 1457 MockDataChannelObserver new_observer(receiving_client()->data_channel()); | 1460 MockDataChannelObserver new_observer(receiving_client()->data_channel()); |
| 1458 EXPECT_EQ_WAIT(data, new_observer.last_message(), kMaxWaitMs); | 1461 EXPECT_EQ_WAIT(data, new_observer.last_message(), kMaxWaitMs); |
| 1459 } | 1462 } |
| 1460 | 1463 |
| 1461 // This test sets up a call between two parties with audio, video and but only | 1464 // This test sets up a call between two parties with audio, video and but only |
| 1462 // the initiating client support data. | 1465 // the initiating client support data. |
| 1463 TEST_F(P2PTestConductor, LocalP2PTestReceiverDoesntSupportData) { | 1466 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestReceiverDoesntSupportData) { |
| 1464 FakeConstraints setup_constraints_1; | 1467 FakeConstraints setup_constraints_1; |
| 1465 setup_constraints_1.SetAllowRtpDataChannels(); | 1468 setup_constraints_1.SetAllowRtpDataChannels(); |
| 1466 // Must disable DTLS to make negotiation succeed. | 1469 // Must disable DTLS to make negotiation succeed. |
| 1467 setup_constraints_1.SetMandatory( | 1470 setup_constraints_1.SetMandatory( |
| 1468 MediaConstraintsInterface::kEnableDtlsSrtp, false); | 1471 MediaConstraintsInterface::kEnableDtlsSrtp, false); |
| 1469 FakeConstraints setup_constraints_2; | 1472 FakeConstraints setup_constraints_2; |
| 1470 setup_constraints_2.SetMandatory( | 1473 setup_constraints_2.SetMandatory( |
| 1471 MediaConstraintsInterface::kEnableDtlsSrtp, false); | 1474 MediaConstraintsInterface::kEnableDtlsSrtp, false); |
| 1472 ASSERT_TRUE(CreateTestClients(&setup_constraints_1, &setup_constraints_2)); | 1475 ASSERT_TRUE(CreateTestClients(&setup_constraints_1, &setup_constraints_2)); |
| 1473 initializing_client()->CreateDataChannel(); | 1476 initializing_client()->CreateDataChannel(); |
| 1474 LocalP2PTest(); | 1477 LocalP2PTest(); |
| 1475 EXPECT_TRUE(initializing_client()->data_channel() != nullptr); | 1478 EXPECT_TRUE(initializing_client()->data_channel() != nullptr); |
| 1476 EXPECT_FALSE(receiving_client()->data_channel()); | 1479 EXPECT_FALSE(receiving_client()->data_channel()); |
| 1477 EXPECT_FALSE(initializing_client()->data_observer()->IsOpen()); | 1480 EXPECT_FALSE(initializing_client()->data_observer()->IsOpen()); |
| 1478 } | 1481 } |
| 1479 | 1482 |
| 1480 // This test sets up a call between two parties with audio, video. When audio | 1483 // This test sets up a call between two parties with audio, video. When audio |
| 1481 // and video is setup and flowing and data channel is negotiated. | 1484 // and video is setup and flowing and data channel is negotiated. |
| 1482 TEST_F(P2PTestConductor, AddDataChannelAfterRenegotiation) { | 1485 TEST_F(JsepPeerConnectionP2PTestClient, AddDataChannelAfterRenegotiation) { |
| 1483 FakeConstraints setup_constraints; | 1486 FakeConstraints setup_constraints; |
| 1484 setup_constraints.SetAllowRtpDataChannels(); | 1487 setup_constraints.SetAllowRtpDataChannels(); |
| 1485 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1488 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
| 1486 LocalP2PTest(); | 1489 LocalP2PTest(); |
| 1487 initializing_client()->CreateDataChannel(); | 1490 initializing_client()->CreateDataChannel(); |
| 1488 // Send new offer and answer. | 1491 // Send new offer and answer. |
| 1489 initializing_client()->Negotiate(); | 1492 initializing_client()->Negotiate(); |
| 1490 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); | 1493 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); |
| 1491 ASSERT_TRUE(receiving_client()->data_channel() != nullptr); | 1494 ASSERT_TRUE(receiving_client()->data_channel() != nullptr); |
| 1492 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), | 1495 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), |
| 1493 kMaxWaitMs); | 1496 kMaxWaitMs); |
| 1494 EXPECT_TRUE_WAIT(receiving_client()->data_observer()->IsOpen(), | 1497 EXPECT_TRUE_WAIT(receiving_client()->data_observer()->IsOpen(), |
| 1495 kMaxWaitMs); | 1498 kMaxWaitMs); |
| 1496 } | 1499 } |
| 1497 | 1500 |
| 1498 // This test sets up a Jsep call with SCTP DataChannel and verifies the | 1501 // This test sets up a Jsep call with SCTP DataChannel and verifies the |
| 1499 // negotiation is completed without error. | 1502 // negotiation is completed without error. |
| 1500 #ifdef HAVE_SCTP | 1503 #ifdef HAVE_SCTP |
| 1501 TEST_F(P2PTestConductor, CreateOfferWithSctpDataChannel) { | 1504 TEST_F(JsepPeerConnectionP2PTestClient, CreateOfferWithSctpDataChannel) { |
| 1502 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1505 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
| 1503 FakeConstraints constraints; | 1506 FakeConstraints constraints; |
| 1504 constraints.SetMandatory( | 1507 constraints.SetMandatory( |
| 1505 MediaConstraintsInterface::kEnableDtlsSrtp, true); | 1508 MediaConstraintsInterface::kEnableDtlsSrtp, true); |
| 1506 ASSERT_TRUE(CreateTestClients(&constraints, &constraints)); | 1509 ASSERT_TRUE(CreateTestClients(&constraints, &constraints)); |
| 1507 initializing_client()->CreateDataChannel(); | 1510 initializing_client()->CreateDataChannel(); |
| 1508 initializing_client()->Negotiate(false, false); | 1511 initializing_client()->Negotiate(false, false); |
| 1509 } | 1512 } |
| 1510 #endif | 1513 #endif |
| 1511 | 1514 |
| 1512 // This test sets up a call between two parties with audio, and video. | 1515 // This test sets up a call between two parties with audio, and video. |
| 1513 // During the call, the initializing side restart ice and the test verifies that | 1516 // During the call, the initializing side restart ice and the test verifies that |
| 1514 // new ice candidates are generated and audio and video still can flow. | 1517 // new ice candidates are generated and audio and video still can flow. |
| 1515 TEST_F(P2PTestConductor, IceRestart) { | 1518 TEST_F(JsepPeerConnectionP2PTestClient, IceRestart) { |
| 1516 ASSERT_TRUE(CreateTestClients()); | 1519 ASSERT_TRUE(CreateTestClients()); |
| 1517 | 1520 |
| 1518 // Negotiate and wait for ice completion and make sure audio and video plays. | 1521 // Negotiate and wait for ice completion and make sure audio and video plays. |
| 1519 LocalP2PTest(); | 1522 LocalP2PTest(); |
| 1520 | 1523 |
| 1521 // Create a SDP string of the first audio candidate for both clients. | 1524 // Create a SDP string of the first audio candidate for both clients. |
| 1522 const webrtc::IceCandidateCollection* audio_candidates_initiator = | 1525 const webrtc::IceCandidateCollection* audio_candidates_initiator = |
| 1523 initializing_client()->pc()->local_description()->candidates(0); | 1526 initializing_client()->pc()->local_description()->candidates(0); |
| 1524 const webrtc::IceCandidateCollection* audio_candidates_receiver = | 1527 const webrtc::IceCandidateCollection* audio_candidates_receiver = |
| 1525 receiving_client()->pc()->local_description()->candidates(0); | 1528 receiving_client()->pc()->local_description()->candidates(0); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1556 // Verify that the first candidates in the local session descriptions has | 1559 // Verify that the first candidates in the local session descriptions has |
| 1557 // changed. | 1560 // changed. |
| 1558 EXPECT_NE(initiator_candidate, initiator_candidate_restart); | 1561 EXPECT_NE(initiator_candidate, initiator_candidate_restart); |
| 1559 EXPECT_NE(receiver_candidate, receiver_candidate_restart); | 1562 EXPECT_NE(receiver_candidate, receiver_candidate_restart); |
| 1560 } | 1563 } |
| 1561 | 1564 |
| 1562 // This test sets up a Jsep call between two parties with external | 1565 // This test sets up a Jsep call between two parties with external |
| 1563 // VideoDecoderFactory. | 1566 // VideoDecoderFactory. |
| 1564 // TODO(holmer): Disabled due to sometimes crashing on buildbots. | 1567 // TODO(holmer): Disabled due to sometimes crashing on buildbots. |
| 1565 // See issue webrtc/2378. | 1568 // See issue webrtc/2378. |
| 1566 TEST_F(P2PTestConductor, DISABLED_LocalP2PTestWithVideoDecoderFactory) { | 1569 TEST_F(JsepPeerConnectionP2PTestClient, |
| 1570 DISABLED_LocalP2PTestWithVideoDecoderFactory) { |
| 1567 ASSERT_TRUE(CreateTestClients()); | 1571 ASSERT_TRUE(CreateTestClients()); |
| 1568 EnableVideoDecoderFactory(); | 1572 EnableVideoDecoderFactory(); |
| 1569 LocalP2PTest(); | 1573 LocalP2PTest(); |
| 1570 } | 1574 } |
| 1571 | 1575 |
| 1572 class IceServerParsingTest : public testing::Test { | 1576 class IceServerParsingTest : public testing::Test { |
| 1573 public: | 1577 public: |
| 1574 // Convenience for parsing a single URL. | 1578 // Convenience for parsing a single URL. |
| 1575 bool ParseUrl(const std::string& url) { | 1579 bool ParseUrl(const std::string& url) { |
| 1576 return ParseUrl(url, std::string(), std::string()); | 1580 return ParseUrl(url, std::string(), std::string()); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1739 server.urls.push_back("stun:hostname"); | 1743 server.urls.push_back("stun:hostname"); |
| 1740 server.urls.push_back("turn:hostname"); | 1744 server.urls.push_back("turn:hostname"); |
| 1741 servers.push_back(server); | 1745 servers.push_back(server); |
| 1742 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_configurations_, | 1746 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_configurations_, |
| 1743 &turn_configurations_)); | 1747 &turn_configurations_)); |
| 1744 EXPECT_EQ(1U, stun_configurations_.size()); | 1748 EXPECT_EQ(1U, stun_configurations_.size()); |
| 1745 EXPECT_EQ(1U, turn_configurations_.size()); | 1749 EXPECT_EQ(1U, turn_configurations_.size()); |
| 1746 } | 1750 } |
| 1747 | 1751 |
| 1748 #endif // if !defined(THREAD_SANITIZER) | 1752 #endif // if !defined(THREAD_SANITIZER) |
| OLD | NEW |