OLD | NEW |
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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 class TransportDescriptionFactoryTest : public testing::Test { | 26 class TransportDescriptionFactoryTest : public testing::Test { |
27 public: | 27 public: |
28 TransportDescriptionFactoryTest() | 28 TransportDescriptionFactoryTest() |
29 : cert1_(rtc::RTCCertificate::Create(scoped_ptr<rtc::SSLIdentity>( | 29 : cert1_(rtc::RTCCertificate::Create(scoped_ptr<rtc::SSLIdentity>( |
30 new rtc::FakeSSLIdentity("User1")).Pass())), | 30 new rtc::FakeSSLIdentity("User1")).Pass())), |
31 cert2_(rtc::RTCCertificate::Create(scoped_ptr<rtc::SSLIdentity>( | 31 cert2_(rtc::RTCCertificate::Create(scoped_ptr<rtc::SSLIdentity>( |
32 new rtc::FakeSSLIdentity("User2")).Pass())) { | 32 new rtc::FakeSSLIdentity("User2")).Pass())) { |
33 } | 33 } |
34 | 34 |
35 void CheckDesc(const TransportDescription* desc, | 35 void CheckDesc(const TransportDescription* desc, const std::string& type, |
36 const std::string& opt, const std::string& ice_ufrag, | 36 const std::string& opt, const std::string& ice_ufrag, |
37 const std::string& ice_pwd, const std::string& dtls_alg) { | 37 const std::string& ice_pwd, const std::string& dtls_alg) { |
38 ASSERT_TRUE(desc != NULL); | 38 ASSERT_TRUE(desc != NULL); |
| 39 EXPECT_EQ(type, desc->transport_type); |
39 EXPECT_EQ(!opt.empty(), desc->HasOption(opt)); | 40 EXPECT_EQ(!opt.empty(), desc->HasOption(opt)); |
40 if (ice_ufrag.empty() && ice_pwd.empty()) { | 41 if (ice_ufrag.empty() && ice_pwd.empty()) { |
41 EXPECT_EQ(static_cast<size_t>(cricket::ICE_UFRAG_LENGTH), | 42 EXPECT_EQ(static_cast<size_t>(cricket::ICE_UFRAG_LENGTH), |
42 desc->ice_ufrag.size()); | 43 desc->ice_ufrag.size()); |
43 EXPECT_EQ(static_cast<size_t>(cricket::ICE_PWD_LENGTH), | 44 EXPECT_EQ(static_cast<size_t>(cricket::ICE_PWD_LENGTH), |
44 desc->ice_pwd.size()); | 45 desc->ice_pwd.size()); |
45 } else { | 46 } else { |
46 EXPECT_EQ(ice_ufrag, desc->ice_ufrag); | 47 EXPECT_EQ(ice_ufrag, desc->ice_ufrag); |
47 EXPECT_EQ(ice_pwd, desc->ice_pwd); | 48 EXPECT_EQ(ice_pwd, desc->ice_pwd); |
48 } | 49 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 114 } |
114 | 115 |
115 protected: | 116 protected: |
116 TransportDescriptionFactory f1_; | 117 TransportDescriptionFactory f1_; |
117 TransportDescriptionFactory f2_; | 118 TransportDescriptionFactory f2_; |
118 | 119 |
119 rtc::scoped_refptr<rtc::RTCCertificate> cert1_; | 120 rtc::scoped_refptr<rtc::RTCCertificate> cert1_; |
120 rtc::scoped_refptr<rtc::RTCCertificate> cert2_; | 121 rtc::scoped_refptr<rtc::RTCCertificate> cert2_; |
121 }; | 122 }; |
122 | 123 |
123 TEST_F(TransportDescriptionFactoryTest, TestOfferDefault) { | 124 // Test that in the default case, we generate the expected G-ICE offer. |
| 125 TEST_F(TransportDescriptionFactoryTest, TestOfferGice) { |
| 126 f1_.set_protocol(cricket::ICEPROTO_GOOGLE); |
124 scoped_ptr<TransportDescription> desc(f1_.CreateOffer( | 127 scoped_ptr<TransportDescription> desc(f1_.CreateOffer( |
125 TransportOptions(), NULL)); | 128 TransportOptions(), NULL)); |
126 CheckDesc(desc.get(), "", "", "", ""); | 129 CheckDesc(desc.get(), cricket::NS_GINGLE_P2P, "", "", "", ""); |
127 } | 130 } |
128 | 131 |
129 TEST_F(TransportDescriptionFactoryTest, TestOfferDtls) { | 132 // Test generating a hybrid offer. |
| 133 TEST_F(TransportDescriptionFactoryTest, TestOfferHybrid) { |
| 134 f1_.set_protocol(cricket::ICEPROTO_HYBRID); |
| 135 scoped_ptr<TransportDescription> desc(f1_.CreateOffer( |
| 136 TransportOptions(), NULL)); |
| 137 CheckDesc(desc.get(), cricket::NS_JINGLE_ICE_UDP, "google-ice", "", "", ""); |
| 138 } |
| 139 |
| 140 // Test generating an ICE-only offer. |
| 141 TEST_F(TransportDescriptionFactoryTest, TestOfferIce) { |
| 142 f1_.set_protocol(cricket::ICEPROTO_RFC5245); |
| 143 scoped_ptr<TransportDescription> desc(f1_.CreateOffer( |
| 144 TransportOptions(), NULL)); |
| 145 CheckDesc(desc.get(), cricket::NS_JINGLE_ICE_UDP, "", "", "", ""); |
| 146 } |
| 147 |
| 148 // Test generating a hybrid offer with DTLS. |
| 149 TEST_F(TransportDescriptionFactoryTest, TestOfferHybridDtls) { |
| 150 f1_.set_protocol(cricket::ICEPROTO_HYBRID); |
130 f1_.set_secure(cricket::SEC_ENABLED); | 151 f1_.set_secure(cricket::SEC_ENABLED); |
131 f1_.set_certificate(cert1_); | 152 f1_.set_certificate(cert1_); |
132 std::string digest_alg; | 153 std::string digest_alg; |
133 ASSERT_TRUE(cert1_->ssl_certificate().GetSignatureDigestAlgorithm( | 154 ASSERT_TRUE(cert1_->ssl_certificate().GetSignatureDigestAlgorithm( |
134 &digest_alg)); | 155 &digest_alg)); |
135 scoped_ptr<TransportDescription> desc(f1_.CreateOffer( | 156 scoped_ptr<TransportDescription> desc(f1_.CreateOffer( |
136 TransportOptions(), NULL)); | 157 TransportOptions(), NULL)); |
137 CheckDesc(desc.get(), "", "", "", digest_alg); | 158 CheckDesc(desc.get(), cricket::NS_JINGLE_ICE_UDP, "google-ice", "", "", |
| 159 digest_alg); |
138 // Ensure it also works with SEC_REQUIRED. | 160 // Ensure it also works with SEC_REQUIRED. |
139 f1_.set_secure(cricket::SEC_REQUIRED); | 161 f1_.set_secure(cricket::SEC_REQUIRED); |
140 desc.reset(f1_.CreateOffer(TransportOptions(), NULL)); | 162 desc.reset(f1_.CreateOffer(TransportOptions(), NULL)); |
141 CheckDesc(desc.get(), "", "", "", digest_alg); | 163 CheckDesc(desc.get(), cricket::NS_JINGLE_ICE_UDP, "google-ice", "", "", |
| 164 digest_alg); |
142 } | 165 } |
143 | 166 |
144 // Test generating an offer with DTLS fails with no identity. | 167 // Test generating a hybrid offer with DTLS fails with no identity. |
145 TEST_F(TransportDescriptionFactoryTest, TestOfferDtlsWithNoIdentity) { | 168 TEST_F(TransportDescriptionFactoryTest, TestOfferHybridDtlsWithNoIdentity) { |
| 169 f1_.set_protocol(cricket::ICEPROTO_HYBRID); |
146 f1_.set_secure(cricket::SEC_ENABLED); | 170 f1_.set_secure(cricket::SEC_ENABLED); |
147 scoped_ptr<TransportDescription> desc(f1_.CreateOffer( | 171 scoped_ptr<TransportDescription> desc(f1_.CreateOffer( |
148 TransportOptions(), NULL)); | 172 TransportOptions(), NULL)); |
149 ASSERT_TRUE(desc.get() == NULL); | 173 ASSERT_TRUE(desc.get() == NULL); |
150 } | 174 } |
151 | 175 |
152 // Test updating an offer with DTLS to pick ICE. | 176 // Test updating a hybrid offer with DTLS to pick ICE. |
153 // The ICE credentials should stay the same in the new offer. | 177 // The ICE credentials should stay the same in the new offer. |
154 TEST_F(TransportDescriptionFactoryTest, TestOfferDtlsReofferDtls) { | 178 TEST_F(TransportDescriptionFactoryTest, TestOfferHybridDtlsReofferIceDtls) { |
| 179 f1_.set_protocol(cricket::ICEPROTO_HYBRID); |
155 f1_.set_secure(cricket::SEC_ENABLED); | 180 f1_.set_secure(cricket::SEC_ENABLED); |
156 f1_.set_certificate(cert1_); | 181 f1_.set_certificate(cert1_); |
157 std::string digest_alg; | 182 std::string digest_alg; |
158 ASSERT_TRUE(cert1_->ssl_certificate().GetSignatureDigestAlgorithm( | 183 ASSERT_TRUE(cert1_->ssl_certificate().GetSignatureDigestAlgorithm( |
159 &digest_alg)); | 184 &digest_alg)); |
160 scoped_ptr<TransportDescription> old_desc(f1_.CreateOffer( | 185 scoped_ptr<TransportDescription> old_desc(f1_.CreateOffer( |
161 TransportOptions(), NULL)); | 186 TransportOptions(), NULL)); |
162 ASSERT_TRUE(old_desc.get() != NULL); | 187 ASSERT_TRUE(old_desc.get() != NULL); |
| 188 f1_.set_protocol(cricket::ICEPROTO_RFC5245); |
163 scoped_ptr<TransportDescription> desc( | 189 scoped_ptr<TransportDescription> desc( |
164 f1_.CreateOffer(TransportOptions(), old_desc.get())); | 190 f1_.CreateOffer(TransportOptions(), old_desc.get())); |
165 CheckDesc(desc.get(), "", | 191 CheckDesc(desc.get(), cricket::NS_JINGLE_ICE_UDP, "", |
166 old_desc->ice_ufrag, old_desc->ice_pwd, digest_alg); | 192 old_desc->ice_ufrag, old_desc->ice_pwd, digest_alg); |
167 } | 193 } |
168 | 194 |
169 TEST_F(TransportDescriptionFactoryTest, TestAnswerDefault) { | 195 // Test that we can answer a GICE offer with GICE. |
| 196 TEST_F(TransportDescriptionFactoryTest, TestAnswerGiceToGice) { |
| 197 f1_.set_protocol(cricket::ICEPROTO_GOOGLE); |
| 198 f2_.set_protocol(cricket::ICEPROTO_GOOGLE); |
170 scoped_ptr<TransportDescription> offer(f1_.CreateOffer( | 199 scoped_ptr<TransportDescription> offer(f1_.CreateOffer( |
171 TransportOptions(), NULL)); | 200 TransportOptions(), NULL)); |
172 ASSERT_TRUE(offer.get() != NULL); | 201 ASSERT_TRUE(offer.get() != NULL); |
173 scoped_ptr<TransportDescription> desc(f2_.CreateAnswer( | 202 scoped_ptr<TransportDescription> desc(f2_.CreateAnswer( |
174 offer.get(), TransportOptions(), NULL)); | 203 offer.get(), TransportOptions(), NULL)); |
175 CheckDesc(desc.get(), "", "", "", ""); | 204 CheckDesc(desc.get(), cricket::NS_GINGLE_P2P, "", "", "", ""); |
| 205 // Should get the same result when answering as hybrid. |
| 206 f2_.set_protocol(cricket::ICEPROTO_HYBRID); |
176 desc.reset(f2_.CreateAnswer(offer.get(), TransportOptions(), | 207 desc.reset(f2_.CreateAnswer(offer.get(), TransportOptions(), |
177 NULL)); | 208 NULL)); |
178 CheckDesc(desc.get(), "", "", "", ""); | 209 CheckDesc(desc.get(), cricket::NS_GINGLE_P2P, "", "", "", ""); |
| 210 } |
| 211 |
| 212 // Test that we can answer a hybrid offer with GICE. |
| 213 TEST_F(TransportDescriptionFactoryTest, TestAnswerGiceToHybrid) { |
| 214 f1_.set_protocol(cricket::ICEPROTO_HYBRID); |
| 215 f2_.set_protocol(cricket::ICEPROTO_GOOGLE); |
| 216 scoped_ptr<TransportDescription> offer(f1_.CreateOffer( |
| 217 TransportOptions(), NULL)); |
| 218 ASSERT_TRUE(offer.get() != NULL); |
| 219 scoped_ptr<TransportDescription> desc( |
| 220 f2_.CreateAnswer(offer.get(), TransportOptions(), NULL)); |
| 221 CheckDesc(desc.get(), cricket::NS_GINGLE_P2P, "", "", "", ""); |
| 222 } |
| 223 |
| 224 // Test that we can answer a hybrid offer with ICE. |
| 225 TEST_F(TransportDescriptionFactoryTest, TestAnswerIceToHybrid) { |
| 226 f1_.set_protocol(cricket::ICEPROTO_HYBRID); |
| 227 f2_.set_protocol(cricket::ICEPROTO_RFC5245); |
| 228 scoped_ptr<TransportDescription> offer(f1_.CreateOffer( |
| 229 TransportOptions(), NULL)); |
| 230 ASSERT_TRUE(offer.get() != NULL); |
| 231 scoped_ptr<TransportDescription> desc( |
| 232 f2_.CreateAnswer(offer.get(), TransportOptions(), NULL)); |
| 233 CheckDesc(desc.get(), cricket::NS_JINGLE_ICE_UDP, "", "", "", ""); |
| 234 // Should get the same result when answering as hybrid. |
| 235 f2_.set_protocol(cricket::ICEPROTO_HYBRID); |
| 236 desc.reset(f2_.CreateAnswer(offer.get(), TransportOptions(), |
| 237 NULL)); |
| 238 CheckDesc(desc.get(), cricket::NS_JINGLE_ICE_UDP, "", "", "", ""); |
| 239 } |
| 240 |
| 241 // Test that we can answer an ICE offer with ICE. |
| 242 TEST_F(TransportDescriptionFactoryTest, TestAnswerIceToIce) { |
| 243 f1_.set_protocol(cricket::ICEPROTO_RFC5245); |
| 244 f2_.set_protocol(cricket::ICEPROTO_RFC5245); |
| 245 scoped_ptr<TransportDescription> offer(f1_.CreateOffer( |
| 246 TransportOptions(), NULL)); |
| 247 ASSERT_TRUE(offer.get() != NULL); |
| 248 scoped_ptr<TransportDescription> desc(f2_.CreateAnswer( |
| 249 offer.get(), TransportOptions(), NULL)); |
| 250 CheckDesc(desc.get(), cricket::NS_JINGLE_ICE_UDP, "", "", "", ""); |
| 251 // Should get the same result when answering as hybrid. |
| 252 f2_.set_protocol(cricket::ICEPROTO_HYBRID); |
| 253 desc.reset(f2_.CreateAnswer(offer.get(), TransportOptions(), |
| 254 NULL)); |
| 255 CheckDesc(desc.get(), cricket::NS_JINGLE_ICE_UDP, "", "", "", ""); |
| 256 } |
| 257 |
| 258 // Test that we can't answer a GICE offer with ICE. |
| 259 TEST_F(TransportDescriptionFactoryTest, TestAnswerIceToGice) { |
| 260 f1_.set_protocol(cricket::ICEPROTO_GOOGLE); |
| 261 f2_.set_protocol(cricket::ICEPROTO_RFC5245); |
| 262 scoped_ptr<TransportDescription> offer( |
| 263 f1_.CreateOffer(TransportOptions(), NULL)); |
| 264 ASSERT_TRUE(offer.get() != NULL); |
| 265 scoped_ptr<TransportDescription> desc( |
| 266 f2_.CreateAnswer(offer.get(), TransportOptions(), NULL)); |
| 267 ASSERT_TRUE(desc.get() == NULL); |
| 268 } |
| 269 |
| 270 // Test that we can't answer an ICE offer with GICE. |
| 271 TEST_F(TransportDescriptionFactoryTest, TestAnswerGiceToIce) { |
| 272 f1_.set_protocol(cricket::ICEPROTO_RFC5245); |
| 273 f2_.set_protocol(cricket::ICEPROTO_GOOGLE); |
| 274 scoped_ptr<TransportDescription> offer( |
| 275 f1_.CreateOffer(TransportOptions(), NULL)); |
| 276 ASSERT_TRUE(offer.get() != NULL); |
| 277 scoped_ptr<TransportDescription> desc(f2_.CreateAnswer( |
| 278 offer.get(), TransportOptions(), NULL)); |
| 279 ASSERT_TRUE(desc.get() == NULL); |
179 } | 280 } |
180 | 281 |
181 // Test that we can update an answer properly; ICE credentials shouldn't change. | 282 // Test that we can update an answer properly; ICE credentials shouldn't change. |
182 TEST_F(TransportDescriptionFactoryTest, TestReanswer) { | 283 TEST_F(TransportDescriptionFactoryTest, TestAnswerIceToIceReanswer) { |
| 284 f1_.set_protocol(cricket::ICEPROTO_RFC5245); |
| 285 f2_.set_protocol(cricket::ICEPROTO_RFC5245); |
183 scoped_ptr<TransportDescription> offer( | 286 scoped_ptr<TransportDescription> offer( |
184 f1_.CreateOffer(TransportOptions(), NULL)); | 287 f1_.CreateOffer(TransportOptions(), NULL)); |
185 ASSERT_TRUE(offer.get() != NULL); | 288 ASSERT_TRUE(offer.get() != NULL); |
186 scoped_ptr<TransportDescription> old_desc( | 289 scoped_ptr<TransportDescription> old_desc( |
187 f2_.CreateAnswer(offer.get(), TransportOptions(), NULL)); | 290 f2_.CreateAnswer(offer.get(), TransportOptions(), NULL)); |
188 ASSERT_TRUE(old_desc.get() != NULL); | 291 ASSERT_TRUE(old_desc.get() != NULL); |
189 scoped_ptr<TransportDescription> desc( | 292 scoped_ptr<TransportDescription> desc( |
190 f2_.CreateAnswer(offer.get(), TransportOptions(), | 293 f2_.CreateAnswer(offer.get(), TransportOptions(), |
191 old_desc.get())); | 294 old_desc.get())); |
192 ASSERT_TRUE(desc.get() != NULL); | 295 ASSERT_TRUE(desc.get() != NULL); |
193 CheckDesc(desc.get(), "", | 296 CheckDesc(desc.get(), cricket::NS_JINGLE_ICE_UDP, "", |
194 old_desc->ice_ufrag, old_desc->ice_pwd, ""); | 297 old_desc->ice_ufrag, old_desc->ice_pwd, ""); |
195 } | 298 } |
196 | 299 |
197 // Test that we handle answering an offer with DTLS with no DTLS. | 300 // Test that we handle answering an offer with DTLS with no DTLS. |
198 TEST_F(TransportDescriptionFactoryTest, TestAnswerDtlsToNoDtls) { | 301 TEST_F(TransportDescriptionFactoryTest, TestAnswerHybridToHybridDtls) { |
| 302 f1_.set_protocol(cricket::ICEPROTO_HYBRID); |
199 f1_.set_secure(cricket::SEC_ENABLED); | 303 f1_.set_secure(cricket::SEC_ENABLED); |
200 f1_.set_certificate(cert1_); | 304 f1_.set_certificate(cert1_); |
| 305 f2_.set_protocol(cricket::ICEPROTO_HYBRID); |
201 scoped_ptr<TransportDescription> offer( | 306 scoped_ptr<TransportDescription> offer( |
202 f1_.CreateOffer(TransportOptions(), NULL)); | 307 f1_.CreateOffer(TransportOptions(), NULL)); |
203 ASSERT_TRUE(offer.get() != NULL); | 308 ASSERT_TRUE(offer.get() != NULL); |
204 scoped_ptr<TransportDescription> desc( | 309 scoped_ptr<TransportDescription> desc( |
205 f2_.CreateAnswer(offer.get(), TransportOptions(), NULL)); | 310 f2_.CreateAnswer(offer.get(), TransportOptions(), NULL)); |
206 CheckDesc(desc.get(), "", "", "", ""); | 311 CheckDesc(desc.get(), cricket::NS_JINGLE_ICE_UDP, "", "", "", ""); |
207 } | 312 } |
208 | 313 |
209 // Test that we handle answering an offer without DTLS if we have DTLS enabled, | 314 // Test that we handle answering an offer without DTLS if we have DTLS enabled, |
210 // but fail if we require DTLS. | 315 // but fail if we require DTLS. |
211 TEST_F(TransportDescriptionFactoryTest, TestAnswerNoDtlsToDtls) { | 316 TEST_F(TransportDescriptionFactoryTest, TestAnswerHybridDtlsToHybrid) { |
| 317 f1_.set_protocol(cricket::ICEPROTO_HYBRID); |
| 318 f2_.set_protocol(cricket::ICEPROTO_HYBRID); |
212 f2_.set_secure(cricket::SEC_ENABLED); | 319 f2_.set_secure(cricket::SEC_ENABLED); |
213 f2_.set_certificate(cert2_); | 320 f2_.set_certificate(cert2_); |
214 scoped_ptr<TransportDescription> offer( | 321 scoped_ptr<TransportDescription> offer( |
215 f1_.CreateOffer(TransportOptions(), NULL)); | 322 f1_.CreateOffer(TransportOptions(), NULL)); |
216 ASSERT_TRUE(offer.get() != NULL); | 323 ASSERT_TRUE(offer.get() != NULL); |
217 scoped_ptr<TransportDescription> desc( | 324 scoped_ptr<TransportDescription> desc( |
218 f2_.CreateAnswer(offer.get(), TransportOptions(), NULL)); | 325 f2_.CreateAnswer(offer.get(), TransportOptions(), NULL)); |
219 CheckDesc(desc.get(), "", "", "", ""); | 326 CheckDesc(desc.get(), cricket::NS_JINGLE_ICE_UDP, "", "", "", ""); |
220 f2_.set_secure(cricket::SEC_REQUIRED); | 327 f2_.set_secure(cricket::SEC_REQUIRED); |
221 desc.reset(f2_.CreateAnswer(offer.get(), TransportOptions(), | 328 desc.reset(f2_.CreateAnswer(offer.get(), TransportOptions(), |
222 NULL)); | 329 NULL)); |
223 ASSERT_TRUE(desc.get() == NULL); | 330 ASSERT_TRUE(desc.get() == NULL); |
224 } | 331 } |
225 | 332 |
226 // Test that we handle answering an DTLS offer with DTLS, both if we have | 333 // Test that we handle answering an DTLS offer with DTLS, both if we have |
227 // DTLS enabled and required. | 334 // DTLS enabled and required. |
228 TEST_F(TransportDescriptionFactoryTest, TestAnswerDtlsToDtls) { | 335 TEST_F(TransportDescriptionFactoryTest, TestAnswerHybridDtlsToHybridDtls) { |
| 336 f1_.set_protocol(cricket::ICEPROTO_HYBRID); |
229 f1_.set_secure(cricket::SEC_ENABLED); | 337 f1_.set_secure(cricket::SEC_ENABLED); |
230 f1_.set_certificate(cert1_); | 338 f1_.set_certificate(cert1_); |
231 | 339 |
| 340 f2_.set_protocol(cricket::ICEPROTO_HYBRID); |
232 f2_.set_secure(cricket::SEC_ENABLED); | 341 f2_.set_secure(cricket::SEC_ENABLED); |
233 f2_.set_certificate(cert2_); | 342 f2_.set_certificate(cert2_); |
234 // f2_ produces the answer that is being checked in this test, so the | 343 // f2_ produces the answer that is being checked in this test, so the |
235 // answer must contain fingerprint lines with cert2_'s digest algorithm. | 344 // answer must contain fingerprint lines with cert2_'s digest algorithm. |
236 std::string digest_alg2; | 345 std::string digest_alg2; |
237 ASSERT_TRUE(cert2_->ssl_certificate().GetSignatureDigestAlgorithm( | 346 ASSERT_TRUE(cert2_->ssl_certificate().GetSignatureDigestAlgorithm( |
238 &digest_alg2)); | 347 &digest_alg2)); |
239 | 348 |
240 scoped_ptr<TransportDescription> offer( | 349 scoped_ptr<TransportDescription> offer( |
241 f1_.CreateOffer(TransportOptions(), NULL)); | 350 f1_.CreateOffer(TransportOptions(), NULL)); |
242 ASSERT_TRUE(offer.get() != NULL); | 351 ASSERT_TRUE(offer.get() != NULL); |
243 scoped_ptr<TransportDescription> desc( | 352 scoped_ptr<TransportDescription> desc( |
244 f2_.CreateAnswer(offer.get(), TransportOptions(), NULL)); | 353 f2_.CreateAnswer(offer.get(), TransportOptions(), NULL)); |
245 CheckDesc(desc.get(), "", "", "", digest_alg2); | 354 CheckDesc(desc.get(), cricket::NS_JINGLE_ICE_UDP, "", "", "", digest_alg2); |
246 f2_.set_secure(cricket::SEC_REQUIRED); | 355 f2_.set_secure(cricket::SEC_REQUIRED); |
247 desc.reset(f2_.CreateAnswer(offer.get(), TransportOptions(), | 356 desc.reset(f2_.CreateAnswer(offer.get(), TransportOptions(), |
248 NULL)); | 357 NULL)); |
249 CheckDesc(desc.get(), "", "", "", digest_alg2); | 358 CheckDesc(desc.get(), cricket::NS_JINGLE_ICE_UDP, "", "", "", digest_alg2); |
250 } | 359 } |
251 | 360 |
252 // Test that ice ufrag and password is changed in an updated offer and answer | 361 // Test that ice ufrag and password is changed in an updated offer and answer |
253 // if |TransportDescriptionOptions::ice_restart| is true. | 362 // if |TransportDescriptionOptions::ice_restart| is true. |
254 TEST_F(TransportDescriptionFactoryTest, TestIceRestart) { | 363 TEST_F(TransportDescriptionFactoryTest, TestIceRestart) { |
255 TestIceRestart(false); | 364 TestIceRestart(false); |
256 } | 365 } |
257 | 366 |
258 // Test that ice ufrag and password is changed in an updated offer and answer | 367 // Test that ice ufrag and password is changed in an updated offer and answer |
259 // if |TransportDescriptionOptions::ice_restart| is true and DTLS is enabled. | 368 // if |TransportDescriptionOptions::ice_restart| is true and DTLS is enabled. |
260 TEST_F(TransportDescriptionFactoryTest, TestIceRestartWithDtls) { | 369 TEST_F(TransportDescriptionFactoryTest, TestIceRestartWithDtls) { |
261 TestIceRestart(true); | 370 TestIceRestart(true); |
262 } | 371 } |
OLD | NEW |