| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 // draft-ietf-mmusic-sctp-sdp-12 | 290 // draft-ietf-mmusic-sctp-sdp-12 |
| 291 static const char kSdpSctpDataChannelStringWithSctpPort[] = | 291 static const char kSdpSctpDataChannelStringWithSctpPort[] = |
| 292 "m=application 9 DTLS/SCTP webrtc-datachannel\r\n" | 292 "m=application 9 DTLS/SCTP webrtc-datachannel\r\n" |
| 293 "a=max-message-size=100000\r\n" | 293 "a=max-message-size=100000\r\n" |
| 294 "a=sctp-port 5000\r\n" | 294 "a=sctp-port 5000\r\n" |
| 295 "c=IN IP4 0.0.0.0\r\n" | 295 "c=IN IP4 0.0.0.0\r\n" |
| 296 "a=ice-ufrag:ufrag_data\r\n" | 296 "a=ice-ufrag:ufrag_data\r\n" |
| 297 "a=ice-pwd:pwd_data\r\n" | 297 "a=ice-pwd:pwd_data\r\n" |
| 298 "a=mid:data_content_name\r\n"; | 298 "a=mid:data_content_name\r\n"; |
| 299 | 299 |
| 300 static const char kSdpSctpDataChannelStringWithSctpColonPort[] = |
| 301 "m=application 9 DTLS/SCTP webrtc-datachannel\r\n" |
| 302 "a=max-message-size=100000\r\n" |
| 303 "a=sctp-port:5000\r\n" |
| 304 "c=IN IP4 0.0.0.0\r\n" |
| 305 "a=ice-ufrag:ufrag_data\r\n" |
| 306 "a=ice-pwd:pwd_data\r\n" |
| 307 "a=mid:data_content_name\r\n"; |
| 308 |
| 300 static const char kSdpSctpDataChannelWithCandidatesString[] = | 309 static const char kSdpSctpDataChannelWithCandidatesString[] = |
| 301 "m=application 2345 DTLS/SCTP 5000\r\n" | 310 "m=application 2345 DTLS/SCTP 5000\r\n" |
| 302 "c=IN IP4 74.125.127.126\r\n" | 311 "c=IN IP4 74.125.127.126\r\n" |
| 303 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host " | 312 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host " |
| 304 "generation 2\r\n" | 313 "generation 2\r\n" |
| 305 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1238 typ host " | 314 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1238 typ host " |
| 306 "generation 2\r\n" | 315 "generation 2\r\n" |
| 307 "a=candidate:a0+B/3 1 udp 2130706432 74.125.127.126 2345 typ srflx " | 316 "a=candidate:a0+B/3 1 udp 2130706432 74.125.127.126 2345 typ srflx " |
| 308 "raddr 192.168.1.5 rport 2346 " | 317 "raddr 192.168.1.5 rport 2346 " |
| 309 "generation 2\r\n" | 318 "generation 2\r\n" |
| (...skipping 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2119 EXPECT_TRUE(SdpDeserialize(sdp_with_data, &jdesc_output)); | 2128 EXPECT_TRUE(SdpDeserialize(sdp_with_data, &jdesc_output)); |
| 2120 EXPECT_TRUE(CompareSessionDescription(jdesc, jdesc_output)); | 2129 EXPECT_TRUE(CompareSessionDescription(jdesc, jdesc_output)); |
| 2121 | 2130 |
| 2122 // Verify with TCP/DTLS/SCTP. | 2131 // Verify with TCP/DTLS/SCTP. |
| 2123 sdp_with_data.replace(sdp_with_data.find(kUdpDtlsSctp), | 2132 sdp_with_data.replace(sdp_with_data.find(kUdpDtlsSctp), |
| 2124 strlen(kUdpDtlsSctp), kTcpDtlsSctp); | 2133 strlen(kUdpDtlsSctp), kTcpDtlsSctp); |
| 2125 EXPECT_TRUE(SdpDeserialize(sdp_with_data, &jdesc_output)); | 2134 EXPECT_TRUE(SdpDeserialize(sdp_with_data, &jdesc_output)); |
| 2126 EXPECT_TRUE(CompareSessionDescription(jdesc, jdesc_output)); | 2135 EXPECT_TRUE(CompareSessionDescription(jdesc, jdesc_output)); |
| 2127 } | 2136 } |
| 2128 | 2137 |
| 2138 TEST_F(WebRtcSdpTest, DeserializeSdpWithSctpDataChannelsWithSctpColonPort) { |
| 2139 AddSctpDataChannel(); |
| 2140 JsepSessionDescription jdesc(kDummyString); |
| 2141 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); |
| 2142 |
| 2143 std::string sdp_with_data = kSdpString; |
| 2144 sdp_with_data.append(kSdpSctpDataChannelStringWithSctpColonPort); |
| 2145 JsepSessionDescription jdesc_output(kDummyString); |
| 2146 |
| 2147 // Verify with DTLS/SCTP. |
| 2148 EXPECT_TRUE(SdpDeserialize(sdp_with_data, &jdesc_output)); |
| 2149 EXPECT_TRUE(CompareSessionDescription(jdesc, jdesc_output)); |
| 2150 |
| 2151 // Verify with UDP/DTLS/SCTP. |
| 2152 sdp_with_data.replace(sdp_with_data.find(kDtlsSctp), |
| 2153 strlen(kDtlsSctp), kUdpDtlsSctp); |
| 2154 EXPECT_TRUE(SdpDeserialize(sdp_with_data, &jdesc_output)); |
| 2155 EXPECT_TRUE(CompareSessionDescription(jdesc, jdesc_output)); |
| 2156 |
| 2157 // Verify with TCP/DTLS/SCTP. |
| 2158 sdp_with_data.replace(sdp_with_data.find(kUdpDtlsSctp), |
| 2159 strlen(kUdpDtlsSctp), kTcpDtlsSctp); |
| 2160 EXPECT_TRUE(SdpDeserialize(sdp_with_data, &jdesc_output)); |
| 2161 EXPECT_TRUE(CompareSessionDescription(jdesc, jdesc_output)); |
| 2162 } |
| 2163 |
| 2129 // Test to check the behaviour if sctp-port is specified | 2164 // Test to check the behaviour if sctp-port is specified |
| 2130 // on the m= line and in a=sctp-port. | 2165 // on the m= line and in a=sctp-port. |
| 2131 TEST_F(WebRtcSdpTest, DeserializeSdpWithMultiSctpPort) { | 2166 TEST_F(WebRtcSdpTest, DeserializeSdpWithMultiSctpPort) { |
| 2132 AddSctpDataChannel(); | 2167 AddSctpDataChannel(); |
| 2133 JsepSessionDescription jdesc(kDummyString); | 2168 JsepSessionDescription jdesc(kDummyString); |
| 2134 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); | 2169 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); |
| 2135 | 2170 |
| 2136 std::string sdp_with_data = kSdpString; | 2171 std::string sdp_with_data = kSdpString; |
| 2137 // Append m= attributes | 2172 // Append m= attributes |
| 2138 sdp_with_data.append(kSdpSctpDataChannelString); | 2173 sdp_with_data.append(kSdpSctpDataChannelString); |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2664 const cricket::MediaContentDescription* mdesc = | 2699 const cricket::MediaContentDescription* mdesc = |
| 2665 static_cast<const cricket::MediaContentDescription*>( | 2700 static_cast<const cricket::MediaContentDescription*>( |
| 2666 desc->contents()[i].description); | 2701 desc->contents()[i].description); |
| 2667 EXPECT_EQ(media_types[media_content_in_sdp[i]], mdesc->type()); | 2702 EXPECT_EQ(media_types[media_content_in_sdp[i]], mdesc->type()); |
| 2668 } | 2703 } |
| 2669 | 2704 |
| 2670 std::string serialized_sdp = webrtc::SdpSerialize(jdesc); | 2705 std::string serialized_sdp = webrtc::SdpSerialize(jdesc); |
| 2671 EXPECT_EQ(sdp_string, serialized_sdp); | 2706 EXPECT_EQ(sdp_string, serialized_sdp); |
| 2672 } | 2707 } |
| 2673 } | 2708 } |
| OLD | NEW |