| OLD | NEW |
| 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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 transport2.description.ice_pwd); | 891 transport2.description.ice_pwd); |
| 892 if (transport1.description.identity_fingerprint) { | 892 if (transport1.description.identity_fingerprint) { |
| 893 EXPECT_EQ(*transport1.description.identity_fingerprint, | 893 EXPECT_EQ(*transport1.description.identity_fingerprint, |
| 894 *transport2.description.identity_fingerprint); | 894 *transport2.description.identity_fingerprint); |
| 895 } else { | 895 } else { |
| 896 EXPECT_EQ(transport1.description.identity_fingerprint.get(), | 896 EXPECT_EQ(transport1.description.identity_fingerprint.get(), |
| 897 transport2.description.identity_fingerprint.get()); | 897 transport2.description.identity_fingerprint.get()); |
| 898 } | 898 } |
| 899 EXPECT_EQ(transport1.description.transport_options, | 899 EXPECT_EQ(transport1.description.transport_options, |
| 900 transport2.description.transport_options); | 900 transport2.description.transport_options); |
| 901 EXPECT_TRUE(CompareCandidates(transport1.description.candidates, | |
| 902 transport2.description.candidates)); | |
| 903 } | 901 } |
| 904 | 902 |
| 905 // global attributes | 903 // global attributes |
| 906 EXPECT_EQ(desc1.msid_supported(), desc2.msid_supported()); | 904 EXPECT_EQ(desc1.msid_supported(), desc2.msid_supported()); |
| 907 } | 905 } |
| 908 | 906 |
| 909 bool CompareCandidates(const Candidates& cs1, const Candidates& cs2) { | |
| 910 EXPECT_EQ(cs1.size(), cs2.size()); | |
| 911 if (cs1.size() != cs2.size()) | |
| 912 return false; | |
| 913 for (size_t i = 0; i< cs1.size(); ++i) { | |
| 914 const Candidate c1 = cs1.at(i); | |
| 915 const Candidate c2 = cs2.at(i); | |
| 916 EXPECT_TRUE(c1.IsEquivalent(c2)); | |
| 917 } | |
| 918 return true; | |
| 919 } | |
| 920 | |
| 921 bool CompareSessionDescription( | 907 bool CompareSessionDescription( |
| 922 const JsepSessionDescription& desc1, | 908 const JsepSessionDescription& desc1, |
| 923 const JsepSessionDescription& desc2) { | 909 const JsepSessionDescription& desc2) { |
| 924 EXPECT_EQ(desc1.session_id(), desc2.session_id()); | 910 EXPECT_EQ(desc1.session_id(), desc2.session_id()); |
| 925 EXPECT_EQ(desc1.session_version(), desc2.session_version()); | 911 EXPECT_EQ(desc1.session_version(), desc2.session_version()); |
| 926 CompareSessionDescription(*desc1.description(), *desc2.description()); | 912 CompareSessionDescription(*desc1.description(), *desc2.description()); |
| 927 if (desc1.number_of_mediasections() != desc2.number_of_mediasections()) | 913 if (desc1.number_of_mediasections() != desc2.number_of_mediasections()) |
| 928 return false; | 914 return false; |
| 929 for (size_t i = 0; i < desc1.number_of_mediasections(); ++i) { | 915 for (size_t i = 0; i < desc1.number_of_mediasections(); ++i) { |
| 930 const IceCandidateCollection* cc1 = desc1.candidates(i); | 916 const IceCandidateCollection* cc1 = desc1.candidates(i); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 transport_info.description.ice_pwd = ice_pwd; | 994 transport_info.description.ice_pwd = ice_pwd; |
| 1009 desc_.AddTransportInfo(transport_info); | 995 desc_.AddTransportInfo(transport_info); |
| 1010 } | 996 } |
| 1011 | 997 |
| 1012 void AddFingerprint() { | 998 void AddFingerprint() { |
| 1013 desc_.RemoveTransportInfoByName(kAudioContentName); | 999 desc_.RemoveTransportInfoByName(kAudioContentName); |
| 1014 desc_.RemoveTransportInfoByName(kVideoContentName); | 1000 desc_.RemoveTransportInfoByName(kVideoContentName); |
| 1015 rtc::SSLFingerprint fingerprint(rtc::DIGEST_SHA_1, | 1001 rtc::SSLFingerprint fingerprint(rtc::DIGEST_SHA_1, |
| 1016 kIdentityDigest, | 1002 kIdentityDigest, |
| 1017 sizeof(kIdentityDigest)); | 1003 sizeof(kIdentityDigest)); |
| 1018 EXPECT_TRUE(desc_.AddTransportInfo( | 1004 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( |
| 1019 TransportInfo(kAudioContentName, | 1005 kAudioContentName, |
| 1020 TransportDescription(std::vector<std::string>(), | 1006 TransportDescription(std::vector<std::string>(), kCandidateUfragVoice, |
| 1021 kCandidateUfragVoice, | 1007 kCandidatePwdVoice, cricket::ICEMODE_FULL, |
| 1022 kCandidatePwdVoice, | 1008 cricket::CONNECTIONROLE_NONE, &fingerprint)))); |
| 1023 cricket::ICEMODE_FULL, | 1009 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( |
| 1024 cricket::CONNECTIONROLE_NONE, | 1010 kVideoContentName, |
| 1025 &fingerprint, Candidates())))); | 1011 TransportDescription(std::vector<std::string>(), kCandidateUfragVideo, |
| 1026 EXPECT_TRUE(desc_.AddTransportInfo( | 1012 kCandidatePwdVideo, cricket::ICEMODE_FULL, |
| 1027 TransportInfo(kVideoContentName, | 1013 cricket::CONNECTIONROLE_NONE, &fingerprint)))); |
| 1028 TransportDescription(std::vector<std::string>(), | |
| 1029 kCandidateUfragVideo, | |
| 1030 kCandidatePwdVideo, | |
| 1031 cricket::ICEMODE_FULL, | |
| 1032 cricket::CONNECTIONROLE_NONE, | |
| 1033 &fingerprint, Candidates())))); | |
| 1034 } | 1014 } |
| 1035 | 1015 |
| 1036 void AddExtmap() { | 1016 void AddExtmap() { |
| 1037 audio_desc_ = static_cast<AudioContentDescription*>( | 1017 audio_desc_ = static_cast<AudioContentDescription*>( |
| 1038 audio_desc_->Copy()); | 1018 audio_desc_->Copy()); |
| 1039 video_desc_ = static_cast<VideoContentDescription*>( | 1019 video_desc_ = static_cast<VideoContentDescription*>( |
| 1040 video_desc_->Copy()); | 1020 video_desc_->Copy()); |
| 1041 audio_desc_->AddRtpHeaderExtension( | 1021 audio_desc_->AddRtpHeaderExtension( |
| 1042 RtpHeaderExtension(kExtmapUri, kExtmapId)); | 1022 RtpHeaderExtension(kExtmapUri, kExtmapId)); |
| 1043 video_desc_->AddRtpHeaderExtension( | 1023 video_desc_->AddRtpHeaderExtension( |
| (...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2752 const cricket::MediaContentDescription* mdesc = | 2732 const cricket::MediaContentDescription* mdesc = |
| 2753 static_cast<const cricket::MediaContentDescription*>( | 2733 static_cast<const cricket::MediaContentDescription*>( |
| 2754 desc->contents()[i].description); | 2734 desc->contents()[i].description); |
| 2755 EXPECT_EQ(media_types[media_content_in_sdp[i]], mdesc->type()); | 2735 EXPECT_EQ(media_types[media_content_in_sdp[i]], mdesc->type()); |
| 2756 } | 2736 } |
| 2757 | 2737 |
| 2758 std::string serialized_sdp = webrtc::SdpSerialize(jdesc); | 2738 std::string serialized_sdp = webrtc::SdpSerialize(jdesc); |
| 2759 EXPECT_EQ(sdp_string, serialized_sdp); | 2739 EXPECT_EQ(sdp_string, serialized_sdp); |
| 2760 } | 2740 } |
| 2761 } | 2741 } |
| OLD | NEW |