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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 | 137 |
138 protected: | 138 protected: |
139 SignalingMessageReceiver() {} | 139 SignalingMessageReceiver() {} |
140 virtual ~SignalingMessageReceiver() {} | 140 virtual ~SignalingMessageReceiver() {} |
141 }; | 141 }; |
142 | 142 |
143 class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, | 143 class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, |
144 public SignalingMessageReceiver, | 144 public SignalingMessageReceiver, |
145 public ObserverInterface { | 145 public ObserverInterface { |
146 public: | 146 public: |
147 static PeerConnectionTestClient* CreateClient( | 147 static PeerConnectionTestClient* CreateClientWithKeySpecified( |
148 const std::string& id, | 148 const std::string& id, |
149 const MediaConstraintsInterface* constraints, | 149 const MediaConstraintsInterface* constraints, |
150 const PeerConnectionFactory::Options* options) { | 150 const PeerConnectionFactory::Options* options, |
151 bool use_alternate_key) { | |
pthatcher1
2015/11/30 20:23:10
Why not just CreateClientWithAlternateKey and then
guoweis_webrtc
2015/12/01 22:05:12
I think this will duplicate the code in this funct
| |
151 PeerConnectionTestClient* client(new PeerConnectionTestClient(id)); | 152 PeerConnectionTestClient* client(new PeerConnectionTestClient(id)); |
152 if (!client->Init(constraints, options)) { | 153 if (!client->Init(constraints, options, use_alternate_key)) { |
153 delete client; | 154 delete client; |
154 return nullptr; | 155 return nullptr; |
155 } | 156 } |
156 return client; | 157 return client; |
157 } | 158 } |
158 | 159 |
160 static PeerConnectionTestClient* CreateClient( | |
161 const std::string& id, | |
162 const MediaConstraintsInterface* constraints, | |
163 const PeerConnectionFactory::Options* options) { | |
164 return CreateClientWithKeySpecified(id, constraints, options, false); | |
165 } | |
166 | |
159 ~PeerConnectionTestClient() { | 167 ~PeerConnectionTestClient() { |
160 while (!fake_video_renderers_.empty()) { | 168 while (!fake_video_renderers_.empty()) { |
161 RenderMap::iterator it = fake_video_renderers_.begin(); | 169 RenderMap::iterator it = fake_video_renderers_.begin(); |
162 delete it->second; | 170 delete it->second; |
163 fake_video_renderers_.erase(it); | 171 fake_video_renderers_.erase(it); |
164 } | 172 } |
165 } | 173 } |
166 | 174 |
167 void Negotiate() { Negotiate(true, true); } | 175 void Negotiate() { Negotiate(true, true); } |
168 | 176 |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
679 bool completed() const { return completed_; } | 687 bool completed() const { return completed_; } |
680 | 688 |
681 private: | 689 private: |
682 bool completed_; | 690 bool completed_; |
683 std::vector<std::string> tones_; | 691 std::vector<std::string> tones_; |
684 }; | 692 }; |
685 | 693 |
686 explicit PeerConnectionTestClient(const std::string& id) : id_(id) {} | 694 explicit PeerConnectionTestClient(const std::string& id) : id_(id) {} |
687 | 695 |
688 bool Init(const MediaConstraintsInterface* constraints, | 696 bool Init(const MediaConstraintsInterface* constraints, |
689 const PeerConnectionFactory::Options* options) { | 697 const PeerConnectionFactory::Options* options, |
698 bool use_alternate_key) { | |
690 EXPECT_TRUE(!peer_connection_); | 699 EXPECT_TRUE(!peer_connection_); |
691 EXPECT_TRUE(!peer_connection_factory_); | 700 EXPECT_TRUE(!peer_connection_factory_); |
692 allocator_factory_ = webrtc::FakePortAllocatorFactory::Create(); | 701 allocator_factory_ = webrtc::FakePortAllocatorFactory::Create(); |
693 if (!allocator_factory_) { | 702 if (!allocator_factory_) { |
694 return false; | 703 return false; |
695 } | 704 } |
696 fake_audio_capture_module_ = FakeAudioCaptureModule::Create(); | 705 fake_audio_capture_module_ = FakeAudioCaptureModule::Create(); |
697 | 706 |
698 if (fake_audio_capture_module_ == nullptr) { | 707 if (fake_audio_capture_module_ == nullptr) { |
699 return false; | 708 return false; |
700 } | 709 } |
701 fake_video_decoder_factory_ = new FakeWebRtcVideoDecoderFactory(); | 710 fake_video_decoder_factory_ = new FakeWebRtcVideoDecoderFactory(); |
702 fake_video_encoder_factory_ = new FakeWebRtcVideoEncoderFactory(); | 711 fake_video_encoder_factory_ = new FakeWebRtcVideoEncoderFactory(); |
703 peer_connection_factory_ = webrtc::CreatePeerConnectionFactory( | 712 peer_connection_factory_ = webrtc::CreatePeerConnectionFactory( |
704 rtc::Thread::Current(), rtc::Thread::Current(), | 713 rtc::Thread::Current(), rtc::Thread::Current(), |
705 fake_audio_capture_module_, fake_video_encoder_factory_, | 714 fake_audio_capture_module_, fake_video_encoder_factory_, |
706 fake_video_decoder_factory_); | 715 fake_video_decoder_factory_); |
707 if (!peer_connection_factory_) { | 716 if (!peer_connection_factory_) { |
708 return false; | 717 return false; |
709 } | 718 } |
710 if (options) { | 719 if (options) { |
711 peer_connection_factory_->SetOptions(*options); | 720 peer_connection_factory_->SetOptions(*options); |
712 } | 721 } |
713 peer_connection_ = CreatePeerConnection(allocator_factory_.get(), | 722 peer_connection_ = CreatePeerConnection(allocator_factory_.get(), |
714 constraints); | 723 constraints, use_alternate_key); |
715 return peer_connection_.get() != nullptr; | 724 return peer_connection_.get() != nullptr; |
716 } | 725 } |
717 | 726 |
718 rtc::scoped_refptr<webrtc::VideoTrackInterface> | 727 rtc::scoped_refptr<webrtc::VideoTrackInterface> |
719 CreateLocalVideoTrack(const std::string stream_label) { | 728 CreateLocalVideoTrack(const std::string stream_label) { |
720 // Set max frame rate to 10fps to reduce the risk of the tests to be flaky. | 729 // Set max frame rate to 10fps to reduce the risk of the tests to be flaky. |
721 FakeConstraints source_constraints = video_constraints_; | 730 FakeConstraints source_constraints = video_constraints_; |
722 source_constraints.SetMandatoryMaxFrameRate(10); | 731 source_constraints.SetMandatoryMaxFrameRate(10); |
723 | 732 |
724 cricket::FakeVideoCapturer* fake_capturer = | 733 cricket::FakeVideoCapturer* fake_capturer = |
725 new webrtc::FakePeriodicVideoCapturer(); | 734 new webrtc::FakePeriodicVideoCapturer(); |
726 video_capturers_.push_back(fake_capturer); | 735 video_capturers_.push_back(fake_capturer); |
727 rtc::scoped_refptr<webrtc::VideoSourceInterface> source = | 736 rtc::scoped_refptr<webrtc::VideoSourceInterface> source = |
728 peer_connection_factory_->CreateVideoSource( | 737 peer_connection_factory_->CreateVideoSource( |
729 fake_capturer, &source_constraints); | 738 fake_capturer, &source_constraints); |
730 std::string label = stream_label + kVideoTrackLabelBase; | 739 std::string label = stream_label + kVideoTrackLabelBase; |
731 return peer_connection_factory_->CreateVideoTrack(label, source); | 740 return peer_connection_factory_->CreateVideoTrack(label, source); |
732 } | 741 } |
733 | 742 |
734 rtc::scoped_refptr<webrtc::PeerConnectionInterface> CreatePeerConnection( | 743 rtc::scoped_refptr<webrtc::PeerConnectionInterface> CreatePeerConnection( |
735 webrtc::PortAllocatorFactoryInterface* factory, | 744 webrtc::PortAllocatorFactoryInterface* factory, |
736 const MediaConstraintsInterface* constraints) { | 745 const MediaConstraintsInterface* constraints, |
746 bool use_alternate_key) { | |
737 // CreatePeerConnection with IceServers. | 747 // CreatePeerConnection with IceServers. |
738 webrtc::PeerConnectionInterface::IceServers ice_servers; | 748 webrtc::PeerConnectionInterface::IceServers ice_servers; |
739 webrtc::PeerConnectionInterface::IceServer ice_server; | 749 webrtc::PeerConnectionInterface::IceServer ice_server; |
740 ice_server.uri = "stun:stun.l.google.com:19302"; | 750 ice_server.uri = "stun:stun.l.google.com:19302"; |
741 ice_servers.push_back(ice_server); | 751 ice_servers.push_back(ice_server); |
742 | 752 |
743 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store( | 753 rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store( |
744 rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore() | 754 rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore() |
745 : nullptr); | 755 : nullptr); |
756 | |
757 if (use_alternate_key) { | |
758 dtls_identity_store->use_alternate_key(); | |
759 } else { | |
760 dtls_identity_store->use_original_key(); | |
761 } | |
746 return peer_connection_factory_->CreatePeerConnection( | 762 return peer_connection_factory_->CreatePeerConnection( |
747 ice_servers, constraints, factory, dtls_identity_store.Pass(), this); | 763 ice_servers, constraints, factory, dtls_identity_store.Pass(), this); |
748 } | 764 } |
749 | 765 |
750 void HandleIncomingOffer(const std::string& msg) { | 766 void HandleIncomingOffer(const std::string& msg) { |
751 LOG(INFO) << id_ << "HandleIncomingOffer "; | 767 LOG(INFO) << id_ << "HandleIncomingOffer "; |
752 if (NumberOfLocalMediaStreams() == 0 && auto_add_stream_) { | 768 if (NumberOfLocalMediaStreams() == 0 && auto_add_stream_) { |
753 // If we are not sending any streams ourselves it is time to add some. | 769 // If we are not sending any streams ourselves it is time to add some. |
754 AddMediaStream(true, true); | 770 AddMediaStream(true, true); |
755 } | 771 } |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
959 receiving_client_->VerifyLocalIceUfragAndPassword(); | 975 receiving_client_->VerifyLocalIceUfragAndPassword(); |
960 } | 976 } |
961 | 977 |
962 ~MAYBE_JsepPeerConnectionP2PTestClient() { | 978 ~MAYBE_JsepPeerConnectionP2PTestClient() { |
963 if (initiating_client_) { | 979 if (initiating_client_) { |
964 initiating_client_->set_signaling_message_receiver(nullptr); | 980 initiating_client_->set_signaling_message_receiver(nullptr); |
965 } | 981 } |
966 if (receiving_client_) { | 982 if (receiving_client_) { |
967 receiving_client_->set_signaling_message_receiver(nullptr); | 983 receiving_client_->set_signaling_message_receiver(nullptr); |
968 } | 984 } |
985 // The clients have to be explicitly closed. Otherwise, they will be | |
986 // disposed after VirtualSocketServer which they still have dependency | |
987 // during the destructing time. | |
pthatcher1
2015/11/30 20:23:11
which => on which
dependency => a dependency
durin
guoweis_webrtc
2015/12/01 22:05:12
Done.
| |
988 initiating_client_->pc()->Close(); | |
989 receiving_client_->pc()->Close(); | |
969 } | 990 } |
970 | 991 |
971 bool CreateTestClients() { return CreateTestClients(nullptr, nullptr); } | 992 bool CreateTestClients() { return CreateTestClients(nullptr, nullptr); } |
972 | 993 |
973 bool CreateTestClients(MediaConstraintsInterface* init_constraints, | 994 bool CreateTestClients(MediaConstraintsInterface* init_constraints, |
974 MediaConstraintsInterface* recv_constraints) { | 995 MediaConstraintsInterface* recv_constraints) { |
975 return CreateTestClients(init_constraints, nullptr, recv_constraints, | 996 return CreateTestClients(init_constraints, nullptr, recv_constraints, |
976 nullptr); | 997 nullptr); |
977 } | 998 } |
978 | 999 |
1000 void SetSignalingReceivers() { | |
1001 initiating_client_->set_signaling_message_receiver(receiving_client_.get()); | |
1002 receiving_client_->set_signaling_message_receiver(initiating_client_.get()); | |
1003 } | |
1004 | |
979 bool CreateTestClients(MediaConstraintsInterface* init_constraints, | 1005 bool CreateTestClients(MediaConstraintsInterface* init_constraints, |
980 PeerConnectionFactory::Options* init_options, | 1006 PeerConnectionFactory::Options* init_options, |
981 MediaConstraintsInterface* recv_constraints, | 1007 MediaConstraintsInterface* recv_constraints, |
982 PeerConnectionFactory::Options* recv_options) { | 1008 PeerConnectionFactory::Options* recv_options) { |
983 initiating_client_.reset(PeerConnectionTestClient::CreateClient( | 1009 initiating_client_.reset(PeerConnectionTestClient::CreateClient( |
984 "Caller: ", init_constraints, init_options)); | 1010 "Caller: ", init_constraints, init_options)); |
985 receiving_client_.reset(PeerConnectionTestClient::CreateClient( | 1011 receiving_client_.reset(PeerConnectionTestClient::CreateClient( |
986 "Callee: ", recv_constraints, recv_options)); | 1012 "Callee: ", recv_constraints, recv_options)); |
987 if (!initiating_client_ || !receiving_client_) { | 1013 if (!initiating_client_ || !receiving_client_) { |
988 return false; | 1014 return false; |
989 } | 1015 } |
990 initiating_client_->set_signaling_message_receiver(receiving_client_.get()); | 1016 SetSignalingReceivers(); |
991 receiving_client_->set_signaling_message_receiver(initiating_client_.get()); | |
992 return true; | 1017 return true; |
993 } | 1018 } |
994 | 1019 |
995 void SetVideoConstraints(const webrtc::FakeConstraints& init_constraints, | 1020 void SetVideoConstraints(const webrtc::FakeConstraints& init_constraints, |
996 const webrtc::FakeConstraints& recv_constraints) { | 1021 const webrtc::FakeConstraints& recv_constraints) { |
997 initiating_client_->SetVideoConstraints(init_constraints); | 1022 initiating_client_->SetVideoConstraints(init_constraints); |
998 receiving_client_->SetVideoConstraints(recv_constraints); | 1023 receiving_client_->SetVideoConstraints(recv_constraints); |
999 } | 1024 } |
1000 | 1025 |
1001 void EnableVideoDecoderFactory() { | 1026 void EnableVideoDecoderFactory() { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1059 receiving_client_->can_receive_video()) { | 1084 receiving_client_->can_receive_video()) { |
1060 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceGatheringComplete, | 1085 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceGatheringComplete, |
1061 receiving_client_->ice_gathering_state(), | 1086 receiving_client_->ice_gathering_state(), |
1062 kMaxWaitForFramesMs); | 1087 kMaxWaitForFramesMs); |
1063 } | 1088 } |
1064 | 1089 |
1065 EXPECT_TRUE_WAIT(FramesNotPending(audio_frame_count, video_frame_count), | 1090 EXPECT_TRUE_WAIT(FramesNotPending(audio_frame_count, video_frame_count), |
1066 kMaxWaitForFramesMs); | 1091 kMaxWaitForFramesMs); |
1067 } | 1092 } |
1068 | 1093 |
1094 void SetupAndVerifyDtlsCall() { | |
1095 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | |
1096 FakeConstraints setup_constraints; | |
1097 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | |
1098 true); | |
1099 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | |
1100 LocalP2PTest(); | |
1101 VerifyRenderedSize(640, 480); | |
1102 } | |
1103 | |
1104 PeerConnectionTestClient* CreateDtlsClientWithAlternateKey() { | |
1105 FakeConstraints setup_constraints; | |
1106 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | |
1107 true); | |
1108 | |
1109 // Make sure the new client is using a different certificate. | |
1110 return PeerConnectionTestClient::CreateClientWithKeySpecified( | |
1111 "New Peer: ", &setup_constraints, nullptr, true); | |
1112 } | |
1113 | |
1069 void SendRtpData(webrtc::DataChannelInterface* dc, const std::string& data) { | 1114 void SendRtpData(webrtc::DataChannelInterface* dc, const std::string& data) { |
1070 // Messages may get lost on the unreliable DataChannel, so we send multiple | 1115 // Messages may get lost on the unreliable DataChannel, so we send multiple |
1071 // times to avoid test flakiness. | 1116 // times to avoid test flakiness. |
1072 static const size_t kSendAttempts = 5; | 1117 static const size_t kSendAttempts = 5; |
1073 | 1118 |
1074 for (size_t i = 0; i < kSendAttempts; ++i) { | 1119 for (size_t i = 0; i < kSendAttempts; ++i) { |
1075 dc->Send(DataBuffer(data)); | 1120 dc->Send(DataBuffer(data)); |
1076 } | 1121 } |
1077 } | 1122 } |
1078 | 1123 |
1079 PeerConnectionTestClient* initializing_client() { | 1124 PeerConnectionTestClient* initializing_client() { |
1080 return initiating_client_.get(); | 1125 return initiating_client_.get(); |
1081 } | 1126 } |
1127 | |
1128 // Reset the |initiating_client_| to the |client| passed in and return the | |
1129 // original |initiating_client_|. | |
1130 PeerConnectionTestClient* swap_initializing_client( | |
1131 PeerConnectionTestClient* client) { | |
1132 PeerConnectionTestClient* old = initiating_client_.release(); | |
1133 initiating_client_.reset(client); | |
1134 return old; | |
1135 } | |
pthatcher1
2015/11/30 20:23:11
These two methods aren't used any more.
guoweis_webrtc
2015/12/01 22:05:12
Done.
| |
1136 | |
1082 PeerConnectionTestClient* receiving_client() { | 1137 PeerConnectionTestClient* receiving_client() { |
1083 return receiving_client_.get(); | 1138 return receiving_client_.get(); |
1084 } | 1139 } |
1085 | 1140 |
1141 // Reset the |receiving_client_| to the |client| passed in and return the | |
1142 // original |receiving_client_|. | |
1143 PeerConnectionTestClient* swap_receiving_client( | |
1144 PeerConnectionTestClient* client) { | |
1145 PeerConnectionTestClient* old = receiving_client_.release(); | |
1146 receiving_client_.reset(client); | |
1147 return old; | |
1148 } | |
1149 | |
1150 protected: | |
1151 rtc::scoped_ptr<PeerConnectionTestClient> initiating_client_; | |
1152 rtc::scoped_ptr<PeerConnectionTestClient> receiving_client_; | |
pthatcher1
2015/11/30 20:23:10
Usually, we leave "foo_" members private and then
guoweis_webrtc
2015/12/01 22:05:12
but we'll be doing this
foo() = new client():
Un
pthatcher1
2015/12/01 23:29:34
Then add set_foo and use it: set_foo(new_client())
| |
1153 | |
1086 private: | 1154 private: |
1087 rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_; | 1155 rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_; |
1088 rtc::scoped_ptr<rtc::VirtualSocketServer> ss_; | 1156 rtc::scoped_ptr<rtc::VirtualSocketServer> ss_; |
1089 rtc::SocketServerScope ss_scope_; | 1157 rtc::SocketServerScope ss_scope_; |
1090 rtc::scoped_ptr<PeerConnectionTestClient> initiating_client_; | |
1091 rtc::scoped_ptr<PeerConnectionTestClient> receiving_client_; | |
1092 }; | 1158 }; |
1093 | 1159 |
1094 // Disable for TSan v2, see | 1160 // Disable for TSan v2, see |
1095 // https://code.google.com/p/webrtc/issues/detail?id=1205 for details. | 1161 // https://code.google.com/p/webrtc/issues/detail?id=1205 for details. |
1096 #if !defined(THREAD_SANITIZER) | 1162 #if !defined(THREAD_SANITIZER) |
1097 | 1163 |
1098 // This test sets up a Jsep call between two parties and test Dtmf. | 1164 // This test sets up a Jsep call between two parties and test Dtmf. |
1099 // TODO(holmer): Disabled due to sometimes crashing on buildbots. | 1165 // TODO(holmer): Disabled due to sometimes crashing on buildbots. |
1100 // See issue webrtc/2378. | 1166 // See issue webrtc/2378. |
1101 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, DISABLED_LocalP2PTestDtmf) { | 1167 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, DISABLED_LocalP2PTestDtmf) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1137 constraint.SetMandatoryMinWidth(1280); | 1203 constraint.SetMandatoryMinWidth(1280); |
1138 constraint.SetMandatoryMinHeight(720); | 1204 constraint.SetMandatoryMinHeight(720); |
1139 SetVideoConstraints(constraint, constraint); | 1205 SetVideoConstraints(constraint, constraint); |
1140 LocalP2PTest(); | 1206 LocalP2PTest(); |
1141 VerifyRenderedSize(1280, 720); | 1207 VerifyRenderedSize(1280, 720); |
1142 } | 1208 } |
1143 | 1209 |
1144 // This test sets up a call between two endpoints that are configured to use | 1210 // This test sets up a call between two endpoints that are configured to use |
1145 // DTLS key agreement. As a result, DTLS is negotiated and used for transport. | 1211 // DTLS key agreement. As a result, DTLS is negotiated and used for transport. |
1146 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, LocalP2PTestDtls) { | 1212 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, LocalP2PTestDtls) { |
1147 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1213 SetupAndVerifyDtlsCall(); |
1148 FakeConstraints setup_constraints; | |
1149 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | |
1150 true); | |
1151 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | |
1152 LocalP2PTest(); | |
1153 VerifyRenderedSize(640, 480); | |
1154 } | 1214 } |
1155 | 1215 |
1156 // This test sets up a audio call initially and then upgrades to audio/video, | 1216 // This test sets up a audio call initially and then upgrades to audio/video, |
1157 // using DTLS. | 1217 // using DTLS. |
1158 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, LocalP2PTestDtlsRenegotiate) { | 1218 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, LocalP2PTestDtlsRenegotiate) { |
1159 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1219 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
1160 FakeConstraints setup_constraints; | 1220 FakeConstraints setup_constraints; |
1161 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | 1221 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
1162 true); | 1222 true); |
1163 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1223 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
1164 receiving_client()->SetReceiveAudioVideo(true, false); | 1224 receiving_client()->SetReceiveAudioVideo(true, false); |
1165 LocalP2PTest(); | 1225 LocalP2PTest(); |
1166 receiving_client()->SetReceiveAudioVideo(true, true); | 1226 receiving_client()->SetReceiveAudioVideo(true, true); |
1167 receiving_client()->Negotiate(); | 1227 receiving_client()->Negotiate(); |
1168 } | 1228 } |
1169 | 1229 |
1230 // This test sets up a call transfer to a new caller with a different DTLS | |
1231 // fingerprint. | |
1232 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, LocalP2PTestDtlsTransferCallee) { | |
1233 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | |
1234 SetupAndVerifyDtlsCall(); | |
1235 | |
1236 // Keeping the original peer around which will still send packets to the | |
1237 // receiving client. These SRTP packets will be dropped. | |
1238 rtc::scoped_ptr<PeerConnectionTestClient> original_peer( | |
1239 initiating_client_.release()); | |
1240 initiating_client_.reset(CreateDtlsClientWithAlternateKey()); | |
1241 | |
1242 SetSignalingReceivers(); | |
1243 receiving_client()->SetExpectIceRestart(true); | |
1244 LocalP2PTest(); | |
1245 VerifyRenderedSize(640, 480); | |
1246 } | |
1247 | |
1248 // This test sets up a call transfer to a new callee with a different DTLS | |
1249 // fingerprint. | |
1250 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, LocalP2PTestDtlsTransferCaller) { | |
1251 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | |
1252 SetupAndVerifyDtlsCall(); | |
1253 | |
1254 // Keeping the original peer around which will still send packets to the | |
1255 // receiving client. These SRTP packets will be dropped. | |
1256 rtc::scoped_ptr<PeerConnectionTestClient> original_peer( | |
1257 receiving_client_.release()); | |
1258 receiving_client_.reset(CreateDtlsClientWithAlternateKey()); | |
1259 | |
1260 SetSignalingReceivers(); | |
1261 initializing_client()->IceRestart(); | |
pthatcher1
2015/11/30 20:23:10
It looks like we are testing the scenario where IC
guoweis_webrtc
2015/12/01 22:05:12
Can we do that? Since we don't do DTLS rekeying, I
pthatcher1
2015/12/01 23:29:34
Yeah, good point. In ORTC land, we disallow there
| |
1262 LocalP2PTest(); | |
1263 VerifyRenderedSize(640, 480); | |
1264 } | |
1265 | |
1170 // This test sets up a call between two endpoints that are configured to use | 1266 // This test sets up a call between two endpoints that are configured to use |
1171 // DTLS key agreement. The offerer don't support SDES. As a result, DTLS is | 1267 // DTLS key agreement. The offerer don't support SDES. As a result, DTLS is |
1172 // negotiated and used for transport. | 1268 // negotiated and used for transport. |
1173 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, | 1269 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, |
1174 MAYBE_LocalP2PTestOfferDtlsButNotSdes) { | 1270 MAYBE_LocalP2PTestOfferDtlsButNotSdes) { |
1175 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); | 1271 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
1176 FakeConstraints setup_constraints; | 1272 FakeConstraints setup_constraints; |
1177 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, | 1273 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
1178 true); | 1274 true); |
1179 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1275 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1853 server.urls.push_back("stun:hostname"); | 1949 server.urls.push_back("stun:hostname"); |
1854 server.urls.push_back("turn:hostname"); | 1950 server.urls.push_back("turn:hostname"); |
1855 servers.push_back(server); | 1951 servers.push_back(server); |
1856 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_configurations_, | 1952 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_configurations_, |
1857 &turn_configurations_)); | 1953 &turn_configurations_)); |
1858 EXPECT_EQ(1U, stun_configurations_.size()); | 1954 EXPECT_EQ(1U, stun_configurations_.size()); |
1859 EXPECT_EQ(1U, turn_configurations_.size()); | 1955 EXPECT_EQ(1U, turn_configurations_.size()); |
1860 } | 1956 } |
1861 | 1957 |
1862 #endif // if !defined(THREAD_SANITIZER) | 1958 #endif // if !defined(THREAD_SANITIZER) |
OLD | NEW |