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