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

Unified 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: Fixing another TSan warning. WebRtcSession wasn't completely shut down. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/base/base_tests.gyp » ('j') | webrtc/base/fakeclock.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/webrtcsession_unittest.cc
diff --git a/webrtc/api/webrtcsession_unittest.cc b/webrtc/api/webrtcsession_unittest.cc
index 088694cb16b6a07c5be0276be63e9423cf45e02c..1907b8410ccac03b0504bbe5e2187823dfc7bfa6 100644
--- a/webrtc/api/webrtcsession_unittest.cc
+++ b/webrtc/api/webrtcsession_unittest.cc
@@ -109,6 +109,8 @@ static const int kMediaContentIndex1 = 1;
static const char kMediaContentName1[] = "video";
static const int kIceCandidatesTimeout = 10000;
+// STUN timeout with all retransmissions is a total of 9500ms.
+static const int kStunTimeout = 9500;
static const char kFakeDtlsFingerprint[] =
"BB:CD:72:F7:2F:D0:BA:43:F3:68:B1:0C:23:72:B6:4A:"
@@ -1504,13 +1506,9 @@ TEST_F(WebRtcSessionTest, TestMultihomeCandidates) {
EXPECT_EQ(8u, observer_.mline_1_candidates_.size());
}
-// Crashes on Win only. See webrtc:5411.
-#if defined(WEBRTC_WIN)
-#define MAYBE_TestStunError DISABLED_TestStunError
-#else
-#define MAYBE_TestStunError TestStunError
-#endif
-TEST_F(WebRtcSessionTest, MAYBE_TestStunError) {
+TEST_F(WebRtcSessionTest, TestStunError) {
+ rtc::ScopedFakeClock clock;
+
AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort));
fss_->AddRule(false,
@@ -1521,9 +1519,13 @@ TEST_F(WebRtcSessionTest, MAYBE_TestStunError) {
SendAudioVideoStream1();
InitiateCall();
// Since kClientAddrHost1 is blocked, not expecting stun candidates for it.
- EXPECT_TRUE_WAIT(observer_.oncandidatesready_, kIceCandidatesTimeout);
+ EXPECT_TRUE_SIMULATED_WAIT(observer_.oncandidatesready_, kStunTimeout, clock);
EXPECT_EQ(6u, observer_.mline_0_candidates_.size());
EXPECT_EQ(6u, observer_.mline_1_candidates_.size());
+ // Destroy session before scoped fake clock goes out of scope to avoid TSan
+ // warning.
+ session_->Close();
+ session_.reset(nullptr);
}
TEST_F(WebRtcSessionTest, SetSdpFailedOnInvalidSdp) {
« no previous file with comments | « no previous file | webrtc/base/base_tests.gyp » ('j') | webrtc/base/fakeclock.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698