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

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

Issue 98173006: Fix LibjingleTransportFactory to refresh STUN/Relay. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/test/test_timeouts.h" 9 #include "base/test/test_timeouts.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 void CreateSessionManagers(int auth_round_trips, 134 void CreateSessionManagers(int auth_round_trips,
135 FakeAuthenticator::Action auth_action) { 135 FakeAuthenticator::Action auth_action) {
136 host_signal_strategy_.reset(new FakeSignalStrategy(kHostJid)); 136 host_signal_strategy_.reset(new FakeSignalStrategy(kHostJid));
137 client_signal_strategy_.reset(new FakeSignalStrategy(kClientJid)); 137 client_signal_strategy_.reset(new FakeSignalStrategy(kClientJid));
138 FakeSignalStrategy::Connect(host_signal_strategy_.get(), 138 FakeSignalStrategy::Connect(host_signal_strategy_.get(),
139 client_signal_strategy_.get()); 139 client_signal_strategy_.get());
140 140
141 EXPECT_CALL(host_server_listener_, OnSessionManagerReady()) 141 EXPECT_CALL(host_server_listener_, OnSessionManagerReady())
142 .Times(1); 142 .Times(1);
143 143
144 NetworkSettings network_settings; 144 NetworkSettings network_settings(NetworkSettings::NAT_TRAVERSAL_OUTGOING);
145 145
146 scoped_ptr<TransportFactory> host_transport(new LibjingleTransportFactory( 146 scoped_ptr<TransportFactory> host_transport(new LibjingleTransportFactory(
147 NULL,
147 ChromiumPortAllocator::Create(NULL, network_settings) 148 ChromiumPortAllocator::Create(NULL, network_settings)
148 .PassAs<cricket::HttpPortAllocatorBase>(), 149 .PassAs<cricket::HttpPortAllocatorBase>(),
149 false)); 150 network_settings));
150 host_server_.reset(new JingleSessionManager(host_transport.Pass(), false)); 151 host_server_.reset(new JingleSessionManager(host_transport.Pass()));
151 host_server_->Init(host_signal_strategy_.get(), &host_server_listener_); 152 host_server_->Init(host_signal_strategy_.get(), &host_server_listener_);
152 153
153 scoped_ptr<AuthenticatorFactory> factory( 154 scoped_ptr<AuthenticatorFactory> factory(
154 new FakeHostAuthenticatorFactory(auth_round_trips, auth_action, true)); 155 new FakeHostAuthenticatorFactory(auth_round_trips, auth_action, true));
155 host_server_->set_authenticator_factory(factory.Pass()); 156 host_server_->set_authenticator_factory(factory.Pass());
156 157
157 EXPECT_CALL(client_server_listener_, OnSessionManagerReady()) 158 EXPECT_CALL(client_server_listener_, OnSessionManagerReady())
158 .Times(1); 159 .Times(1);
159 scoped_ptr<TransportFactory> client_transport(new LibjingleTransportFactory( 160 scoped_ptr<TransportFactory> client_transport(new LibjingleTransportFactory(
161 NULL,
160 ChromiumPortAllocator::Create(NULL, network_settings) 162 ChromiumPortAllocator::Create(NULL, network_settings)
161 .PassAs<cricket::HttpPortAllocatorBase>(), 163 .PassAs<cricket::HttpPortAllocatorBase>(),
162 false)); 164 network_settings));
163 client_server_.reset( 165 client_server_.reset(
164 new JingleSessionManager(client_transport.Pass(), false)); 166 new JingleSessionManager(client_transport.Pass()));
165 client_server_->Init(client_signal_strategy_.get(), 167 client_server_->Init(client_signal_strategy_.get(),
166 &client_server_listener_); 168 &client_server_listener_);
167 } 169 }
168 170
169 void CloseSessionManager() { 171 void CloseSessionManager() {
170 if (host_server_.get()) { 172 if (host_server_.get()) {
171 host_server_->Close(); 173 host_server_->Close();
172 host_server_.reset(); 174 host_server_.reset();
173 } 175 }
174 if (client_server_.get()) { 176 if (client_server_.get()) {
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 .Times(AtMost(1)); 441 .Times(AtMost(1));
440 ExpectRouteChange(kChannelName); 442 ExpectRouteChange(kChannelName);
441 443
442 message_loop_->Run(); 444 message_loop_->Run();
443 445
444 EXPECT_TRUE(!host_socket_.get()); 446 EXPECT_TRUE(!host_socket_.get());
445 } 447 }
446 448
447 } // namespace protocol 449 } // namespace protocol
448 } // namespace remoting 450 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/jingle_session_manager.cc ('k') | remoting/protocol/libjingle_transport_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698