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