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

Side by Side Diff: talk/app/webrtc/webrtcsdp_unittest.cc

Issue 1336553003: Revert change which removes GICE (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 3 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 | « talk/app/webrtc/webrtcsdp.cc ('k') | talk/app/webrtc/webrtcsession_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 * libjingle 2 * libjingle
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 using cricket::ContentInfo; 48 using cricket::ContentInfo;
49 using cricket::CryptoParams; 49 using cricket::CryptoParams;
50 using cricket::ContentGroup; 50 using cricket::ContentGroup;
51 using cricket::DataCodec; 51 using cricket::DataCodec;
52 using cricket::DataContentDescription; 52 using cricket::DataContentDescription;
53 using cricket::ICE_CANDIDATE_COMPONENT_RTCP; 53 using cricket::ICE_CANDIDATE_COMPONENT_RTCP;
54 using cricket::ICE_CANDIDATE_COMPONENT_RTP; 54 using cricket::ICE_CANDIDATE_COMPONENT_RTP;
55 using cricket::kFecSsrcGroupSemantics; 55 using cricket::kFecSsrcGroupSemantics;
56 using cricket::LOCAL_PORT_TYPE; 56 using cricket::LOCAL_PORT_TYPE;
57 using cricket::NS_JINGLE_DRAFT_SCTP; 57 using cricket::NS_JINGLE_DRAFT_SCTP;
58 using cricket::NS_JINGLE_ICE_UDP;
58 using cricket::NS_JINGLE_RTP; 59 using cricket::NS_JINGLE_RTP;
59 using cricket::RtpHeaderExtension; 60 using cricket::RtpHeaderExtension;
60 using cricket::RELAY_PORT_TYPE; 61 using cricket::RELAY_PORT_TYPE;
61 using cricket::SessionDescription; 62 using cricket::SessionDescription;
62 using cricket::StreamParams; 63 using cricket::StreamParams;
63 using cricket::STUN_PORT_TYPE; 64 using cricket::STUN_PORT_TYPE;
64 using cricket::TransportDescription; 65 using cricket::TransportDescription;
65 using cricket::TransportInfo; 66 using cricket::TransportInfo;
66 using cricket::VideoCodec; 67 using cricket::VideoCodec;
67 using cricket::VideoContentDescription; 68 using cricket::VideoContentDescription;
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 JsepSessionDescription::kMaxVideoCodecHeight, 573 JsepSessionDescription::kMaxVideoCodecHeight,
573 JsepSessionDescription::kDefaultVideoCodecFramerate, 574 JsepSessionDescription::kDefaultVideoCodecFramerate,
574 JsepSessionDescription::kDefaultVideoCodecPreference)); 575 JsepSessionDescription::kDefaultVideoCodecPreference));
575 576
576 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, 577 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP,
577 video.release()); 578 video.release());
578 579
579 // TransportInfo 580 // TransportInfo
580 EXPECT_TRUE(desc_.AddTransportInfo( 581 EXPECT_TRUE(desc_.AddTransportInfo(
581 TransportInfo(kAudioContentName, 582 TransportInfo(kAudioContentName,
582 TransportDescription(kCandidateUfragVoice, 583 TransportDescription(NS_JINGLE_ICE_UDP,
584 kCandidateUfragVoice,
583 kCandidatePwdVoice)))); 585 kCandidatePwdVoice))));
584 EXPECT_TRUE(desc_.AddTransportInfo( 586 EXPECT_TRUE(desc_.AddTransportInfo(
585 TransportInfo(kVideoContentName, 587 TransportInfo(kVideoContentName,
586 TransportDescription(kCandidateUfragVideo, 588 TransportDescription(NS_JINGLE_ICE_UDP,
589 kCandidateUfragVideo,
587 kCandidatePwdVideo)))); 590 kCandidatePwdVideo))));
588 591
589 // v4 host 592 // v4 host
590 int port = 1234; 593 int port = 1234;
591 rtc::SocketAddress address("192.168.1.5", port++); 594 rtc::SocketAddress address("192.168.1.5", port++);
592 Candidate candidate1(ICE_CANDIDATE_COMPONENT_RTP, "udp", address, 595 Candidate candidate1(ICE_CANDIDATE_COMPONENT_RTP, "udp", address,
593 kCandidatePriority, "", "", LOCAL_PORT_TYPE, 596 kCandidatePriority, "", "", LOCAL_PORT_TYPE,
594 kCandidateGeneration, kCandidateFoundation1); 597 kCandidateGeneration, kCandidateFoundation1);
595 address.SetPort(port++); 598 address.SetPort(port++);
596 Candidate candidate2(ICE_CANDIDATE_COMPONENT_RTCP, "udp", address, 599 Candidate candidate2(ICE_CANDIDATE_COMPONENT_RTCP, "udp", address,
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 const cricket::TransportInfos transports2 = desc2.transport_infos(); 856 const cricket::TransportInfos transports2 = desc2.transport_infos();
854 EXPECT_EQ(transports1.size(), transports2.size()); 857 EXPECT_EQ(transports1.size(), transports2.size());
855 if (transports1.size() != transports2.size()) { 858 if (transports1.size() != transports2.size()) {
856 ADD_FAILURE(); 859 ADD_FAILURE();
857 return; 860 return;
858 } 861 }
859 for (size_t i = 0; i < transports1.size(); ++i) { 862 for (size_t i = 0; i < transports1.size(); ++i) {
860 const cricket::TransportInfo transport1 = transports1.at(i); 863 const cricket::TransportInfo transport1 = transports1.at(i);
861 const cricket::TransportInfo transport2 = transports2.at(i); 864 const cricket::TransportInfo transport2 = transports2.at(i);
862 EXPECT_EQ(transport1.content_name, transport2.content_name); 865 EXPECT_EQ(transport1.content_name, transport2.content_name);
866 EXPECT_EQ(transport1.description.transport_type,
867 transport2.description.transport_type);
863 EXPECT_EQ(transport1.description.ice_ufrag, 868 EXPECT_EQ(transport1.description.ice_ufrag,
864 transport2.description.ice_ufrag); 869 transport2.description.ice_ufrag);
865 EXPECT_EQ(transport1.description.ice_pwd, 870 EXPECT_EQ(transport1.description.ice_pwd,
866 transport2.description.ice_pwd); 871 transport2.description.ice_pwd);
867 if (transport1.description.identity_fingerprint) { 872 if (transport1.description.identity_fingerprint) {
868 EXPECT_EQ(*transport1.description.identity_fingerprint, 873 EXPECT_EQ(*transport1.description.identity_fingerprint,
869 *transport2.description.identity_fingerprint); 874 *transport2.description.identity_fingerprint);
870 } else { 875 } else {
871 EXPECT_EQ(transport1.description.identity_fingerprint.get(), 876 EXPECT_EQ(transport1.description.identity_fingerprint.get(),
872 transport2.description.identity_fingerprint.get()); 877 transport2.description.identity_fingerprint.get());
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 const std::string& ufrag, const std::string& pwd) { 938 const std::string& ufrag, const std::string& pwd) {
934 std::string content_name; 939 std::string content_name;
935 if (mline_index == 0) { 940 if (mline_index == 0) {
936 content_name = kAudioContentName; 941 content_name = kAudioContentName;
937 } else if (mline_index == 1) { 942 } else if (mline_index == 1) {
938 content_name = kVideoContentName; 943 content_name = kVideoContentName;
939 } else { 944 } else {
940 ASSERT(false); 945 ASSERT(false);
941 } 946 }
942 TransportInfo transport_info( 947 TransportInfo transport_info(
943 content_name, TransportDescription(ufrag, pwd)); 948 content_name, TransportDescription(NS_JINGLE_ICE_UDP,
949 ufrag, pwd));
944 SessionDescription* desc = 950 SessionDescription* desc =
945 const_cast<SessionDescription*>(jdesc->description()); 951 const_cast<SessionDescription*>(jdesc->description());
946 desc->RemoveTransportInfoByName(content_name); 952 desc->RemoveTransportInfoByName(content_name);
947 EXPECT_TRUE(desc->AddTransportInfo(transport_info)); 953 EXPECT_TRUE(desc->AddTransportInfo(transport_info));
948 for (size_t i = 0; i < jdesc_.number_of_mediasections(); ++i) { 954 for (size_t i = 0; i < jdesc_.number_of_mediasections(); ++i) {
949 const IceCandidateCollection* cc = jdesc_.candidates(i); 955 const IceCandidateCollection* cc = jdesc_.candidates(i);
950 for (size_t j = 0; j < cc->count(); ++j) { 956 for (size_t j = 0; j < cc->count(); ++j) {
951 if (cc->at(j)->sdp_mline_index() == mline_index) { 957 if (cc->at(j)->sdp_mline_index() == mline_index) {
952 const_cast<Candidate&>(cc->at(j)->candidate()).set_username( 958 const_cast<Candidate&>(cc->at(j)->candidate()).set_username(
953 ufrag); 959 ufrag);
(...skipping 16 matching lines...) Expand all
970 } 976 }
971 977
972 void AddFingerprint() { 978 void AddFingerprint() {
973 desc_.RemoveTransportInfoByName(kAudioContentName); 979 desc_.RemoveTransportInfoByName(kAudioContentName);
974 desc_.RemoveTransportInfoByName(kVideoContentName); 980 desc_.RemoveTransportInfoByName(kVideoContentName);
975 rtc::SSLFingerprint fingerprint(rtc::DIGEST_SHA_1, 981 rtc::SSLFingerprint fingerprint(rtc::DIGEST_SHA_1,
976 kIdentityDigest, 982 kIdentityDigest,
977 sizeof(kIdentityDigest)); 983 sizeof(kIdentityDigest));
978 EXPECT_TRUE(desc_.AddTransportInfo( 984 EXPECT_TRUE(desc_.AddTransportInfo(
979 TransportInfo(kAudioContentName, 985 TransportInfo(kAudioContentName,
980 TransportDescription(std::vector<std::string>(), 986 TransportDescription(NS_JINGLE_ICE_UDP,
987 std::vector<std::string>(),
981 kCandidateUfragVoice, 988 kCandidateUfragVoice,
982 kCandidatePwdVoice, 989 kCandidatePwdVoice,
983 cricket::ICEMODE_FULL, 990 cricket::ICEMODE_FULL,
984 cricket::CONNECTIONROLE_NONE, 991 cricket::CONNECTIONROLE_NONE,
985 &fingerprint, Candidates())))); 992 &fingerprint, Candidates()))));
986 EXPECT_TRUE(desc_.AddTransportInfo( 993 EXPECT_TRUE(desc_.AddTransportInfo(
987 TransportInfo(kVideoContentName, 994 TransportInfo(kVideoContentName,
988 TransportDescription(std::vector<std::string>(), 995 TransportDescription(NS_JINGLE_ICE_UDP,
996 std::vector<std::string>(),
989 kCandidateUfragVideo, 997 kCandidateUfragVideo,
990 kCandidatePwdVideo, 998 kCandidatePwdVideo,
991 cricket::ICEMODE_FULL, 999 cricket::ICEMODE_FULL,
992 cricket::CONNECTIONROLE_NONE, 1000 cricket::CONNECTIONROLE_NONE,
993 &fingerprint, Candidates())))); 1001 &fingerprint, Candidates()))));
994 } 1002 }
995 1003
996 void AddExtmap() { 1004 void AddExtmap() {
997 audio_desc_ = static_cast<AudioContentDescription*>( 1005 audio_desc_ = static_cast<AudioContentDescription*>(
998 audio_desc_->Copy()); 1006 audio_desc_->Copy());
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 new DataContentDescription()); 1066 new DataContentDescription());
1059 data_desc_ = data.get(); 1067 data_desc_ = data.get();
1060 data_desc_->set_protocol(cricket::kMediaProtocolDtlsSctp); 1068 data_desc_->set_protocol(cricket::kMediaProtocolDtlsSctp);
1061 DataCodec codec(cricket::kGoogleSctpDataCodecId, 1069 DataCodec codec(cricket::kGoogleSctpDataCodecId,
1062 cricket::kGoogleSctpDataCodecName, 0); 1070 cricket::kGoogleSctpDataCodecName, 0);
1063 codec.SetParam(cricket::kCodecParamPort, kDefaultSctpPort); 1071 codec.SetParam(cricket::kCodecParamPort, kDefaultSctpPort);
1064 data_desc_->AddCodec(codec); 1072 data_desc_->AddCodec(codec);
1065 desc_.AddContent(kDataContentName, NS_JINGLE_DRAFT_SCTP, data.release()); 1073 desc_.AddContent(kDataContentName, NS_JINGLE_DRAFT_SCTP, data.release());
1066 EXPECT_TRUE(desc_.AddTransportInfo( 1074 EXPECT_TRUE(desc_.AddTransportInfo(
1067 TransportInfo(kDataContentName, 1075 TransportInfo(kDataContentName,
1068 TransportDescription(kCandidateUfragData, 1076 TransportDescription(NS_JINGLE_ICE_UDP,
1077 kCandidateUfragData,
1069 kCandidatePwdData)))); 1078 kCandidatePwdData))));
1070 } 1079 }
1071 1080
1072 void AddRtpDataChannel() { 1081 void AddRtpDataChannel() {
1073 rtc::scoped_ptr<DataContentDescription> data( 1082 rtc::scoped_ptr<DataContentDescription> data(
1074 new DataContentDescription()); 1083 new DataContentDescription());
1075 data_desc_ = data.get(); 1084 data_desc_ = data.get();
1076 1085
1077 data_desc_->AddCodec(DataCodec(101, "google-data", 1)); 1086 data_desc_->AddCodec(DataCodec(101, "google-data", 1));
1078 StreamParams data_stream; 1087 StreamParams data_stream;
1079 data_stream.id = kDataChannelMsid; 1088 data_stream.id = kDataChannelMsid;
1080 data_stream.cname = kDataChannelCname; 1089 data_stream.cname = kDataChannelCname;
1081 data_stream.sync_label = kDataChannelLabel; 1090 data_stream.sync_label = kDataChannelLabel;
1082 data_stream.ssrcs.push_back(kDataChannelSsrc); 1091 data_stream.ssrcs.push_back(kDataChannelSsrc);
1083 data_desc_->AddStream(data_stream); 1092 data_desc_->AddStream(data_stream);
1084 data_desc_->AddCrypto(CryptoParams( 1093 data_desc_->AddCrypto(CryptoParams(
1085 1, "AES_CM_128_HMAC_SHA1_80", 1094 1, "AES_CM_128_HMAC_SHA1_80",
1086 "inline:FvLcvU2P3ZWmQxgPAgcDu7Zl9vftYElFOjEzhWs5", "")); 1095 "inline:FvLcvU2P3ZWmQxgPAgcDu7Zl9vftYElFOjEzhWs5", ""));
1087 data_desc_->set_protocol(cricket::kMediaProtocolSavpf); 1096 data_desc_->set_protocol(cricket::kMediaProtocolSavpf);
1088 desc_.AddContent(kDataContentName, NS_JINGLE_RTP, data.release()); 1097 desc_.AddContent(kDataContentName, NS_JINGLE_RTP, data.release());
1089 EXPECT_TRUE(desc_.AddTransportInfo( 1098 EXPECT_TRUE(desc_.AddTransportInfo(
1090 TransportInfo(kDataContentName, 1099 TransportInfo(kDataContentName,
1091 TransportDescription(kCandidateUfragData, 1100 TransportDescription(NS_JINGLE_ICE_UDP,
1101 kCandidateUfragData,
1092 kCandidatePwdData)))); 1102 kCandidatePwdData))));
1093 } 1103 }
1094 1104
1095 bool TestDeserializeDirection(cricket::MediaContentDirection direction) { 1105 bool TestDeserializeDirection(cricket::MediaContentDirection direction) {
1096 std::string new_sdp = kSdpFullString; 1106 std::string new_sdp = kSdpFullString;
1097 ReplaceDirection(direction, &new_sdp); 1107 ReplaceDirection(direction, &new_sdp);
1098 JsepSessionDescription new_jdesc(kDummyString); 1108 JsepSessionDescription new_jdesc(kDummyString);
1099 1109
1100 EXPECT_TRUE(SdpDeserialize(new_sdp, &new_jdesc)); 1110 EXPECT_TRUE(SdpDeserialize(new_sdp, &new_jdesc));
1101 1111
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after
2664 const cricket::MediaContentDescription* mdesc = 2674 const cricket::MediaContentDescription* mdesc =
2665 static_cast<const cricket::MediaContentDescription*>( 2675 static_cast<const cricket::MediaContentDescription*>(
2666 desc->contents()[i].description); 2676 desc->contents()[i].description);
2667 EXPECT_EQ(media_types[media_content_in_sdp[i]], mdesc->type()); 2677 EXPECT_EQ(media_types[media_content_in_sdp[i]], mdesc->type());
2668 } 2678 }
2669 2679
2670 std::string serialized_sdp = webrtc::SdpSerialize(jdesc); 2680 std::string serialized_sdp = webrtc::SdpSerialize(jdesc);
2671 EXPECT_EQ(sdp_string, serialized_sdp); 2681 EXPECT_EQ(sdp_string, serialized_sdp);
2672 } 2682 }
2673 } 2683 }
OLDNEW
« no previous file with comments | « talk/app/webrtc/webrtcsdp.cc ('k') | talk/app/webrtc/webrtcsession_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698