OLD | NEW |
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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 void set_connected_callback(const base::Closure& callback) { | 69 void set_connected_callback(const base::Closure& callback) { |
70 connected_callback_ = callback; | 70 connected_callback_ = callback; |
71 } | 71 } |
72 void set_error_callback(const ErrorCallback& callback) { | 72 void set_error_callback(const ErrorCallback& callback) { |
73 error_callback_ = callback; | 73 error_callback_ = callback; |
74 } | 74 } |
75 | 75 |
76 // Transport::EventHandler interface. | 76 // Transport::EventHandler interface. |
77 void OnOutgoingTransportInfo(scoped_ptr<buzz::XmlElement> message) override { | 77 void OnOutgoingTransportInfo(scoped_ptr<buzz::XmlElement> message) override { |
78 transport_info_callback_.Run(message.Pass()); | 78 transport_info_callback_.Run(std::move(message)); |
79 } | 79 } |
80 void OnTransportRouteChange(const std::string& channel_name, | 80 void OnTransportRouteChange(const std::string& channel_name, |
81 const TransportRoute& route) override {} | 81 const TransportRoute& route) override {} |
82 void OnTransportConnected() override { | 82 void OnTransportConnected() override { |
83 connected_callback_.Run(); | 83 connected_callback_.Run(); |
84 } | 84 } |
85 void OnTransportError(ErrorCode error) override { | 85 void OnTransportError(ErrorCode error) override { |
86 error_callback_.Run(error); | 86 error_callback_.Run(error); |
87 } | 87 } |
88 | 88 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 EXPECT_CALL(host_channel_callback_, OnDone(_)) | 177 EXPECT_CALL(host_channel_callback_, OnDone(_)) |
178 .WillOnce(QuitRunLoopOnCounter(run_loop_.get(), &counter)); | 178 .WillOnce(QuitRunLoopOnCounter(run_loop_.get(), &counter)); |
179 | 179 |
180 run_loop_->Run(); | 180 run_loop_->Run(); |
181 | 181 |
182 EXPECT_TRUE(client_socket_.get()); | 182 EXPECT_TRUE(client_socket_.get()); |
183 EXPECT_TRUE(host_socket_.get()); | 183 EXPECT_TRUE(host_socket_.get()); |
184 } | 184 } |
185 | 185 |
186 void OnClientChannelCreated(scoped_ptr<P2PStreamSocket> socket) { | 186 void OnClientChannelCreated(scoped_ptr<P2PStreamSocket> socket) { |
187 client_socket_ = socket.Pass(); | 187 client_socket_ = std::move(socket); |
188 client_channel_callback_.OnDone(client_socket_.get()); | 188 client_channel_callback_.OnDone(client_socket_.get()); |
189 } | 189 } |
190 | 190 |
191 void OnHostChannelCreated(scoped_ptr<P2PStreamSocket> socket) { | 191 void OnHostChannelCreated(scoped_ptr<P2PStreamSocket> socket) { |
192 host_socket_ = socket.Pass(); | 192 host_socket_ = std::move(socket); |
193 host_channel_callback_.OnDone(host_socket_.get()); | 193 host_channel_callback_.OnDone(host_socket_.get()); |
194 } | 194 } |
195 | 195 |
196 void OnTransportError(ErrorCode error) { | 196 void OnTransportError(ErrorCode error) { |
197 error_ = error; | 197 error_ = error; |
198 run_loop_->Quit(); | 198 run_loop_->Quit(); |
199 } | 199 } |
200 | 200 |
201 protected: | 201 protected: |
202 base::MessageLoopForIO message_loop_; | 202 base::MessageLoopForIO message_loop_; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), | 349 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), |
350 kMessageSize, kMessages); | 350 kMessageSize, kMessages); |
351 tester.Start(); | 351 tester.Start(); |
352 message_loop_.Run(); | 352 message_loop_.Run(); |
353 tester.CheckResults(); | 353 tester.CheckResults(); |
354 } | 354 } |
355 | 355 |
356 | 356 |
357 } // namespace protocol | 357 } // namespace protocol |
358 } // namespace remoting | 358 } // namespace remoting |
OLD | NEW |