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

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

Issue 2808283002: Improve tests for Mixed-Case JIDs. (Closed)
Patch Set: fix tests Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « remoting/protocol/fake_session.cc ('k') | remoting/protocol/jingle_session_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ice_transport.h" 5 #include "remoting/protocol/ice_transport.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 void InitializeConnection() { 117 void InitializeConnection() {
118 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); 118 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop();
119 119
120 host_transport_.reset(new IceTransport( 120 host_transport_.reset(new IceTransport(
121 new TransportContext(nullptr, 121 new TransportContext(nullptr,
122 base::MakeUnique<ChromiumPortAllocatorFactory>(), 122 base::MakeUnique<ChromiumPortAllocatorFactory>(),
123 nullptr, network_settings_, TransportRole::SERVER), 123 nullptr, network_settings_, TransportRole::SERVER),
124 &host_event_handler_)); 124 &host_event_handler_));
125 if (!host_authenticator_) { 125 if (!host_authenticator_) {
126 host_authenticator_.reset(new FakeAuthenticator( 126 host_authenticator_.reset(
127 FakeAuthenticator::HOST, 0, FakeAuthenticator::ACCEPT, true)); 127 new FakeAuthenticator(FakeAuthenticator::ACCEPT));
128 } 128 }
129 129
130 client_transport_.reset(new IceTransport( 130 client_transport_.reset(new IceTransport(
131 new TransportContext(nullptr, 131 new TransportContext(nullptr,
132 base::MakeUnique<ChromiumPortAllocatorFactory>(), 132 base::MakeUnique<ChromiumPortAllocatorFactory>(),
133 nullptr, network_settings_, TransportRole::CLIENT), 133 nullptr, network_settings_, TransportRole::CLIENT),
134 &client_event_handler_)); 134 &client_event_handler_));
135 if (!client_authenticator_) { 135 if (!client_authenticator_) {
136 client_authenticator_.reset(new FakeAuthenticator( 136 client_authenticator_.reset(
137 FakeAuthenticator::CLIENT, 0, FakeAuthenticator::ACCEPT, true)); 137 new FakeAuthenticator(FakeAuthenticator::ACCEPT));
138 } 138 }
139 139
140 host_event_handler_.set_error_callback(base::Bind( 140 host_event_handler_.set_error_callback(base::Bind(
141 &IceTransportTest::OnTransportError, base::Unretained(this))); 141 &IceTransportTest::OnTransportError, base::Unretained(this)));
142 client_event_handler_.set_error_callback(base::Bind( 142 client_event_handler_.set_error_callback(base::Bind(
143 &IceTransportTest::OnTransportError, base::Unretained(this))); 143 &IceTransportTest::OnTransportError, base::Unretained(this)));
144 144
145 // Start both transports. 145 // Start both transports.
146 host_transport_->Start( 146 host_transport_->Start(
147 host_authenticator_.get(), 147 host_authenticator_.get(),
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 WaitUntilConnected(); 240 WaitUntilConnected();
241 241
242 MessagePipeConnectionTester tester(host_message_pipe_.get(), 242 MessagePipeConnectionTester tester(host_message_pipe_.get(),
243 client_message_pipe_.get(), kMessageSize, 243 client_message_pipe_.get(), kMessageSize,
244 kMessages); 244 kMessages);
245 tester.RunAndCheckResults(); 245 tester.RunAndCheckResults();
246 } 246 }
247 247
248 TEST_F(IceTransportTest, FailedChannelAuth) { 248 TEST_F(IceTransportTest, FailedChannelAuth) {
249 // Use host authenticator with one that rejects channel authentication. 249 // Use host authenticator with one that rejects channel authentication.
250 host_authenticator_.reset(new FakeAuthenticator( 250 host_authenticator_.reset(
251 FakeAuthenticator::HOST, 0, FakeAuthenticator::REJECT_CHANNEL, true)); 251 new FakeAuthenticator(FakeAuthenticator::REJECT_CHANNEL));
252 252
253 InitializeConnection(); 253 InitializeConnection();
254 254
255 client_transport_->GetChannelFactory()->CreateChannel( 255 client_transport_->GetChannelFactory()->CreateChannel(
256 kChannelName, base::Bind(&IceTransportTest::OnClientChannelCreated, 256 kChannelName, base::Bind(&IceTransportTest::OnClientChannelCreated,
257 base::Unretained(this))); 257 base::Unretained(this)));
258 host_transport_->GetChannelFactory()->CreateChannel( 258 host_transport_->GetChannelFactory()->CreateChannel(
259 kChannelName, base::Bind(&IceTransportTest::OnHostChannelCreated, 259 kChannelName, base::Bind(&IceTransportTest::OnHostChannelCreated,
260 base::Unretained(this))); 260 base::Unretained(this)));
261 261
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 337
338 MessagePipeConnectionTester tester(host_message_pipe_.get(), 338 MessagePipeConnectionTester tester(host_message_pipe_.get(),
339 client_message_pipe_.get(), kMessageSize, 339 client_message_pipe_.get(), kMessageSize,
340 kMessages); 340 kMessages);
341 tester.RunAndCheckResults(); 341 tester.RunAndCheckResults();
342 } 342 }
343 343
344 344
345 } // namespace protocol 345 } // namespace protocol
346 } // namespace remoting 346 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/fake_session.cc ('k') | remoting/protocol/jingle_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698