| Index: remoting/protocol/ice_transport_unittest.cc
|
| diff --git a/remoting/protocol/ice_transport_unittest.cc b/remoting/protocol/ice_transport_unittest.cc
|
| index b459458ae9260f5cf5946dc1fab9653b74af264a..21164ab6095b07902433b481f7704b5bbdc2e006 100644
|
| --- a/remoting/protocol/ice_transport_unittest.cc
|
| +++ b/remoting/protocol/ice_transport_unittest.cc
|
| @@ -113,17 +113,23 @@ class IceTransportTest : public testing::Test {
|
| }
|
|
|
| void InitializeConnection() {
|
| - host_transport_.reset(
|
| - new IceTransport(TransportContext::ForTests(TransportRole::SERVER),
|
| - &host_event_handler_));
|
| + jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop();
|
| +
|
| + host_transport_.reset(new IceTransport(
|
| + new TransportContext(
|
| + nullptr, make_scoped_ptr(new ChromiumPortAllocatorFactory(nullptr)),
|
| + network_settings_, TransportRole::SERVER),
|
| + &host_event_handler_));
|
| if (!host_authenticator_) {
|
| host_authenticator_.reset(new FakeAuthenticator(
|
| FakeAuthenticator::HOST, 0, FakeAuthenticator::ACCEPT, true));
|
| }
|
|
|
| - client_transport_.reset(
|
| - new IceTransport(TransportContext::ForTests(TransportRole::CLIENT),
|
| - &client_event_handler_));
|
| + client_transport_.reset(new IceTransport(
|
| + new TransportContext(
|
| + nullptr, make_scoped_ptr(new ChromiumPortAllocatorFactory(nullptr)),
|
| + network_settings_, TransportRole::CLIENT),
|
| + &client_event_handler_));
|
| if (!client_authenticator_) {
|
| client_authenticator_.reset(new FakeAuthenticator(
|
| FakeAuthenticator::CLIENT, 0, FakeAuthenticator::ACCEPT, true));
|
| @@ -269,8 +275,11 @@ TEST_F(IceTransportTest, FailedChannelAuth) {
|
| // established.
|
| TEST_F(IceTransportTest, TestBrokenTransport) {
|
| // Allow only incoming connections on both ends, which effectively renders
|
| - // transport unusable.
|
| + // transport unusable. Also reduce connection timeout so the test finishes
|
| + // quickly.
|
| network_settings_ = NetworkSettings(NetworkSettings::NAT_TRAVERSAL_DISABLED);
|
| + network_settings_.ice_timeout = base::TimeDelta::FromSeconds(1);
|
| + network_settings_.ice_reconnect_attempts = 1;
|
|
|
| InitializeConnection();
|
|
|
| @@ -281,11 +290,14 @@ TEST_F(IceTransportTest, TestBrokenTransport) {
|
| kChannelName, base::Bind(&IceTransportTest::OnHostChannelCreated,
|
| base::Unretained(this)));
|
|
|
| - message_loop_.RunUntilIdle();
|
| + // The RunLoop should quit in OnTransportError().
|
| + run_loop_.reset(new base::RunLoop());
|
| + run_loop_->Run();
|
|
|
| // Verify that neither of the two ends of the channel is connected.
|
| EXPECT_FALSE(client_message_pipe_);
|
| EXPECT_FALSE(host_message_pipe_);
|
| + EXPECT_EQ(CHANNEL_CONNECTION_ERROR, error_);
|
|
|
| client_transport_->GetChannelFactory()->CancelChannelCreation(
|
| kChannelName);
|
|
|