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

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

Issue 1681393006: Use UrlRequest in PortAllocator. (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 unified diff | Download patch
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"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
15 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
16 #include "jingle/glue/thread_wrapper.h" 16 #include "jingle/glue/thread_wrapper.h"
17 #include "net/url_request/url_request_context_getter.h" 17 #include "net/url_request/url_request_context_getter.h"
18 #include "remoting/protocol/chromium_port_allocator.h" 18 #include "remoting/base/url_request.h"
19 #include "remoting/protocol/chromium_port_allocator_factory.h"
19 #include "remoting/protocol/connection_tester.h" 20 #include "remoting/protocol/connection_tester.h"
20 #include "remoting/protocol/fake_authenticator.h" 21 #include "remoting/protocol/fake_authenticator.h"
21 #include "remoting/protocol/message_channel_factory.h" 22 #include "remoting/protocol/message_channel_factory.h"
22 #include "remoting/protocol/message_pipe.h" 23 #include "remoting/protocol/message_pipe.h"
23 #include "remoting/protocol/transport_context.h" 24 #include "remoting/protocol/transport_context.h"
24 #include "testing/gmock/include/gmock/gmock.h" 25 #include "testing/gmock/include/gmock/gmock.h"
25 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
26 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" 27 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
27 28
28 using testing::_; 29 using testing::_;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 ASSERT_TRUE(target_transport); 111 ASSERT_TRUE(target_transport);
111 EXPECT_TRUE( 112 EXPECT_TRUE(
112 (*target_transport)->ProcessTransportInfo(transport_info.get())); 113 (*target_transport)->ProcessTransportInfo(transport_info.get()));
113 } 114 }
114 115
115 void InitializeConnection() { 116 void InitializeConnection() {
116 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); 117 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop();
117 118
118 host_transport_.reset(new IceTransport( 119 host_transport_.reset(new IceTransport(
119 new TransportContext( 120 new TransportContext(
120 nullptr, make_scoped_ptr(new ChromiumPortAllocatorFactory(nullptr)), 121 nullptr, make_scoped_ptr(new ChromiumPortAllocatorFactory()),
121 network_settings_, TransportRole::SERVER), 122 nullptr, network_settings_, TransportRole::SERVER),
122 &host_event_handler_)); 123 &host_event_handler_));
123 if (!host_authenticator_) { 124 if (!host_authenticator_) {
124 host_authenticator_.reset(new FakeAuthenticator( 125 host_authenticator_.reset(new FakeAuthenticator(
125 FakeAuthenticator::HOST, 0, FakeAuthenticator::ACCEPT, true)); 126 FakeAuthenticator::HOST, 0, FakeAuthenticator::ACCEPT, true));
126 } 127 }
127 128
128 client_transport_.reset(new IceTransport( 129 client_transport_.reset(new IceTransport(
129 new TransportContext( 130 new TransportContext(
130 nullptr, make_scoped_ptr(new ChromiumPortAllocatorFactory(nullptr)), 131 nullptr, make_scoped_ptr(new ChromiumPortAllocatorFactory()),
131 network_settings_, TransportRole::CLIENT), 132 nullptr, network_settings_, TransportRole::CLIENT),
132 &client_event_handler_)); 133 &client_event_handler_));
133 if (!client_authenticator_) { 134 if (!client_authenticator_) {
134 client_authenticator_.reset(new FakeAuthenticator( 135 client_authenticator_.reset(new FakeAuthenticator(
135 FakeAuthenticator::CLIENT, 0, FakeAuthenticator::ACCEPT, true)); 136 FakeAuthenticator::CLIENT, 0, FakeAuthenticator::ACCEPT, true));
136 } 137 }
137 138
138 host_event_handler_.set_error_callback(base::Bind( 139 host_event_handler_.set_error_callback(base::Bind(
139 &IceTransportTest::OnTransportError, base::Unretained(this))); 140 &IceTransportTest::OnTransportError, base::Unretained(this)));
140 client_event_handler_.set_error_callback(base::Bind( 141 client_event_handler_.set_error_callback(base::Bind(
141 &IceTransportTest::OnTransportError, base::Unretained(this))); 142 &IceTransportTest::OnTransportError, base::Unretained(this)));
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 336
336 MessagePipeConnectionTester tester(host_message_pipe_.get(), 337 MessagePipeConnectionTester tester(host_message_pipe_.get(),
337 client_message_pipe_.get(), kMessageSize, 338 client_message_pipe_.get(), kMessageSize,
338 kMessages); 339 kMessages);
339 tester.RunAndCheckResults(); 340 tester.RunAndCheckResults();
340 } 341 }
341 342
342 343
343 } // namespace protocol 344 } // namespace protocol
344 } // namespace remoting 345 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/chromium_port_allocator_factory.cc ('k') | remoting/protocol/jingle_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698