OLD | NEW |
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_session.h" | 5 #include "remoting/protocol/fake_session.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 peer->peer_ = weak_factory_.GetWeakPtr(); | 27 peer->peer_ = weak_factory_.GetWeakPtr(); |
28 | 28 |
29 event_handler_->OnSessionStateChange(CONNECTING); | 29 event_handler_->OnSessionStateChange(CONNECTING); |
30 peer->event_handler_->OnSessionStateChange(ACCEPTING); | 30 peer->event_handler_->OnSessionStateChange(ACCEPTING); |
31 peer->event_handler_->OnSessionStateChange(ACCEPTED); | 31 peer->event_handler_->OnSessionStateChange(ACCEPTED); |
32 event_handler_->OnSessionStateChange(ACCEPTED); | 32 event_handler_->OnSessionStateChange(ACCEPTED); |
33 event_handler_->OnSessionStateChange(AUTHENTICATING); | 33 event_handler_->OnSessionStateChange(AUTHENTICATING); |
34 peer->event_handler_->OnSessionStateChange(AUTHENTICATING); | 34 peer->event_handler_->OnSessionStateChange(AUTHENTICATING); |
35 | 35 |
36 // Initialize transport and authenticator on the client. | 36 // Initialize transport and authenticator on the client. |
37 authenticator_.reset(new FakeAuthenticator(FakeAuthenticator::CLIENT, 0, | 37 authenticator_.reset(new FakeAuthenticator(FakeAuthenticator::ACCEPT)); |
38 FakeAuthenticator::ACCEPT, false)); | |
39 authenticator_->set_auth_key(kTestAuthKey); | 38 authenticator_->set_auth_key(kTestAuthKey); |
40 transport_->Start(authenticator_.get(), | 39 transport_->Start(authenticator_.get(), |
41 base::Bind(&FakeSession::SendTransportInfo, | 40 base::Bind(&FakeSession::SendTransportInfo, |
42 weak_factory_.GetWeakPtr())); | 41 weak_factory_.GetWeakPtr())); |
43 | 42 |
44 // Initialize transport and authenticator on the host. | 43 // Initialize transport and authenticator on the host. |
45 peer->authenticator_.reset(new FakeAuthenticator( | 44 peer->authenticator_.reset(new FakeAuthenticator(FakeAuthenticator::ACCEPT)); |
46 FakeAuthenticator::HOST, 0, FakeAuthenticator::ACCEPT, false)); | |
47 peer->authenticator_->set_auth_key(kTestAuthKey); | 45 peer->authenticator_->set_auth_key(kTestAuthKey); |
48 peer->transport_->Start(peer->authenticator_.get(), | 46 peer->transport_->Start(peer->authenticator_.get(), |
49 base::Bind(&FakeSession::SendTransportInfo, peer_)); | 47 base::Bind(&FakeSession::SendTransportInfo, peer_)); |
50 | 48 |
51 peer->event_handler_->OnSessionStateChange(AUTHENTICATED); | 49 peer->event_handler_->OnSessionStateChange(AUTHENTICATED); |
52 event_handler_->OnSessionStateChange(AUTHENTICATED); | 50 event_handler_->OnSessionStateChange(AUTHENTICATED); |
53 } | 51 } |
54 | 52 |
55 void FakeSession::SetEventHandler(EventHandler* event_handler) { | 53 void FakeSession::SetEventHandler(EventHandler* event_handler) { |
56 event_handler_ = event_handler; | 54 event_handler_ = event_handler; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 void FakeSession::SetAttachment(size_t round, | 125 void FakeSession::SetAttachment(size_t round, |
128 std::unique_ptr<buzz::XmlElement> attachment) { | 126 std::unique_ptr<buzz::XmlElement> attachment) { |
129 while (attachments_.size() <= round) { | 127 while (attachments_.size() <= round) { |
130 attachments_.emplace_back(); | 128 attachments_.emplace_back(); |
131 } | 129 } |
132 attachments_[round] = std::move(attachment); | 130 attachments_[round] = std::move(attachment); |
133 } | 131 } |
134 | 132 |
135 } // namespace protocol | 133 } // namespace protocol |
136 } // namespace remoting | 134 } // namespace remoting |
OLD | NEW |