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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 // Media index of candidates belonging to the first media content. | 103 // Media index of candidates belonging to the first media content. |
104 static const int kMediaContentIndex0 = 0; | 104 static const int kMediaContentIndex0 = 0; |
105 static const char kMediaContentName0[] = "audio"; | 105 static const char kMediaContentName0[] = "audio"; |
106 | 106 |
107 // Media index of candidates belonging to the second media content. | 107 // Media index of candidates belonging to the second media content. |
108 static const int kMediaContentIndex1 = 1; | 108 static const int kMediaContentIndex1 = 1; |
109 static const char kMediaContentName1[] = "video"; | 109 static const char kMediaContentName1[] = "video"; |
110 | 110 |
111 static const int kIceCandidatesTimeout = 10000; | 111 static const int kIceCandidatesTimeout = 10000; |
112 // STUN timeout with all retransmissions is a total of 9500ms. | |
113 static const int kStunTimeout = 9500; | |
114 | 112 |
115 static const char kFakeDtlsFingerprint[] = | 113 static const char kFakeDtlsFingerprint[] = |
116 "BB:CD:72:F7:2F:D0:BA:43:F3:68:B1:0C:23:72:B6:4A:" | 114 "BB:CD:72:F7:2F:D0:BA:43:F3:68:B1:0C:23:72:B6:4A:" |
117 "0F:DE:34:06:BC:E0:FE:01:BC:73:C8:6D:F4:65:D5:24"; | 115 "0F:DE:34:06:BC:E0:FE:01:BC:73:C8:6D:F4:65:D5:24"; |
118 | 116 |
119 static const char kTooLongIceUfragPwd[] = | 117 static const char kTooLongIceUfragPwd[] = |
120 "IceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfrag" | 118 "IceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfrag" |
121 "IceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfrag" | 119 "IceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfrag" |
122 "IceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfrag" | 120 "IceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfrag" |
123 "IceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfrag"; | 121 "IceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfragIceUfrag"; |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); | 1497 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); |
1500 AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort)); | 1498 AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort)); |
1501 Init(); | 1499 Init(); |
1502 SendAudioVideoStream1(); | 1500 SendAudioVideoStream1(); |
1503 InitiateCall(); | 1501 InitiateCall(); |
1504 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); | 1502 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); |
1505 EXPECT_EQ(8u, observer_.mline_0_candidates_.size()); | 1503 EXPECT_EQ(8u, observer_.mline_0_candidates_.size()); |
1506 EXPECT_EQ(8u, observer_.mline_1_candidates_.size()); | 1504 EXPECT_EQ(8u, observer_.mline_1_candidates_.size()); |
1507 } | 1505 } |
1508 | 1506 |
1509 TEST_F(WebRtcSessionTest, TestStunError) { | 1507 // Crashes on Win only. See webrtc:5411. |
1510 rtc::ScopedFakeClock clock; | 1508 #if defined(WEBRTC_WIN) |
1511 | 1509 #define MAYBE_TestStunError DISABLED_TestStunError |
| 1510 #else |
| 1511 #define MAYBE_TestStunError TestStunError |
| 1512 #endif |
| 1513 TEST_F(WebRtcSessionTest, MAYBE_TestStunError) { |
1512 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); | 1514 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); |
1513 AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort)); | 1515 AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort)); |
1514 fss_->AddRule(false, | 1516 fss_->AddRule(false, |
1515 rtc::FP_UDP, | 1517 rtc::FP_UDP, |
1516 rtc::FD_ANY, | 1518 rtc::FD_ANY, |
1517 rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); | 1519 rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); |
1518 Init(); | 1520 Init(); |
1519 SendAudioVideoStream1(); | 1521 SendAudioVideoStream1(); |
1520 InitiateCall(); | 1522 InitiateCall(); |
1521 // Since kClientAddrHost1 is blocked, not expecting stun candidates for it. | 1523 // Since kClientAddrHost1 is blocked, not expecting stun candidates for it. |
1522 EXPECT_TRUE_SIMULATED_WAIT(observer_.oncandidatesready_, kStunTimeout, clock); | 1524 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); |
1523 EXPECT_EQ(6u, observer_.mline_0_candidates_.size()); | 1525 EXPECT_EQ(6u, observer_.mline_0_candidates_.size()); |
1524 EXPECT_EQ(6u, observer_.mline_1_candidates_.size()); | 1526 EXPECT_EQ(6u, observer_.mline_1_candidates_.size()); |
1525 // Reset session before scoped fake clock goes out of scope to avoid TSan | |
1526 // warning. | |
1527 session_.reset(nullptr); | |
1528 } | 1527 } |
1529 | 1528 |
1530 TEST_F(WebRtcSessionTest, SetSdpFailedOnInvalidSdp) { | 1529 TEST_F(WebRtcSessionTest, SetSdpFailedOnInvalidSdp) { |
1531 Init(); | 1530 Init(); |
1532 SessionDescriptionInterface* offer = NULL; | 1531 SessionDescriptionInterface* offer = NULL; |
1533 // Since |offer| is NULL, there's no way to tell if it's an offer or answer. | 1532 // Since |offer| is NULL, there's no way to tell if it's an offer or answer. |
1534 std::string unknown_action; | 1533 std::string unknown_action; |
1535 SetLocalDescriptionExpectError(unknown_action, kInvalidSdp, offer); | 1534 SetLocalDescriptionExpectError(unknown_action, kInvalidSdp, offer); |
1536 SetRemoteDescriptionExpectError(unknown_action, kInvalidSdp, offer); | 1535 SetRemoteDescriptionExpectError(unknown_action, kInvalidSdp, offer); |
1537 } | 1536 } |
(...skipping 2878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4416 } | 4415 } |
4417 | 4416 |
4418 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4417 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
4419 // currently fails because upon disconnection and reconnection OnIceComplete is | 4418 // currently fails because upon disconnection and reconnection OnIceComplete is |
4420 // called more than once without returning to IceGatheringGathering. | 4419 // called more than once without returning to IceGatheringGathering. |
4421 | 4420 |
4422 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4421 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
4423 WebRtcSessionTest, | 4422 WebRtcSessionTest, |
4424 testing::Values(ALREADY_GENERATED, | 4423 testing::Values(ALREADY_GENERATED, |
4425 DTLS_IDENTITY_STORE)); | 4424 DTLS_IDENTITY_STORE)); |
OLD | NEW |