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

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

Issue 1521883006: Add TransportContext class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « remoting/protocol/webrtc_transport.cc ('k') | remoting/remoting_host_srcs.gypi » ('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/webrtc_transport.h" 5 #include "remoting/protocol/webrtc_transport.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "jingle/glue/thread_wrapper.h" 9 #include "jingle/glue/thread_wrapper.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
11 #include "net/url_request/url_request_context_getter.h" 11 #include "net/url_request/url_request_context_getter.h"
12 #include "remoting/protocol/chromium_port_allocator_factory.h" 12 #include "remoting/protocol/chromium_port_allocator.h"
13 #include "remoting/protocol/connection_tester.h" 13 #include "remoting/protocol/connection_tester.h"
14 #include "remoting/protocol/fake_authenticator.h" 14 #include "remoting/protocol/fake_authenticator.h"
15 #include "remoting/protocol/network_settings.h" 15 #include "remoting/protocol/network_settings.h"
16 #include "remoting/protocol/p2p_stream_socket.h" 16 #include "remoting/protocol/p2p_stream_socket.h"
17 #include "remoting/protocol/transport_context.h"
17 #include "remoting/signaling/fake_signal_strategy.h" 18 #include "remoting/signaling/fake_signal_strategy.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" 20 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
20 21
21 namespace remoting { 22 namespace remoting {
22 namespace protocol { 23 namespace protocol {
23 24
24 namespace { 25 namespace {
25 26
26 const char kTestJid[] = "client@gmail.com/321"; 27 const char kTestJid[] = "client@gmail.com/321";
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 ASSERT_TRUE(target_transport); 84 ASSERT_TRUE(target_transport);
84 EXPECT_TRUE((*target_transport) 85 EXPECT_TRUE((*target_transport)
85 ->ProcessTransportInfo(transport_info.get())); 86 ->ProcessTransportInfo(transport_info.get()));
86 } 87 }
87 88
88 protected: 89 protected:
89 void InitializeConnection() { 90 void InitializeConnection() {
90 signal_strategy_.reset(new FakeSignalStrategy(kTestJid)); 91 signal_strategy_.reset(new FakeSignalStrategy(kTestJid));
91 92
92 host_transport_factory_.reset(new WebrtcTransportFactory( 93 host_transport_factory_.reset(new WebrtcTransportFactory(
93 jingle_glue::JingleThreadWrapper::current(), signal_strategy_.get(), 94 jingle_glue::JingleThreadWrapper::current(),
94 ChromiumPortAllocatorFactory::Create(network_settings_, nullptr), 95 new TransportContext(
95 TransportRole::SERVER)); 96 signal_strategy_.get(),
97 make_scoped_ptr(new ChromiumPortAllocatorFactory(nullptr)),
98 network_settings_, TransportRole::SERVER)));
96 host_transport_ = host_transport_factory_->CreateTransport(); 99 host_transport_ = host_transport_factory_->CreateTransport();
97 host_authenticator_.reset(new FakeAuthenticator( 100 host_authenticator_.reset(new FakeAuthenticator(
98 FakeAuthenticator::HOST, 0, FakeAuthenticator::ACCEPT, false)); 101 FakeAuthenticator::HOST, 0, FakeAuthenticator::ACCEPT, false));
99 102
100 client_transport_factory_.reset(new WebrtcTransportFactory( 103 client_transport_factory_.reset(new WebrtcTransportFactory(
101 jingle_glue::JingleThreadWrapper::current(), signal_strategy_.get(), 104 jingle_glue::JingleThreadWrapper::current(),
102 ChromiumPortAllocatorFactory::Create(network_settings_, nullptr), 105 new TransportContext(
103 TransportRole::CLIENT)); 106 signal_strategy_.get(),
107 make_scoped_ptr(new ChromiumPortAllocatorFactory(nullptr)),
108 network_settings_, TransportRole::CLIENT)));
104 client_transport_ = client_transport_factory_->CreateTransport(); 109 client_transport_ = client_transport_factory_->CreateTransport();
105 host_authenticator_.reset(new FakeAuthenticator( 110 host_authenticator_.reset(new FakeAuthenticator(
106 FakeAuthenticator::CLIENT, 0, FakeAuthenticator::ACCEPT, false)); 111 FakeAuthenticator::CLIENT, 0, FakeAuthenticator::ACCEPT, false));
107 112
108 // Connect signaling between the two WebrtcTransport objects. 113 // Connect signaling between the two WebrtcTransport objects.
109 host_event_handler_.set_transport_info_callback( 114 host_event_handler_.set_transport_info_callback(
110 base::Bind(&WebrtcTransportTest::ProcessTransportInfo, 115 base::Bind(&WebrtcTransportTest::ProcessTransportInfo,
111 base::Unretained(this), &client_transport_)); 116 base::Unretained(this), &client_transport_));
112 client_event_handler_.set_transport_info_callback( 117 client_event_handler_.set_transport_info_callback(
113 base::Bind(&WebrtcTransportTest::ProcessTransportInfo, 118 base::Bind(&WebrtcTransportTest::ProcessTransportInfo,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 const int kMessages = 100; 222 const int kMessages = 100;
218 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), 223 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(),
219 kMessageSize, kMessages); 224 kMessageSize, kMessages);
220 tester.Start(); 225 tester.Start();
221 message_loop_.Run(); 226 message_loop_.Run();
222 tester.CheckResults(); 227 tester.CheckResults();
223 } 228 }
224 229
225 } // namespace protocol 230 } // namespace protocol
226 } // namespace remoting 231 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/webrtc_transport.cc ('k') | remoting/remoting_host_srcs.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698