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