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

Unified Diff: remoting/protocol/ice_transport_unittest.cc

Issue 1687543002: Fix IceTransportTest.TestBrokenTransport (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « remoting/protocol/ice_transport_channel.cc ('k') | remoting/protocol/network_settings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « remoting/protocol/ice_transport_channel.cc ('k') | remoting/protocol/network_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698