OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "remoting/protocol/authenticator.h" | 9 #include "remoting/protocol/authenticator.h" |
10 #include "remoting/protocol/channel_authenticator.h" | 10 #include "remoting/protocol/channel_authenticator.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 REJECT, | 47 REJECT, |
48 REJECT_CHANNEL | 48 REJECT_CHANNEL |
49 }; | 49 }; |
50 | 50 |
51 FakeAuthenticator(Type type, int round_trips, Action action, bool async); | 51 FakeAuthenticator(Type type, int round_trips, Action action, bool async); |
52 virtual ~FakeAuthenticator(); | 52 virtual ~FakeAuthenticator(); |
53 | 53 |
54 // Authenticator interface. | 54 // Authenticator interface. |
55 virtual State state() const OVERRIDE; | 55 virtual State state() const OVERRIDE; |
56 virtual void ProcessMessage(const buzz::XmlElement* message) OVERRIDE; | 56 virtual void ProcessMessage(const buzz::XmlElement* message) OVERRIDE; |
57 virtual buzz::XmlElement* GetNextMessage() OVERRIDE; | 57 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; |
58 virtual ChannelAuthenticator* CreateChannelAuthenticator() const OVERRIDE; | 58 virtual scoped_ptr<ChannelAuthenticator> |
| 59 CreateChannelAuthenticator() const OVERRIDE; |
59 | 60 |
60 protected: | 61 protected: |
61 Type type_; | 62 Type type_; |
62 int round_trips_; | 63 int round_trips_; |
63 Action action_; | 64 Action action_; |
64 bool async_; | 65 bool async_; |
65 | 66 |
66 // Total number of messages that have been processed. | 67 // Total number of messages that have been processed. |
67 int messages_; | 68 int messages_; |
68 | 69 |
69 DISALLOW_COPY_AND_ASSIGN(FakeAuthenticator); | 70 DISALLOW_COPY_AND_ASSIGN(FakeAuthenticator); |
70 }; | 71 }; |
71 | 72 |
72 class FakeHostAuthenticatorFactory : public AuthenticatorFactory { | 73 class FakeHostAuthenticatorFactory : public AuthenticatorFactory { |
73 public: | 74 public: |
74 FakeHostAuthenticatorFactory( | 75 FakeHostAuthenticatorFactory( |
75 int round_trips, FakeAuthenticator::Action action, bool async); | 76 int round_trips, FakeAuthenticator::Action action, bool async); |
76 virtual ~FakeHostAuthenticatorFactory(); | 77 virtual ~FakeHostAuthenticatorFactory(); |
77 | 78 |
78 // AuthenticatorFactory interface. | 79 // AuthenticatorFactory interface. |
79 virtual Authenticator* CreateAuthenticator( | 80 virtual scoped_ptr<Authenticator> CreateAuthenticator( |
80 const std::string& remote_jid, | 81 const std::string& remote_jid, |
81 const buzz::XmlElement* first_message) OVERRIDE; | 82 const buzz::XmlElement* first_message) OVERRIDE; |
82 | 83 |
83 private: | 84 private: |
84 int round_trips_; | 85 int round_trips_; |
85 FakeAuthenticator::Action action_; | 86 FakeAuthenticator::Action action_; |
86 bool async_; | 87 bool async_; |
87 | 88 |
88 DISALLOW_COPY_AND_ASSIGN(FakeHostAuthenticatorFactory); | 89 DISALLOW_COPY_AND_ASSIGN(FakeHostAuthenticatorFactory); |
89 }; | 90 }; |
90 | 91 |
91 } // namespace protocol | 92 } // namespace protocol |
92 } // namespace remoting | 93 } // namespace remoting |
93 | 94 |
94 #endif // REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_ | 95 #endif // REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_ |
OLD | NEW |