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_authenticator.h" | 5 #include "remoting/protocol/fake_authenticator.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/socket/stream_socket.h" | 10 #include "net/socket/stream_socket.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 // We are not done yet. process next message. | 110 // We are not done yet. process next message. |
111 if ((messages_ % 2 == 0 && type_ == CLIENT) || | 111 if ((messages_ % 2 == 0 && type_ == CLIENT) || |
112 (messages_ % 2 == 1 && type_ == HOST)) { | 112 (messages_ % 2 == 1 && type_ == HOST)) { |
113 return MESSAGE_READY; | 113 return MESSAGE_READY; |
114 } else { | 114 } else { |
115 return WAITING_MESSAGE; | 115 return WAITING_MESSAGE; |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
| 119 bool FakeAuthenticator::started() const { |
| 120 return messages_ > 0; |
| 121 } |
| 122 |
119 Authenticator::RejectionReason FakeAuthenticator::rejection_reason() const { | 123 Authenticator::RejectionReason FakeAuthenticator::rejection_reason() const { |
120 EXPECT_EQ(REJECTED, state()); | 124 EXPECT_EQ(REJECTED, state()); |
121 return INVALID_CREDENTIALS; | 125 return INVALID_CREDENTIALS; |
122 } | 126 } |
123 | 127 |
124 void FakeAuthenticator::ProcessMessage(const buzz::XmlElement* message, | 128 void FakeAuthenticator::ProcessMessage(const buzz::XmlElement* message, |
125 const base::Closure& resume_callback) { | 129 const base::Closure& resume_callback) { |
126 EXPECT_EQ(WAITING_MESSAGE, state()); | 130 EXPECT_EQ(WAITING_MESSAGE, state()); |
127 std::string id = | 131 std::string id = |
128 message->TextNamed(buzz::QName(kChromotingXmlNamespace, "id")); | 132 message->TextNamed(buzz::QName(kChromotingXmlNamespace, "id")); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 scoped_ptr<Authenticator> FakeHostAuthenticatorFactory::CreateAuthenticator( | 168 scoped_ptr<Authenticator> FakeHostAuthenticatorFactory::CreateAuthenticator( |
165 const std::string& local_jid, | 169 const std::string& local_jid, |
166 const std::string& remote_jid, | 170 const std::string& remote_jid, |
167 const buzz::XmlElement* first_message) { | 171 const buzz::XmlElement* first_message) { |
168 return scoped_ptr<Authenticator>(new FakeAuthenticator( | 172 return scoped_ptr<Authenticator>(new FakeAuthenticator( |
169 FakeAuthenticator::HOST, round_trips_, action_, async_)); | 173 FakeAuthenticator::HOST, round_trips_, action_, async_)); |
170 } | 174 } |
171 | 175 |
172 } // namespace protocol | 176 } // namespace protocol |
173 } // namespace remoting | 177 } // namespace remoting |
OLD | NEW |