diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-02 21:48:37 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-02 21:48:37 +0000 |
commit | f285d9c29dd7428e89c34f0724fbd63d4526dc50 (patch) | |
tree | 483ecb90f73fea0966090b95502a95f7b14af0c2 /remoting | |
parent | f9c0ecaa9af8a0b7708e563c5da495943eb000f3 (diff) | |
download | chromium_src-f285d9c29dd7428e89c34f0724fbd63d4526dc50.zip chromium_src-f285d9c29dd7428e89c34f0724fbd63d4526dc50.tar.gz chromium_src-f285d9c29dd7428e89c34f0724fbd63d4526dc50.tar.bz2 |
Fix flakiness in JingleChromotingConnectionTest
TEST=remoting_unittests
BUG=None
TBR=hclam
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61314 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/jingle_glue/jingle_thread.cc | 5 | ||||
-rw-r--r-- | remoting/protocol/jingle_chromoting_connection.cc | 2 | ||||
-rw-r--r-- | remoting/protocol/jingle_chromoting_connection_unittest.cc | 14 |
3 files changed, 16 insertions, 5 deletions
diff --git a/remoting/jingle_glue/jingle_thread.cc b/remoting/jingle_glue/jingle_thread.cc index 450381e..e4ab098 100644 --- a/remoting/jingle_glue/jingle_thread.cc +++ b/remoting/jingle_glue/jingle_thread.cc @@ -33,6 +33,10 @@ class JingleThread::JingleMessagePump : public base::MessagePump, void OnMessage(talk_base::Message* msg) { DCHECK(msg->message_id == kRunTasksMessageId); + // Clear currently pending messages in case there were delayed tasks. + // Will schedule it again from ScheduleNextDelayedTask() if neccessary. + thread_->Clear(this, kRunTasksMessageId); + // This code is executed whenever we get new message in |message_loop_|. // JingleMessagePump posts new tasks in the jingle thread. // TODO(sergeyu): Remove it when JingleThread moved on Chromium's @@ -61,7 +65,6 @@ class JingleThread::JingleMessagePump : public base::MessagePump, void ScheduleNextDelayedTask() { DCHECK_EQ(thread_->message_loop(), MessageLoop::current()); - thread_->Clear(this, kRunTasksMessageId); if (!delayed_work_time_.is_null()) { base::Time now = base::Time::Now(); int delay = static_cast<int>((delayed_work_time_ - now).InMilliseconds()); diff --git a/remoting/protocol/jingle_chromoting_connection.cc b/remoting/protocol/jingle_chromoting_connection.cc index 758057c..5c2e246 100644 --- a/remoting/protocol/jingle_chromoting_connection.cc +++ b/remoting/protocol/jingle_chromoting_connection.cc @@ -127,6 +127,8 @@ void JingleChromotingConnection::Close(Task* closed_task) { if (session_) session_->Terminate(); + SetState(CLOSED); + closed_ = true; } diff --git a/remoting/protocol/jingle_chromoting_connection_unittest.cc b/remoting/protocol/jingle_chromoting_connection_unittest.cc index bb96eec..a517592 100644 --- a/remoting/protocol/jingle_chromoting_connection_unittest.cc +++ b/remoting/protocol/jingle_chromoting_connection_unittest.cc @@ -96,7 +96,7 @@ class JingleChromotingConnectionTest : public testing::Test { void CloseConnections() { if (host_connection_) { host_connection_->Close(NewRunnableFunction( - &JingleChromotingConnectionTest::DoNothing)); + &JingleChromotingConnectionTest::DoNothing)); } if (client_connection_) { client_connection_->Close(NewRunnableFunction( @@ -139,6 +139,10 @@ class JingleChromotingConnectionTest : public testing::Test { .Times(1) .WillOnce(InvokeWithoutArgs(&host_connected_event, &base::WaitableEvent::Signal)); + // Expect that the connection will be closed eventually. + EXPECT_CALL(host_connection_callback_, + OnStateChange(ChromotingConnection::CLOSED)) + .Times(1); base::WaitableEvent client_connected_event(false, false); EXPECT_CALL(client_connection_callback_, @@ -149,6 +153,10 @@ class JingleChromotingConnectionTest : public testing::Test { .Times(1) .WillOnce(InvokeWithoutArgs(&client_connected_event, &base::WaitableEvent::Signal)); + // Expect that the connection will be closed eventually. + EXPECT_CALL(client_connection_callback_, + OnStateChange(ChromotingConnection::CLOSED)) + .Times(1); client_connection_ = client_server_->Connect( SessionManagerPair::kHostJid, @@ -562,9 +570,7 @@ TEST_F(JingleChromotingConnectionTest, TestEventsChannel) { } // Verify that data can be transmitted over the video RTP channel. -// TODO(sergeyu): This test is disabled at the moment because of -// flakiness. -TEST_F(JingleChromotingConnectionTest, DISABLED_TestVideoRtpChannel) { +TEST_F(JingleChromotingConnectionTest, TestVideoRtpChannel) { CreateServerPair(); InitiateConnection(); scoped_refptr<UDPChannelTester> tester = |