Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Side by Side Diff: webrtc/api/webrtcsession_unittest.cc

Issue 2024813004: Improving the fake clock and using it to fix a flaky STUN timeout test. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Revising comments etc. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/base/base_tests.gyp » ('j') | webrtc/base/fakeclock.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); 1501 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
1500 AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort)); 1502 AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort));
1501 Init(); 1503 Init();
1502 SendAudioVideoStream1(); 1504 SendAudioVideoStream1();
1503 InitiateCall(); 1505 InitiateCall();
1504 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); 1506 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout);
1505 EXPECT_EQ(8u, observer_.mline_0_candidates_.size()); 1507 EXPECT_EQ(8u, observer_.mline_0_candidates_.size());
1506 EXPECT_EQ(8u, observer_.mline_1_candidates_.size()); 1508 EXPECT_EQ(8u, observer_.mline_1_candidates_.size());
1507 } 1509 }
1508 1510
1509 // Crashes on Win only. See webrtc:5411. 1511 TEST_F(WebRtcSessionTest, TestStunError) {
1510 #if defined(WEBRTC_WIN) 1512 rtc::ScopedFakeClock sfc;
1511 #define MAYBE_TestStunError DISABLED_TestStunError 1513
1512 #else
1513 #define MAYBE_TestStunError TestStunError
1514 #endif
1515 TEST_F(WebRtcSessionTest, MAYBE_TestStunError) {
1516 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); 1514 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
1517 AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort)); 1515 AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort));
1518 fss_->AddRule(false, 1516 fss_->AddRule(false,
1519 rtc::FP_UDP, 1517 rtc::FP_UDP,
1520 rtc::FD_ANY, 1518 rtc::FD_ANY,
1521 rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); 1519 rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
1522 Init(); 1520 Init();
1523 SendAudioVideoStream1(); 1521 SendAudioVideoStream1();
1524 InitiateCall(); 1522 InitiateCall();
1525 // Since kClientAddrHost1 is blocked, not expecting stun candidates for it. 1523 // Since kClientAddrHost1 is blocked, not expecting stun candidates for it.
1526 EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout); 1524 EXPECT_TRUE_SIMULATED_WAIT(observer_.oncandidatesready_, sfc.clock(),
1525 kStunTimeout);
1527 EXPECT_EQ(6u, observer_.mline_0_candidates_.size()); 1526 EXPECT_EQ(6u, observer_.mline_0_candidates_.size());
1528 EXPECT_EQ(6u, observer_.mline_1_candidates_.size()); 1527 EXPECT_EQ(6u, observer_.mline_1_candidates_.size());
1529 } 1528 }
1530 1529
1531 TEST_F(WebRtcSessionTest, SetSdpFailedOnInvalidSdp) { 1530 TEST_F(WebRtcSessionTest, SetSdpFailedOnInvalidSdp) {
1532 Init(); 1531 Init();
1533 SessionDescriptionInterface* offer = NULL; 1532 SessionDescriptionInterface* offer = NULL;
1534 // Since |offer| is NULL, there's no way to tell if it's an offer or answer. 1533 // Since |offer| is NULL, there's no way to tell if it's an offer or answer.
1535 std::string unknown_action; 1534 std::string unknown_action;
1536 SetLocalDescriptionExpectError(unknown_action, kInvalidSdp, offer); 1535 SetLocalDescriptionExpectError(unknown_action, kInvalidSdp, offer);
(...skipping 2880 matching lines...) Expand 10 before | Expand all | Expand 10 after
4417 } 4416 }
4418 4417
4419 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4418 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4420 // currently fails because upon disconnection and reconnection OnIceComplete is 4419 // currently fails because upon disconnection and reconnection OnIceComplete is
4421 // called more than once without returning to IceGatheringGathering. 4420 // called more than once without returning to IceGatheringGathering.
4422 4421
4423 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4422 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4424 WebRtcSessionTest, 4423 WebRtcSessionTest,
4425 testing::Values(ALREADY_GENERATED, 4424 testing::Values(ALREADY_GENERATED,
4426 DTLS_IDENTITY_STORE)); 4425 DTLS_IDENTITY_STORE));
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/base_tests.gyp » ('j') | webrtc/base/fakeclock.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698