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 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "webrtc/p2p/base/constants.h" | 14 #include "webrtc/p2p/base/constants.h" |
15 #include "webrtc/p2p/base/transportdescription.h" | 15 #include "webrtc/p2p/base/transportdescription.h" |
16 #include "webrtc/p2p/base/transportdescriptionfactory.h" | 16 #include "webrtc/p2p/base/transportdescriptionfactory.h" |
17 #include "webrtc/base/fakesslidentity.h" | 17 #include "webrtc/base/fakesslidentity.h" |
18 #include "webrtc/base/gunit.h" | 18 #include "webrtc/base/gunit.h" |
19 #include "webrtc/base/ssladapter.h" | 19 #include "webrtc/base/ssladapter.h" |
20 | 20 |
21 using rtc::scoped_ptr; | 21 using rtc::scoped_ptr; |
22 using cricket::TransportDescriptionFactory; | 22 using cricket::TransportDescriptionFactory; |
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 : cert1_(rtc::RTCCertificate::Create(scoped_ptr<rtc::SSLIdentity>( | 29 : cert1_(rtc::RTCCertificate::Create( |
30 new rtc::FakeSSLIdentity("User1")).Pass())), | 30 scoped_ptr<rtc::SSLIdentity>(new rtc::FakeSSLIdentity("User1")))), |
31 cert2_(rtc::RTCCertificate::Create(scoped_ptr<rtc::SSLIdentity>( | 31 cert2_(rtc::RTCCertificate::Create( |
32 new rtc::FakeSSLIdentity("User2")).Pass())) { | 32 scoped_ptr<rtc::SSLIdentity>(new rtc::FakeSSLIdentity("User2")))) {} |
33 } | |
34 | 33 |
35 void CheckDesc(const TransportDescription* desc, | 34 void CheckDesc(const TransportDescription* desc, |
36 const std::string& opt, const std::string& ice_ufrag, | 35 const std::string& opt, const std::string& ice_ufrag, |
37 const std::string& ice_pwd, const std::string& dtls_alg) { | 36 const std::string& ice_pwd, const std::string& dtls_alg) { |
38 ASSERT_TRUE(desc != NULL); | 37 ASSERT_TRUE(desc != NULL); |
39 EXPECT_EQ(!opt.empty(), desc->HasOption(opt)); | 38 EXPECT_EQ(!opt.empty(), desc->HasOption(opt)); |
40 if (ice_ufrag.empty() && ice_pwd.empty()) { | 39 if (ice_ufrag.empty() && ice_pwd.empty()) { |
41 EXPECT_EQ(static_cast<size_t>(cricket::ICE_UFRAG_LENGTH), | 40 EXPECT_EQ(static_cast<size_t>(cricket::ICE_UFRAG_LENGTH), |
42 desc->ice_ufrag.size()); | 41 desc->ice_ufrag.size()); |
43 EXPECT_EQ(static_cast<size_t>(cricket::ICE_PWD_LENGTH), | 42 EXPECT_EQ(static_cast<size_t>(cricket::ICE_PWD_LENGTH), |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 // if |TransportDescriptionOptions::ice_restart| is true. | 252 // if |TransportDescriptionOptions::ice_restart| is true. |
254 TEST_F(TransportDescriptionFactoryTest, TestIceRestart) { | 253 TEST_F(TransportDescriptionFactoryTest, TestIceRestart) { |
255 TestIceRestart(false); | 254 TestIceRestart(false); |
256 } | 255 } |
257 | 256 |
258 // Test that ice ufrag and password is changed in an updated offer and answer | 257 // 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. | 258 // if |TransportDescriptionOptions::ice_restart| is true and DTLS is enabled. |
260 TEST_F(TransportDescriptionFactoryTest, TestIceRestartWithDtls) { | 259 TEST_F(TransportDescriptionFactoryTest, TestIceRestartWithDtls) { |
261 TestIceRestart(true); | 260 TestIceRestart(true); |
262 } | 261 } |
OLD | NEW |