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

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

Issue 1545743002: Move ownership of Transport out of Session. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass_client
Patch Set: Created 4 years, 12 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 (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/fake_authenticator.h" 5 #include "remoting/protocol/fake_authenticator.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 29
30 FakeChannelAuthenticator::~FakeChannelAuthenticator() { 30 FakeChannelAuthenticator::~FakeChannelAuthenticator() {
31 } 31 }
32 32
33 void FakeChannelAuthenticator::SecureAndAuthenticate( 33 void FakeChannelAuthenticator::SecureAndAuthenticate(
34 scoped_ptr<P2PStreamSocket> socket, 34 scoped_ptr<P2PStreamSocket> socket,
35 const DoneCallback& done_callback) { 35 const DoneCallback& done_callback) {
36 socket_ = std::move(socket); 36 socket_ = std::move(socket);
37 37
38 done_callback_ = done_callback;
39
38 if (async_) { 40 if (async_) {
39 done_callback_ = done_callback;
40
41 if (result_ != net::OK) { 41 if (result_ != net::OK) {
42 // Don't write anything if we are going to reject auth to make test 42 // Don't write anything if we are going to reject auth to make test
43 // ordering deterministic. 43 // ordering deterministic.
44 did_write_bytes_ = true; 44 did_write_bytes_ = true;
45 } else { 45 } else {
46 scoped_refptr<net::IOBuffer> write_buf = new net::IOBuffer(1); 46 scoped_refptr<net::IOBuffer> write_buf = new net::IOBuffer(1);
47 write_buf->data()[0] = 0; 47 write_buf->data()[0] = 0;
48 int result = socket_->Write( 48 int result = socket_->Write(
49 write_buf.get(), 1, 49 write_buf.get(), 1,
50 base::Bind(&FakeChannelAuthenticator::OnAuthBytesWritten, 50 base::Bind(&FakeChannelAuthenticator::OnAuthBytesWritten,
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 const std::string& remote_jid, 216 const std::string& remote_jid,
217 const buzz::XmlElement* first_message) { 217 const buzz::XmlElement* first_message) {
218 scoped_ptr<FakeAuthenticator> authenticator(new FakeAuthenticator( 218 scoped_ptr<FakeAuthenticator> authenticator(new FakeAuthenticator(
219 FakeAuthenticator::HOST, round_trips_, action_, async_)); 219 FakeAuthenticator::HOST, round_trips_, action_, async_));
220 authenticator->set_messages_till_started(messages_till_started_); 220 authenticator->set_messages_till_started(messages_till_started_);
221 return std::move(authenticator); 221 return std::move(authenticator);
222 } 222 }
223 223
224 } // namespace protocol 224 } // namespace protocol
225 } // namespace remoting 225 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698