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 | |
31 void OnAuthBytesWritten(int result); | 27 void OnAuthBytesWritten(int result); |
32 void OnAuthBytesRead(int result); | 28 void OnAuthBytesRead(int result); |
33 | 29 |
34 net::Error result_; | 30 void CallDoneCallback(); |
| 31 |
| 32 int result_; |
35 bool async_; | 33 bool async_; |
36 | 34 |
37 scoped_ptr<net::StreamSocket> socket_; | 35 scoped_ptr<net::StreamSocket> socket_; |
38 DoneCallback done_callback_; | 36 DoneCallback done_callback_; |
39 | 37 |
40 bool did_read_bytes_; | 38 bool did_read_bytes_; |
41 bool did_write_bytes_; | 39 bool did_write_bytes_; |
42 | 40 |
43 base::WeakPtrFactory<FakeChannelAuthenticator> weak_factory_; | 41 base::WeakPtrFactory<FakeChannelAuthenticator> weak_factory_; |
44 | 42 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 FakeAuthenticator::Action action_; | 108 FakeAuthenticator::Action action_; |
111 bool async_; | 109 bool async_; |
112 | 110 |
113 DISALLOW_COPY_AND_ASSIGN(FakeHostAuthenticatorFactory); | 111 DISALLOW_COPY_AND_ASSIGN(FakeHostAuthenticatorFactory); |
114 }; | 112 }; |
115 | 113 |
116 } // namespace protocol | 114 } // namespace protocol |
117 } // namespace remoting | 115 } // namespace remoting |
118 | 116 |
119 #endif // REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_ | 117 #endif // REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_ |
OLD | NEW |