| 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/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 9 #include "remoting/protocol/authenticator.h" | 10 #include "remoting/protocol/authenticator.h" |
| 10 #include "remoting/protocol/channel_authenticator.h" | 11 #include "remoting/protocol/channel_authenticator.h" |
| 11 | 12 |
| 12 namespace remoting { | 13 namespace remoting { |
| 13 namespace protocol { | 14 namespace protocol { |
| 14 | 15 |
| 15 class FakeChannelAuthenticator : public ChannelAuthenticator { | 16 class FakeChannelAuthenticator : public ChannelAuthenticator { |
| 16 public: | 17 public: |
| 17 FakeChannelAuthenticator(bool accept, bool async); | 18 FakeChannelAuthenticator(bool accept, bool async); |
| 18 virtual ~FakeChannelAuthenticator(); | 19 virtual ~FakeChannelAuthenticator(); |
| 19 | 20 |
| 20 // ChannelAuthenticator interface. | 21 // ChannelAuthenticator interface. |
| 21 virtual void SecureAndAuthenticate( | 22 virtual void SecureAndAuthenticate( |
| 22 scoped_ptr<net::StreamSocket> socket, | 23 scoped_ptr<net::StreamSocket> socket, |
| 23 const DoneCallback& done_callback) OVERRIDE; | 24 const DoneCallback& done_callback) OVERRIDE; |
| 24 | 25 |
| 25 private: | 26 private: |
| 26 void CallCallback( | 27 void CallCallback( |
| 27 const DoneCallback& done_callback, | |
| 28 net::Error error, | 28 net::Error error, |
| 29 scoped_ptr<net::StreamSocket> socket); | 29 scoped_ptr<net::StreamSocket> socket); |
| 30 | 30 |
| 31 bool accept_; | 31 void OnAuthBytesWritten(int result); |
| 32 void OnAuthBytesRead(int result); |
| 33 |
| 34 net::Error result_; |
| 32 bool async_; | 35 bool async_; |
| 33 | 36 |
| 37 scoped_ptr<net::StreamSocket> socket_; |
| 38 DoneCallback done_callback_; |
| 39 |
| 40 bool did_read_bytes_; |
| 41 bool did_write_bytes_; |
| 42 |
| 34 base::WeakPtrFactory<FakeChannelAuthenticator> weak_factory_; | 43 base::WeakPtrFactory<FakeChannelAuthenticator> weak_factory_; |
| 35 | 44 |
| 36 DISALLOW_COPY_AND_ASSIGN(FakeChannelAuthenticator); | 45 DISALLOW_COPY_AND_ASSIGN(FakeChannelAuthenticator); |
| 37 }; | 46 }; |
| 38 | 47 |
| 39 class FakeAuthenticator : public Authenticator { | 48 class FakeAuthenticator : public Authenticator { |
| 40 public: | 49 public: |
| 41 enum Type { | 50 enum Type { |
| 42 HOST, | 51 HOST, |
| 43 CLIENT, | 52 CLIENT, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 FakeAuthenticator::Action action_; | 97 FakeAuthenticator::Action action_; |
| 89 bool async_; | 98 bool async_; |
| 90 | 99 |
| 91 DISALLOW_COPY_AND_ASSIGN(FakeHostAuthenticatorFactory); | 100 DISALLOW_COPY_AND_ASSIGN(FakeHostAuthenticatorFactory); |
| 92 }; | 101 }; |
| 93 | 102 |
| 94 } // namespace protocol | 103 } // namespace protocol |
| 95 } // namespace remoting | 104 } // namespace remoting |
| 96 | 105 |
| 97 #endif // REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_ | 106 #endif // REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_ |
| OLD | NEW |