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

Side by Side Diff: remoting/protocol/jingle_session_unittest.cc

Issue 11364031: remoting: Update calls froms RunAllPending() to RunUntilIdle(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/protocol/jingle_session.h" 5 #include "remoting/protocol/jingle_session.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 host_socket_ = socket.Pass(); 110 host_socket_ = socket.Pass();
111 } 111 }
112 112
113 protected: 113 protected:
114 virtual void SetUp() { 114 virtual void SetUp() {
115 } 115 }
116 116
117 virtual void TearDown() { 117 virtual void TearDown() {
118 CloseSessions(); 118 CloseSessions();
119 CloseSessionManager(); 119 CloseSessionManager();
120 message_loop_->RunAllPending(); 120 message_loop_->RunUntilIdle();
121 } 121 }
122 122
123 void CloseSessions() { 123 void CloseSessions() {
124 host_socket_.reset(); 124 host_socket_.reset();
125 host_session_.reset(); 125 host_session_.reset();
126 client_socket_.reset(); 126 client_socket_.reset();
127 client_session_.reset(); 127 client_session_.reset();
128 } 128 }
129 129
130 void CreateSessionManagers(int auth_round_trips, 130 void CreateSessionManagers(int auth_round_trips,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 217 }
218 218
219 scoped_ptr<Authenticator> authenticator(new FakeAuthenticator( 219 scoped_ptr<Authenticator> authenticator(new FakeAuthenticator(
220 FakeAuthenticator::CLIENT, auth_round_trips, auth_action, true)); 220 FakeAuthenticator::CLIENT, auth_round_trips, auth_action, true));
221 221
222 client_session_ = client_server_->Connect( 222 client_session_ = client_server_->Connect(
223 kHostJid, authenticator.Pass(), 223 kHostJid, authenticator.Pass(),
224 CandidateSessionConfig::CreateDefault()); 224 CandidateSessionConfig::CreateDefault());
225 client_session_->SetEventHandler(&client_session_event_handler_); 225 client_session_->SetEventHandler(&client_session_event_handler_);
226 226
227 message_loop_->RunAllPending(); 227 message_loop_->RunUntilIdle();
228 } 228 }
229 229
230 void CreateChannel() { 230 void CreateChannel() {
231 client_session_->GetTransportChannelFactory()->CreateStreamChannel( 231 client_session_->GetTransportChannelFactory()->CreateStreamChannel(
232 kChannelName, base::Bind(&JingleSessionTest::OnClientChannelCreated, 232 kChannelName, base::Bind(&JingleSessionTest::OnClientChannelCreated,
233 base::Unretained(this))); 233 base::Unretained(this)));
234 host_session_->GetTransportChannelFactory()->CreateStreamChannel( 234 host_session_->GetTransportChannelFactory()->CreateStreamChannel(
235 kChannelName, base::Bind(&JingleSessionTest::OnHostChannelCreated, 235 kChannelName, base::Bind(&JingleSessionTest::OnHostChannelCreated,
236 base::Unretained(this))); 236 base::Unretained(this)));
237 237
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 OnSessionStateChange(Session::FAILED)) 300 OnSessionStateChange(Session::FAILED))
301 .Times(1); 301 .Times(1);
302 } 302 }
303 303
304 scoped_ptr<Authenticator> authenticator(new FakeAuthenticator( 304 scoped_ptr<Authenticator> authenticator(new FakeAuthenticator(
305 FakeAuthenticator::CLIENT, 1, FakeAuthenticator::ACCEPT, true)); 305 FakeAuthenticator::CLIENT, 1, FakeAuthenticator::ACCEPT, true));
306 client_session_ = client_server_->Connect( 306 client_session_ = client_server_->Connect(
307 kHostJid, authenticator.Pass(), CandidateSessionConfig::CreateDefault()); 307 kHostJid, authenticator.Pass(), CandidateSessionConfig::CreateDefault());
308 client_session_->SetEventHandler(&client_session_event_handler_); 308 client_session_->SetEventHandler(&client_session_event_handler_);
309 309
310 message_loop_->RunAllPending(); 310 message_loop_->RunUntilIdle();
311 } 311 }
312 312
313 // Verify that we can connect two endpoints with single-step authentication. 313 // Verify that we can connect two endpoints with single-step authentication.
314 TEST_F(JingleSessionTest, Connect) { 314 TEST_F(JingleSessionTest, Connect) {
315 CreateSessionManagers(1, FakeAuthenticator::ACCEPT); 315 CreateSessionManagers(1, FakeAuthenticator::ACCEPT);
316 InitiateConnection(1, FakeAuthenticator::ACCEPT, false); 316 InitiateConnection(1, FakeAuthenticator::ACCEPT, false);
317 317
318 // Verify that the client specified correct initiator value. 318 // Verify that the client specified correct initiator value.
319 ASSERT_GT(host_signal_strategy_->received_messages().size(), 0U); 319 ASSERT_GT(host_signal_strategy_->received_messages().size(), 0U);
320 const buzz::XmlElement* initiate_xml = 320 const buzz::XmlElement* initiate_xml =
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 .Times(AtMost(1)); 426 .Times(AtMost(1));
427 ExpectRouteChange(kChannelName); 427 ExpectRouteChange(kChannelName);
428 428
429 message_loop_->Run(); 429 message_loop_->Run();
430 430
431 EXPECT_TRUE(!host_socket_.get()); 431 EXPECT_TRUE(!host_socket_.get());
432 } 432 }
433 433
434 } // namespace protocol 434 } // namespace protocol
435 } // namespace remoting 435 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/connection_to_client_unittest.cc ('k') | remoting/protocol/message_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698