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