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" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // started() returns true. Default to 0. | 63 // started() returns true. Default to 0. |
64 void set_messages_till_started(int messages); | 64 void set_messages_till_started(int messages); |
65 | 65 |
66 // Authenticator interface. | 66 // Authenticator interface. |
67 State state() const override; | 67 State state() const override; |
68 bool started() const override; | 68 bool started() const override; |
69 RejectionReason rejection_reason() const override; | 69 RejectionReason rejection_reason() const override; |
70 void ProcessMessage(const buzz::XmlElement* message, | 70 void ProcessMessage(const buzz::XmlElement* message, |
71 const base::Closure& resume_callback) override; | 71 const base::Closure& resume_callback) override; |
72 scoped_ptr<buzz::XmlElement> GetNextMessage() override; | 72 scoped_ptr<buzz::XmlElement> GetNextMessage() override; |
| 73 const std::string& GetAuthKey() const override; |
73 scoped_ptr<ChannelAuthenticator> CreateChannelAuthenticator() const override; | 74 scoped_ptr<ChannelAuthenticator> CreateChannelAuthenticator() const override; |
74 | 75 |
75 protected: | 76 protected: |
76 Type type_; | 77 Type type_; |
77 int round_trips_; | 78 int round_trips_; |
78 Action action_; | 79 Action action_; |
79 bool async_; | 80 bool async_; |
80 | 81 |
81 // Total number of messages that have been processed. | 82 // Total number of messages that have been processed. |
82 int messages_; | 83 int messages_; |
83 // Number of messages that the authenticator needs to process before started() | 84 // Number of messages that the authenticator needs to process before started() |
84 // returns true. Default to 0. | 85 // returns true. Default to 0. |
85 int messages_till_started_; | 86 int messages_till_started_; |
86 | 87 |
| 88 std::string auth_key_; |
| 89 |
87 DISALLOW_COPY_AND_ASSIGN(FakeAuthenticator); | 90 DISALLOW_COPY_AND_ASSIGN(FakeAuthenticator); |
88 }; | 91 }; |
89 | 92 |
90 class FakeHostAuthenticatorFactory : public AuthenticatorFactory { | 93 class FakeHostAuthenticatorFactory : public AuthenticatorFactory { |
91 public: | 94 public: |
92 FakeHostAuthenticatorFactory( | 95 FakeHostAuthenticatorFactory( |
93 int round_trips, int messages_till_start, | 96 int round_trips, int messages_till_start, |
94 FakeAuthenticator::Action action, bool async); | 97 FakeAuthenticator::Action action, bool async); |
95 ~FakeHostAuthenticatorFactory() override; | 98 ~FakeHostAuthenticatorFactory() override; |
96 | 99 |
97 // AuthenticatorFactory interface. | 100 // AuthenticatorFactory interface. |
98 scoped_ptr<Authenticator> CreateAuthenticator( | 101 scoped_ptr<Authenticator> CreateAuthenticator( |
99 const std::string& local_jid, | 102 const std::string& local_jid, |
100 const std::string& remote_jid, | 103 const std::string& remote_jid, |
101 const buzz::XmlElement* first_message) override; | 104 const buzz::XmlElement* first_message) override; |
102 | 105 |
103 private: | 106 private: |
104 int round_trips_; | 107 int round_trips_; |
105 int messages_till_started_; | 108 int messages_till_started_; |
106 FakeAuthenticator::Action action_; | 109 FakeAuthenticator::Action action_; |
107 bool async_; | 110 bool async_; |
108 | 111 |
109 DISALLOW_COPY_AND_ASSIGN(FakeHostAuthenticatorFactory); | 112 DISALLOW_COPY_AND_ASSIGN(FakeHostAuthenticatorFactory); |
110 }; | 113 }; |
111 | 114 |
112 } // namespace protocol | 115 } // namespace protocol |
113 } // namespace remoting | 116 } // namespace remoting |
114 | 117 |
115 #endif // REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_ | 118 #endif // REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_ |
OLD | NEW |