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

Side by Side Diff: webrtc/api/peerconnection_unittest.cc

Issue 1775033002: Changed defaults for CreateAnswer in non-constraint mode (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Review comments, bug fix Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/api/peerconnection.cc ('k') | webrtc/api/peerconnectioninterface_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 }; 148 };
149 149
150 class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, 150 class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
151 public SignalingMessageReceiver, 151 public SignalingMessageReceiver,
152 public ObserverInterface { 152 public ObserverInterface {
153 public: 153 public:
154 static PeerConnectionTestClient* CreateClientWithDtlsIdentityStore( 154 static PeerConnectionTestClient* CreateClientWithDtlsIdentityStore(
155 const std::string& id, 155 const std::string& id,
156 const MediaConstraintsInterface* constraints, 156 const MediaConstraintsInterface* constraints,
157 const PeerConnectionFactory::Options* options, 157 const PeerConnectionFactory::Options* options,
158 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store) { 158 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store,
159 bool prefer_constraint_apis) {
159 PeerConnectionTestClient* client(new PeerConnectionTestClient(id)); 160 PeerConnectionTestClient* client(new PeerConnectionTestClient(id));
160 if (!client->Init(constraints, options, std::move(dtls_identity_store))) { 161 if (!client->Init(constraints, options, std::move(dtls_identity_store),
162 prefer_constraint_apis)) {
161 delete client; 163 delete client;
162 return nullptr; 164 return nullptr;
163 } 165 }
164 return client; 166 return client;
165 } 167 }
166 168
167 static PeerConnectionTestClient* CreateClient( 169 static PeerConnectionTestClient* CreateClient(
168 const std::string& id, 170 const std::string& id,
169 const MediaConstraintsInterface* constraints, 171 const MediaConstraintsInterface* constraints,
170 const PeerConnectionFactory::Options* options) { 172 const PeerConnectionFactory::Options* options) {
171 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( 173 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store(
172 rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore() 174 rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore()
173 : nullptr); 175 : nullptr);
174 176
175 return CreateClientWithDtlsIdentityStore(id, constraints, options, 177 return CreateClientWithDtlsIdentityStore(
176 std::move(dtls_identity_store)); 178 id, constraints, options, std::move(dtls_identity_store), true);
179 }
180
181 static PeerConnectionTestClient* CreateClientPreferNoConstraints(
182 const std::string& id,
183 const PeerConnectionFactory::Options* options) {
184 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store(
185 rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore()
186 : nullptr);
187
188 return CreateClientWithDtlsIdentityStore(
189 id, nullptr, options, std::move(dtls_identity_store), false);
177 } 190 }
178 191
179 ~PeerConnectionTestClient() { 192 ~PeerConnectionTestClient() {
180 } 193 }
181 194
182 void Negotiate() { Negotiate(true, true); } 195 void Negotiate() { Negotiate(true, true); }
183 196
184 void Negotiate(bool audio, bool video) { 197 void Negotiate(bool audio, bool video) {
185 rtc::scoped_ptr<SessionDescriptionInterface> offer; 198 rtc::scoped_ptr<SessionDescriptionInterface> offer;
186 ASSERT_TRUE(DoCreateOffer(offer.use())); 199 ASSERT_TRUE(DoCreateOffer(offer.use()));
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 signaling_message_receiver_ = signaling_message_receiver; 342 signaling_message_receiver_ = signaling_message_receiver;
330 } 343 }
331 344
332 void EnableVideoDecoderFactory() { 345 void EnableVideoDecoderFactory() {
333 video_decoder_factory_enabled_ = true; 346 video_decoder_factory_enabled_ = true;
334 fake_video_decoder_factory_->AddSupportedVideoCodecType( 347 fake_video_decoder_factory_->AddSupportedVideoCodecType(
335 webrtc::kVideoCodecVP8); 348 webrtc::kVideoCodecVP8);
336 } 349 }
337 350
338 void IceRestart() { 351 void IceRestart() {
339 session_description_constraints_.SetMandatoryIceRestart(true); 352 offer_answer_constraints_.SetMandatoryIceRestart(true);
353 offer_answer_options_.ice_restart = true;
340 SetExpectIceRestart(true); 354 SetExpectIceRestart(true);
341 } 355 }
342 356
343 void SetExpectIceRestart(bool expect_restart) { 357 void SetExpectIceRestart(bool expect_restart) {
344 expect_ice_restart_ = expect_restart; 358 expect_ice_restart_ = expect_restart;
345 } 359 }
346 360
347 bool ExpectIceRestart() const { return expect_ice_restart_; } 361 bool ExpectIceRestart() const { return expect_ice_restart_; }
348 362
349 void SetReceiveAudioVideo(bool audio, bool video) { 363 void SetReceiveAudioVideo(bool audio, bool video) {
350 SetReceiveAudio(audio); 364 SetReceiveAudio(audio);
351 SetReceiveVideo(video); 365 SetReceiveVideo(video);
352 ASSERT_EQ(audio, can_receive_audio()); 366 ASSERT_EQ(audio, can_receive_audio());
353 ASSERT_EQ(video, can_receive_video()); 367 ASSERT_EQ(video, can_receive_video());
354 } 368 }
355 369
356 void SetReceiveAudio(bool audio) { 370 void SetReceiveAudio(bool audio) {
357 if (audio && can_receive_audio()) 371 if (audio && can_receive_audio())
358 return; 372 return;
359 session_description_constraints_.SetMandatoryReceiveAudio(audio); 373 offer_answer_constraints_.SetMandatoryReceiveAudio(audio);
374 offer_answer_options_.offer_to_receive_audio = audio ? 1 : 0;
360 } 375 }
361 376
362 void SetReceiveVideo(bool video) { 377 void SetReceiveVideo(bool video) {
363 if (video && can_receive_video()) 378 if (video && can_receive_video())
364 return; 379 return;
365 session_description_constraints_.SetMandatoryReceiveVideo(video); 380 offer_answer_constraints_.SetMandatoryReceiveVideo(video);
381 offer_answer_options_.offer_to_receive_video = video ? 1 : 0;
366 } 382 }
367 383
368 void RemoveMsidFromReceivedSdp(bool remove) { remove_msid_ = remove; } 384 void RemoveMsidFromReceivedSdp(bool remove) { remove_msid_ = remove; }
369 385
370 void RemoveSdesCryptoFromReceivedSdp(bool remove) { remove_sdes_ = remove; } 386 void RemoveSdesCryptoFromReceivedSdp(bool remove) { remove_sdes_ = remove; }
371 387
372 void RemoveBundleFromReceivedSdp(bool remove) { remove_bundle_ = remove; } 388 void RemoveBundleFromReceivedSdp(bool remove) { remove_bundle_ = remove; }
373 389
374 bool can_receive_audio() { 390 bool can_receive_audio() {
375 bool value; 391 bool value;
376 if (webrtc::FindConstraint(&session_description_constraints_, 392 if (prefer_constraint_apis_) {
377 MediaConstraintsInterface::kOfferToReceiveAudio, 393 if (webrtc::FindConstraint(
378 &value, nullptr)) { 394 &offer_answer_constraints_,
379 return value; 395 MediaConstraintsInterface::kOfferToReceiveAudio, &value,
396 nullptr)) {
397 return value;
398 }
399 return true;
380 } 400 }
381 return true; 401 return offer_answer_options_.offer_to_receive_audio > 0 ||
402 offer_answer_options_.offer_to_receive_audio ==
403 PeerConnectionInterface::RTCOfferAnswerOptions::kUndefined;
382 } 404 }
383 405
384 bool can_receive_video() { 406 bool can_receive_video() {
385 bool value; 407 bool value;
386 if (webrtc::FindConstraint(&session_description_constraints_, 408 if (prefer_constraint_apis_) {
387 MediaConstraintsInterface::kOfferToReceiveVideo, 409 if (webrtc::FindConstraint(
388 &value, nullptr)) { 410 &offer_answer_constraints_,
389 return value; 411 MediaConstraintsInterface::kOfferToReceiveVideo, &value,
412 nullptr)) {
413 return value;
414 }
415 return true;
390 } 416 }
391 return true; 417 return offer_answer_options_.offer_to_receive_video > 0 ||
418 offer_answer_options_.offer_to_receive_video ==
419 PeerConnectionInterface::RTCOfferAnswerOptions::kUndefined;
392 } 420 }
393 421
394 void OnDataChannel(DataChannelInterface* data_channel) override { 422 void OnDataChannel(DataChannelInterface* data_channel) override {
395 LOG(INFO) << id_ << "OnDataChannel"; 423 LOG(INFO) << id_ << "OnDataChannel";
396 data_channel_ = data_channel; 424 data_channel_ = data_channel;
397 data_observer_.reset(new MockDataChannelObserver(data_channel)); 425 data_observer_.reset(new MockDataChannelObserver(data_channel));
398 } 426 }
399 427
400 void CreateDataChannel() { 428 void CreateDataChannel() {
401 data_channel_ = pc()->CreateDataChannel(kDataChannelLabel, nullptr); 429 data_channel_ = pc()->CreateDataChannel(kDataChannelLabel, nullptr);
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 private: 766 private:
739 bool completed_; 767 bool completed_;
740 std::vector<std::string> tones_; 768 std::vector<std::string> tones_;
741 }; 769 };
742 770
743 explicit PeerConnectionTestClient(const std::string& id) : id_(id) {} 771 explicit PeerConnectionTestClient(const std::string& id) : id_(id) {}
744 772
745 bool Init( 773 bool Init(
746 const MediaConstraintsInterface* constraints, 774 const MediaConstraintsInterface* constraints,
747 const PeerConnectionFactory::Options* options, 775 const PeerConnectionFactory::Options* options,
748 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store) { 776 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store,
777 bool prefer_constraint_apis) {
749 EXPECT_TRUE(!peer_connection_); 778 EXPECT_TRUE(!peer_connection_);
750 EXPECT_TRUE(!peer_connection_factory_); 779 EXPECT_TRUE(!peer_connection_factory_);
780 if (!prefer_constraint_apis) {
781 EXPECT_TRUE(!constraints);
782 }
783 prefer_constraint_apis_ = prefer_constraint_apis;
784
751 rtc::scoped_ptr<cricket::PortAllocator> port_allocator( 785 rtc::scoped_ptr<cricket::PortAllocator> port_allocator(
752 new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr)); 786 new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr));
753 fake_audio_capture_module_ = FakeAudioCaptureModule::Create(); 787 fake_audio_capture_module_ = FakeAudioCaptureModule::Create();
754 788
755 if (fake_audio_capture_module_ == nullptr) { 789 if (fake_audio_capture_module_ == nullptr) {
756 return false; 790 return false;
757 } 791 }
758 fake_video_decoder_factory_ = new FakeWebRtcVideoDecoderFactory(); 792 fake_video_decoder_factory_ = new FakeWebRtcVideoDecoderFactory();
759 fake_video_encoder_factory_ = new FakeWebRtcVideoEncoderFactory(); 793 fake_video_encoder_factory_ = new FakeWebRtcVideoEncoderFactory();
760 peer_connection_factory_ = webrtc::CreatePeerConnectionFactory( 794 peer_connection_factory_ = webrtc::CreatePeerConnectionFactory(
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 rtc::scoped_ptr<SessionDescriptionInterface> desc( 846 rtc::scoped_ptr<SessionDescriptionInterface> desc(
813 webrtc::CreateSessionDescription("answer", msg, nullptr)); 847 webrtc::CreateSessionDescription("answer", msg, nullptr));
814 EXPECT_TRUE(DoSetRemoteDescription(desc.release())); 848 EXPECT_TRUE(DoSetRemoteDescription(desc.release()));
815 } 849 }
816 850
817 bool DoCreateOfferAnswer(SessionDescriptionInterface** desc, 851 bool DoCreateOfferAnswer(SessionDescriptionInterface** desc,
818 bool offer) { 852 bool offer) {
819 rtc::scoped_refptr<MockCreateSessionDescriptionObserver> 853 rtc::scoped_refptr<MockCreateSessionDescriptionObserver>
820 observer(new rtc::RefCountedObject< 854 observer(new rtc::RefCountedObject<
821 MockCreateSessionDescriptionObserver>()); 855 MockCreateSessionDescriptionObserver>());
822 if (offer) { 856 if (prefer_constraint_apis_) {
823 pc()->CreateOffer(observer, &session_description_constraints_); 857 if (offer) {
858 pc()->CreateOffer(observer, &offer_answer_constraints_);
859 } else {
860 pc()->CreateAnswer(observer, &offer_answer_constraints_);
861 }
824 } else { 862 } else {
825 pc()->CreateAnswer(observer, &session_description_constraints_); 863 if (offer) {
864 pc()->CreateOffer(observer, offer_answer_options_);
865 } else {
866 pc()->CreateAnswer(observer, offer_answer_options_);
867 }
826 } 868 }
827 EXPECT_EQ_WAIT(true, observer->called(), kMaxWaitMs); 869 EXPECT_EQ_WAIT(true, observer->called(), kMaxWaitMs);
828 *desc = observer->release_desc(); 870 *desc = observer->release_desc();
829 if (observer->result() && ExpectIceRestart()) { 871 if (observer->result() && ExpectIceRestart()) {
830 EXPECT_EQ(0u, (*desc)->candidates(0)->count()); 872 EXPECT_EQ(0u, (*desc)->candidates(0)->count());
831 } 873 }
832 return observer->result(); 874 return observer->result();
833 } 875 }
834 876
835 bool DoCreateOffer(SessionDescriptionInterface** desc) { 877 bool DoCreateOffer(SessionDescriptionInterface** desc) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 RemoveLinesFromSdp(kSdpSdesCryptoAttribute, sdp); 930 RemoveLinesFromSdp(kSdpSdesCryptoAttribute, sdp);
889 } 931 }
890 } 932 }
891 933
892 std::string id_; 934 std::string id_;
893 935
894 rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_; 936 rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
895 rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> 937 rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
896 peer_connection_factory_; 938 peer_connection_factory_;
897 939
940 bool prefer_constraint_apis_ = true;
898 bool auto_add_stream_ = true; 941 bool auto_add_stream_ = true;
899 942
900 typedef std::pair<std::string, std::string> IceUfragPwdPair; 943 typedef std::pair<std::string, std::string> IceUfragPwdPair;
901 std::map<int, IceUfragPwdPair> ice_ufrag_pwd_; 944 std::map<int, IceUfragPwdPair> ice_ufrag_pwd_;
902 bool expect_ice_restart_ = false; 945 bool expect_ice_restart_ = false;
903 946
904 // Needed to keep track of number of frames sent. 947 // Needed to keep track of number of frames sent.
905 rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_; 948 rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_;
906 // Needed to keep track of number of frames received. 949 // Needed to keep track of number of frames received.
907 std::map<std::string, rtc::scoped_ptr<webrtc::FakeVideoTrackRenderer>> 950 std::map<std::string, rtc::scoped_ptr<webrtc::FakeVideoTrackRenderer>>
908 fake_video_renderers_; 951 fake_video_renderers_;
909 // Needed to ensure frames aren't received for removed tracks. 952 // Needed to ensure frames aren't received for removed tracks.
910 std::vector<rtc::scoped_ptr<webrtc::FakeVideoTrackRenderer>> 953 std::vector<rtc::scoped_ptr<webrtc::FakeVideoTrackRenderer>>
911 removed_fake_video_renderers_; 954 removed_fake_video_renderers_;
912 // Needed to keep track of number of frames received when external decoder 955 // Needed to keep track of number of frames received when external decoder
913 // used. 956 // used.
914 FakeWebRtcVideoDecoderFactory* fake_video_decoder_factory_ = nullptr; 957 FakeWebRtcVideoDecoderFactory* fake_video_decoder_factory_ = nullptr;
915 FakeWebRtcVideoEncoderFactory* fake_video_encoder_factory_ = nullptr; 958 FakeWebRtcVideoEncoderFactory* fake_video_encoder_factory_ = nullptr;
916 bool video_decoder_factory_enabled_ = false; 959 bool video_decoder_factory_enabled_ = false;
917 webrtc::FakeConstraints video_constraints_; 960 webrtc::FakeConstraints video_constraints_;
918 961
919 // For remote peer communication. 962 // For remote peer communication.
920 SignalingMessageReceiver* signaling_message_receiver_ = nullptr; 963 SignalingMessageReceiver* signaling_message_receiver_ = nullptr;
921 964
922 // Store references to the video capturers we've created, so that we can stop 965 // Store references to the video capturers we've created, so that we can stop
923 // them, if required. 966 // them, if required.
924 std::vector<cricket::VideoCapturer*> video_capturers_; 967 std::vector<cricket::VideoCapturer*> video_capturers_;
925 968
926 webrtc::FakeConstraints session_description_constraints_; 969 webrtc::FakeConstraints offer_answer_constraints_;
970 PeerConnectionInterface::RTCOfferAnswerOptions offer_answer_options_;
927 bool remove_msid_ = false; // True if MSID should be removed in received SDP. 971 bool remove_msid_ = false; // True if MSID should be removed in received SDP.
928 bool remove_bundle_ = 972 bool remove_bundle_ =
929 false; // True if bundle should be removed in received SDP. 973 false; // True if bundle should be removed in received SDP.
930 bool remove_sdes_ = 974 bool remove_sdes_ =
931 false; // True if a=crypto should be removed in received SDP. 975 false; // True if a=crypto should be removed in received SDP.
932 976
933 rtc::scoped_refptr<DataChannelInterface> data_channel_; 977 rtc::scoped_refptr<DataChannelInterface> data_channel_;
934 rtc::scoped_ptr<MockDataChannelObserver> data_observer_; 978 rtc::scoped_ptr<MockDataChannelObserver> data_observer_;
935 }; 979 };
936 980
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 } 1070 }
1027 1071
1028 bool CreateTestClients() { return CreateTestClients(nullptr, nullptr); } 1072 bool CreateTestClients() { return CreateTestClients(nullptr, nullptr); }
1029 1073
1030 bool CreateTestClients(MediaConstraintsInterface* init_constraints, 1074 bool CreateTestClients(MediaConstraintsInterface* init_constraints,
1031 MediaConstraintsInterface* recv_constraints) { 1075 MediaConstraintsInterface* recv_constraints) {
1032 return CreateTestClients(init_constraints, nullptr, recv_constraints, 1076 return CreateTestClients(init_constraints, nullptr, recv_constraints,
1033 nullptr); 1077 nullptr);
1034 } 1078 }
1035 1079
1080 bool CreateTestClientsThatPreferNoConstraints() {
1081 initiating_client_.reset(
1082 PeerConnectionTestClient::CreateClientPreferNoConstraints("Caller: ",
1083 nullptr));
1084 receiving_client_.reset(
1085 PeerConnectionTestClient::CreateClientPreferNoConstraints("Callee: ",
1086 nullptr));
1087 if (!initiating_client_ || !receiving_client_) {
1088 return false;
1089 }
1090 // Remember the choice for possible later resets of the clients.
1091 prefer_constraint_apis_ = false;
1092 SetSignalingReceivers();
1093 return true;
1094 }
1095
1036 void SetSignalingReceivers() { 1096 void SetSignalingReceivers() {
1037 initiating_client_->set_signaling_message_receiver(receiving_client_.get()); 1097 initiating_client_->set_signaling_message_receiver(receiving_client_.get());
1038 receiving_client_->set_signaling_message_receiver(initiating_client_.get()); 1098 receiving_client_->set_signaling_message_receiver(initiating_client_.get());
1039 } 1099 }
1040 1100
1041 bool CreateTestClients(MediaConstraintsInterface* init_constraints, 1101 bool CreateTestClients(MediaConstraintsInterface* init_constraints,
1042 PeerConnectionFactory::Options* init_options, 1102 PeerConnectionFactory::Options* init_options,
1043 MediaConstraintsInterface* recv_constraints, 1103 MediaConstraintsInterface* recv_constraints,
1044 PeerConnectionFactory::Options* recv_options) { 1104 PeerConnectionFactory::Options* recv_options) {
1045 initiating_client_.reset(PeerConnectionTestClient::CreateClient( 1105 initiating_client_.reset(PeerConnectionTestClient::CreateClient(
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 true); 1194 true);
1135 1195
1136 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( 1196 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store(
1137 rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore() 1197 rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore()
1138 : nullptr); 1198 : nullptr);
1139 dtls_identity_store->use_alternate_key(); 1199 dtls_identity_store->use_alternate_key();
1140 1200
1141 // Make sure the new client is using a different certificate. 1201 // Make sure the new client is using a different certificate.
1142 return PeerConnectionTestClient::CreateClientWithDtlsIdentityStore( 1202 return PeerConnectionTestClient::CreateClientWithDtlsIdentityStore(
1143 "New Peer: ", &setup_constraints, nullptr, 1203 "New Peer: ", &setup_constraints, nullptr,
1144 std::move(dtls_identity_store)); 1204 std::move(dtls_identity_store), prefer_constraint_apis_);
1145 } 1205 }
1146 1206
1147 void SendRtpData(webrtc::DataChannelInterface* dc, const std::string& data) { 1207 void SendRtpData(webrtc::DataChannelInterface* dc, const std::string& data) {
1148 // Messages may get lost on the unreliable DataChannel, so we send multiple 1208 // Messages may get lost on the unreliable DataChannel, so we send multiple
1149 // times to avoid test flakiness. 1209 // times to avoid test flakiness.
1150 static const size_t kSendAttempts = 5; 1210 static const size_t kSendAttempts = 5;
1151 1211
1152 for (size_t i = 0; i < kSendAttempts; ++i) { 1212 for (size_t i = 0; i < kSendAttempts; ++i) {
1153 dc->Send(DataBuffer(data)); 1213 dc->Send(DataBuffer(data));
1154 } 1214 }
(...skipping 24 matching lines...) Expand all
1179 receiving_client_.reset(client); 1239 receiving_client_.reset(client);
1180 return old; 1240 return old;
1181 } 1241 }
1182 1242
1183 private: 1243 private:
1184 rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_; 1244 rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
1185 rtc::scoped_ptr<rtc::VirtualSocketServer> ss_; 1245 rtc::scoped_ptr<rtc::VirtualSocketServer> ss_;
1186 rtc::SocketServerScope ss_scope_; 1246 rtc::SocketServerScope ss_scope_;
1187 rtc::scoped_ptr<PeerConnectionTestClient> initiating_client_; 1247 rtc::scoped_ptr<PeerConnectionTestClient> initiating_client_;
1188 rtc::scoped_ptr<PeerConnectionTestClient> receiving_client_; 1248 rtc::scoped_ptr<PeerConnectionTestClient> receiving_client_;
1249 bool prefer_constraint_apis_ = true;
1189 }; 1250 };
1190 1251
1191 // Disable for TSan v2, see 1252 // Disable for TSan v2, see
1192 // https://code.google.com/p/webrtc/issues/detail?id=1205 for details. 1253 // https://code.google.com/p/webrtc/issues/detail?id=1205 for details.
1193 #if !defined(THREAD_SANITIZER) 1254 #if !defined(THREAD_SANITIZER)
1194 1255
1195 // This test sets up a Jsep call between two parties and test Dtmf. 1256 // This test sets up a Jsep call between two parties and test Dtmf.
1196 // TODO(holmer): Disabled due to sometimes crashing on buildbots. 1257 // TODO(holmer): Disabled due to sometimes crashing on buildbots.
1197 // See issue webrtc/2378. 1258 // See issue webrtc/2378.
1198 TEST_F(P2PTestConductor, DISABLED_LocalP2PTestDtmf) { 1259 TEST_F(P2PTestConductor, DISABLED_LocalP2PTestDtmf) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 } 1306 }
1246 1307
1247 // This test sets up an one-way call, with media only from initiator to 1308 // This test sets up an one-way call, with media only from initiator to
1248 // responder. 1309 // responder.
1249 TEST_F(P2PTestConductor, OneWayMediaCall) { 1310 TEST_F(P2PTestConductor, OneWayMediaCall) {
1250 ASSERT_TRUE(CreateTestClients()); 1311 ASSERT_TRUE(CreateTestClients());
1251 receiving_client()->set_auto_add_stream(false); 1312 receiving_client()->set_auto_add_stream(false);
1252 LocalP2PTest(); 1313 LocalP2PTest();
1253 } 1314 }
1254 1315
1316 TEST_F(P2PTestConductor, OneWayMediaCallWithoutConstraints) {
1317 ASSERT_TRUE(CreateTestClientsThatPreferNoConstraints());
1318 receiving_client()->set_auto_add_stream(false);
1319 LocalP2PTest();
1320 }
1321
1255 // This test sets up a audio call initially and then upgrades to audio/video, 1322 // This test sets up a audio call initially and then upgrades to audio/video,
1256 // using DTLS. 1323 // using DTLS.
1257 TEST_F(P2PTestConductor, LocalP2PTestDtlsRenegotiate) { 1324 TEST_F(P2PTestConductor, LocalP2PTestDtlsRenegotiate) {
1258 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); 1325 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
1259 FakeConstraints setup_constraints; 1326 FakeConstraints setup_constraints;
1260 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, 1327 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
1261 true); 1328 true);
1262 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); 1329 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints));
1263 receiving_client()->SetReceiveAudioVideo(true, false); 1330 receiving_client()->SetReceiveAudioVideo(true, false);
1264 LocalP2PTest(); 1331 LocalP2PTest();
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
2047 server.urls.push_back("turn:hostname2"); 2114 server.urls.push_back("turn:hostname2");
2048 servers.push_back(server); 2115 servers.push_back(server);
2049 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); 2116 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_));
2050 EXPECT_EQ(2U, turn_servers_.size()); 2117 EXPECT_EQ(2U, turn_servers_.size());
2051 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); 2118 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority);
2052 } 2119 }
2053 2120
2054 #endif // if !defined(THREAD_SANITIZER) 2121 #endif // if !defined(THREAD_SANITIZER)
2055 2122
2056 } // namespace 2123 } // namespace
OLDNEW
« no previous file with comments | « webrtc/api/peerconnection.cc ('k') | webrtc/api/peerconnectioninterface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698