| 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 #ifndef REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_ | 5 #ifndef REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_ |
| 6 #define REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_ | 6 #define REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "remoting/protocol/authenticator.h" | 10 #include "remoting/protocol/authenticator.h" |
| 11 #include "remoting/protocol/channel_authenticator.h" | 11 #include "remoting/protocol/channel_authenticator.h" |
| 12 | 12 |
| 13 namespace remoting { | 13 namespace remoting { |
| 14 namespace protocol { | 14 namespace protocol { |
| 15 | 15 |
| 16 class FakeChannelAuthenticator : public ChannelAuthenticator { | 16 class FakeChannelAuthenticator : public ChannelAuthenticator { |
| 17 public: | 17 public: |
| 18 FakeChannelAuthenticator(bool accept, bool async); | 18 FakeChannelAuthenticator(bool accept, bool async); |
| 19 virtual ~FakeChannelAuthenticator(); | 19 virtual ~FakeChannelAuthenticator(); |
| 20 | 20 |
| 21 // ChannelAuthenticator interface. | 21 // ChannelAuthenticator interface. |
| 22 virtual void SecureAndAuthenticate( | 22 virtual void SecureAndAuthenticate( |
| 23 scoped_ptr<net::StreamSocket> socket, | 23 scoped_ptr<net::StreamSocket> socket, |
| 24 const DoneCallback& done_callback) OVERRIDE; | 24 const DoneCallback& done_callback) OVERRIDE; |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 void CallCallback( |
| 28 net::Error error, |
| 29 scoped_ptr<net::StreamSocket> socket); |
| 30 |
| 27 void OnAuthBytesWritten(int result); | 31 void OnAuthBytesWritten(int result); |
| 28 void OnAuthBytesRead(int result); | 32 void OnAuthBytesRead(int result); |
| 29 | 33 |
| 30 void CallDoneCallback(); | 34 net::Error result_; |
| 31 | |
| 32 int result_; | |
| 33 bool async_; | 35 bool async_; |
| 34 | 36 |
| 35 scoped_ptr<net::StreamSocket> socket_; | 37 scoped_ptr<net::StreamSocket> socket_; |
| 36 DoneCallback done_callback_; | 38 DoneCallback done_callback_; |
| 37 | 39 |
| 38 bool did_read_bytes_; | 40 bool did_read_bytes_; |
| 39 bool did_write_bytes_; | 41 bool did_write_bytes_; |
| 40 | 42 |
| 41 base::WeakPtrFactory<FakeChannelAuthenticator> weak_factory_; | 43 base::WeakPtrFactory<FakeChannelAuthenticator> weak_factory_; |
| 42 | 44 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 FakeAuthenticator::Action action_; | 110 FakeAuthenticator::Action action_; |
| 109 bool async_; | 111 bool async_; |
| 110 | 112 |
| 111 DISALLOW_COPY_AND_ASSIGN(FakeHostAuthenticatorFactory); | 113 DISALLOW_COPY_AND_ASSIGN(FakeHostAuthenticatorFactory); |
| 112 }; | 114 }; |
| 113 | 115 |
| 114 } // namespace protocol | 116 } // namespace protocol |
| 115 } // namespace remoting | 117 } // namespace remoting |
| 116 | 118 |
| 117 #endif // REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_ | 119 #endif // REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_ |
| OLD | NEW |