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

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

Issue 2600153004: Adding support for Unified Plan offer/answer negotiation.
Patch Set: Got tests working (aside from ones that need to be completely rewritten) Created 3 years, 11 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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 EXPECT_TRUE_WAIT(observer->completed(), kMaxWaitMs); 710 EXPECT_TRUE_WAIT(observer->completed(), kMaxWaitMs);
711 std::vector<std::string> tones; 711 std::vector<std::string> tones;
712 tones.push_back("1"); 712 tones.push_back("1");
713 tones.push_back("a"); 713 tones.push_back("a");
714 tones.push_back(""); 714 tones.push_back("");
715 observer->Verify(tones); 715 observer->Verify(tones);
716 716
717 dtmf_sender->UnregisterObserver(); 717 dtmf_sender->UnregisterObserver();
718 } 718 }
719 719
720 // Verifies that the SessionDescription have rejected the appropriate media 720 // Verifies that the direction attribute is set correctly in the local
721 // content. 721 // description
722 void VerifyRejectedMediaInSessionDescription() { 722 // according to the options set.
723 void VerifyRecvDirectionInSessionDescription() {
723 ASSERT_TRUE(peer_connection_->remote_description() != nullptr); 724 ASSERT_TRUE(peer_connection_->remote_description() != nullptr);
724 ASSERT_TRUE(peer_connection_->local_description() != nullptr); 725 ASSERT_TRUE(peer_connection_->local_description() != nullptr);
725 const cricket::SessionDescription* remote_desc = 726 const cricket::SessionDescription* remote_desc =
726 peer_connection_->remote_description()->description(); 727 peer_connection_->remote_description()->description();
727 const cricket::SessionDescription* local_desc = 728 const cricket::SessionDescription* local_desc =
728 peer_connection_->local_description()->description(); 729 peer_connection_->local_description()->description();
729 730
730 const ContentInfo* remote_audio_content = GetFirstAudioContent(remote_desc); 731 const ContentInfo* remote_audio_content = GetFirstAudioContent(remote_desc);
731 if (remote_audio_content) { 732 if (remote_audio_content) {
732 const ContentInfo* audio_content = 733 const ContentInfo* audio_content =
733 GetFirstAudioContent(local_desc); 734 GetFirstAudioContent(local_desc);
734 EXPECT_EQ(can_receive_audio(), !audio_content->rejected); 735 EXPECT_EQ(can_receive_audio(),
736 cricket::RtpTransceiverDirection::FromMediaContentDirection(
737 static_cast<const MediaContentDescription*>(
738 audio_content->description)
739 ->direction())
740 .recv);
735 } 741 }
736 742
737 const ContentInfo* remote_video_content = GetFirstVideoContent(remote_desc); 743 const ContentInfo* remote_video_content = GetFirstVideoContent(remote_desc);
738 if (remote_video_content) { 744 if (remote_video_content) {
739 const ContentInfo* video_content = 745 const ContentInfo* video_content =
740 GetFirstVideoContent(local_desc); 746 GetFirstVideoContent(local_desc);
741 EXPECT_EQ(can_receive_video(), !video_content->rejected); 747 EXPECT_EQ(can_receive_video(),
748 cricket::RtpTransceiverDirection::FromMediaContentDirection(
749 static_cast<const MediaContentDescription*>(
750 video_content->description)
751 ->direction())
752 .recv);
742 } 753 }
743 } 754 }
744 755
745 void VerifyLocalIceUfragAndPassword() { 756 void VerifyLocalIceUfragAndPassword() {
746 ASSERT_TRUE(peer_connection_->local_description() != nullptr); 757 ASSERT_TRUE(peer_connection_->local_description() != nullptr);
747 const cricket::SessionDescription* desc = 758 const cricket::SessionDescription* desc =
748 peer_connection_->local_description()->description(); 759 peer_connection_->local_description()->description();
749 const cricket::ContentInfos& contents = desc->contents(); 760 const cricket::ContentInfos& contents = desc->contents();
750 761
751 for (size_t index = 0; index < contents.size(); ++index) { 762 for (size_t index = 0; index < contents.size(); ++index) {
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 // Verify aspect ratio of the local preview. 1328 // Verify aspect ratio of the local preview.
1318 EXPECT_EQ(expected_aspect_ratio, 1329 EXPECT_EQ(expected_aspect_ratio,
1319 initializing_client_local_rendered_aspect_ratio); 1330 initializing_client_local_rendered_aspect_ratio);
1320 1331
1321 // Verify rotation. 1332 // Verify rotation.
1322 EXPECT_EQ(rotation, receiving_client()->rendered_rotation()); 1333 EXPECT_EQ(rotation, receiving_client()->rendered_rotation());
1323 EXPECT_EQ(rotation, initializing_client()->rendered_rotation()); 1334 EXPECT_EQ(rotation, initializing_client()->rendered_rotation());
1324 } 1335 }
1325 1336
1326 void VerifySessionDescriptions() { 1337 void VerifySessionDescriptions() {
1327 initiating_client_->VerifyRejectedMediaInSessionDescription(); 1338 initiating_client_->VerifyRecvDirectionInSessionDescription();
1328 receiving_client_->VerifyRejectedMediaInSessionDescription(); 1339 receiving_client_->VerifyRecvDirectionInSessionDescription();
1329 initiating_client_->VerifyLocalIceUfragAndPassword(); 1340 initiating_client_->VerifyLocalIceUfragAndPassword();
1330 receiving_client_->VerifyLocalIceUfragAndPassword(); 1341 receiving_client_->VerifyLocalIceUfragAndPassword();
1331 } 1342 }
1332 1343
1333 ~P2PTestConductor() { 1344 ~P2PTestConductor() {
1334 if (initiating_client_) { 1345 if (initiating_client_) {
1335 initiating_client_->set_signaling_message_receiver(nullptr); 1346 initiating_client_->set_signaling_message_receiver(nullptr);
1336 } 1347 }
1337 if (receiving_client_) { 1348 if (receiving_client_) {
1338 receiving_client_->set_signaling_message_receiver(nullptr); 1349 receiving_client_->set_signaling_message_receiver(nullptr);
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after
2801 server.urls.push_back("turn:hostname2"); 2812 server.urls.push_back("turn:hostname2");
2802 servers.push_back(server); 2813 servers.push_back(server);
2803 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); 2814 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_));
2804 EXPECT_EQ(2U, turn_servers_.size()); 2815 EXPECT_EQ(2U, turn_servers_.size());
2805 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); 2816 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority);
2806 } 2817 }
2807 2818
2808 #endif // if !defined(THREAD_SANITIZER) 2819 #endif // if !defined(THREAD_SANITIZER)
2809 2820
2810 } // namespace 2821 } // 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