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

Unified Diff: talk/session/media/channel_unittest.cc

Issue 1380103002: Fix flaky test TestSrtpError. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/session/media/channel_unittest.cc
diff --git a/talk/session/media/channel_unittest.cc b/talk/session/media/channel_unittest.cc
index 7f76e167d352088476d74a06345d57b00d5ff557..d6f25922ce9a88ecbad13560cdbe4365177b1ece 100644
--- a/talk/session/media/channel_unittest.cc
+++ b/talk/session/media/channel_unittest.cc
@@ -1702,7 +1702,7 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
EXPECT_TRUE(SendAccept());
EXPECT_TRUE(channel1_->secure());
EXPECT_TRUE(channel2_->secure());
-
+ channel2_->srtp_filter()->set_signal_silent_time(250);
channel2_->srtp_filter()->SignalSrtpError.connect(
&error_handler, &SrtpErrorHandler::OnSrtpError);
@@ -1712,18 +1712,22 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
EXPECT_EQ_WAIT(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_, 500);
EXPECT_EQ(cricket::SrtpFilter::PROTECT, error_handler.mode_);
error_handler.error_ = cricket::SrtpFilter::ERROR_NONE;
- // The next 1 sec failures will not trigger an error.
+ error_handler.mode_ = cricket::SrtpFilter::UNPROTECT;
+ // The next 250 ms failures will not trigger an error.
EXPECT_FALSE(media_channel2_->SendRtp(kBadPacket, sizeof(kBadPacket)));
// Wait for a while to ensure no message comes in.
- rtc::Thread::Current()->ProcessMessages(210);
+ rtc::Thread::Current()->ProcessMessages(200);
EXPECT_EQ(cricket::SrtpFilter::ERROR_NONE, error_handler.error_);
- // The error will be triggered again.
+ EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, error_handler.mode_);
+ // Wait for a little more - the error will be triggered again.
+ rtc::Thread::Current()->ProcessMessages(200);
EXPECT_FALSE(media_channel2_->SendRtp(kBadPacket, sizeof(kBadPacket)));
EXPECT_EQ_WAIT(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_, 500);
EXPECT_EQ(cricket::SrtpFilter::PROTECT, error_handler.mode_);
// Testing failures in receiving packets.
error_handler.error_ = cricket::SrtpFilter::ERROR_NONE;
+ error_handler.mode_ = cricket::SrtpFilter::UNPROTECT;
cricket::TransportChannel* transport_channel =
channel2_->transport_channel();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698