Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: remoting/protocol/fake_authenticator.h

Issue 205583011: [Draft] Fix canceling pin prompt causes host overload (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Last round of feedbacks Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/connection_to_host.cc ('k') | remoting/protocol/fake_authenticator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 CLIENT, 52 CLIENT,
53 }; 53 };
54 54
55 enum Action { 55 enum Action {
56 ACCEPT, 56 ACCEPT,
57 REJECT, 57 REJECT,
58 REJECT_CHANNEL 58 REJECT_CHANNEL
59 }; 59 };
60 60
61 FakeAuthenticator(Type type, int round_trips, Action action, bool async); 61 FakeAuthenticator(Type type, int round_trips, Action action, bool async);
62
62 virtual ~FakeAuthenticator(); 63 virtual ~FakeAuthenticator();
63 64
65 // Set the number of messages that the authenticator needs to process before
66 // started() returns true. Default to 0.
67 void set_messages_till_started(int messages);
68
64 // Authenticator interface. 69 // Authenticator interface.
65 virtual State state() const OVERRIDE; 70 virtual State state() const OVERRIDE;
71 virtual bool started() const OVERRIDE;
66 virtual RejectionReason rejection_reason() const OVERRIDE; 72 virtual RejectionReason rejection_reason() const OVERRIDE;
67 virtual void ProcessMessage(const buzz::XmlElement* message, 73 virtual void ProcessMessage(const buzz::XmlElement* message,
68 const base::Closure& resume_callback) OVERRIDE; 74 const base::Closure& resume_callback) OVERRIDE;
69 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; 75 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE;
70 virtual scoped_ptr<ChannelAuthenticator> 76 virtual scoped_ptr<ChannelAuthenticator>
71 CreateChannelAuthenticator() const OVERRIDE; 77 CreateChannelAuthenticator() const OVERRIDE;
72 78
73 protected: 79 protected:
74 Type type_; 80 Type type_;
75 int round_trips_; 81 int round_trips_;
76 Action action_; 82 Action action_;
77 bool async_; 83 bool async_;
78 84
79 // Total number of messages that have been processed. 85 // Total number of messages that have been processed.
80 int messages_; 86 int messages_;
87 // Number of messages that the authenticator needs to process before started()
88 // returns true. Default to 0.
89 int messages_till_started_;
81 90
82 DISALLOW_COPY_AND_ASSIGN(FakeAuthenticator); 91 DISALLOW_COPY_AND_ASSIGN(FakeAuthenticator);
83 }; 92 };
84 93
85 class FakeHostAuthenticatorFactory : public AuthenticatorFactory { 94 class FakeHostAuthenticatorFactory : public AuthenticatorFactory {
86 public: 95 public:
87 FakeHostAuthenticatorFactory( 96 FakeHostAuthenticatorFactory(
88 int round_trips, FakeAuthenticator::Action action, bool async); 97 int round_trips, int messages_till_start,
98 FakeAuthenticator::Action action, bool async);
89 virtual ~FakeHostAuthenticatorFactory(); 99 virtual ~FakeHostAuthenticatorFactory();
90 100
91 // AuthenticatorFactory interface. 101 // AuthenticatorFactory interface.
92 virtual scoped_ptr<Authenticator> CreateAuthenticator( 102 virtual scoped_ptr<Authenticator> CreateAuthenticator(
93 const std::string& local_jid, 103 const std::string& local_jid,
94 const std::string& remote_jid, 104 const std::string& remote_jid,
95 const buzz::XmlElement* first_message) OVERRIDE; 105 const buzz::XmlElement* first_message) OVERRIDE;
96 106
97 private: 107 private:
98 int round_trips_; 108 int round_trips_;
109 int messages_till_started_;
99 FakeAuthenticator::Action action_; 110 FakeAuthenticator::Action action_;
100 bool async_; 111 bool async_;
101 112
102 DISALLOW_COPY_AND_ASSIGN(FakeHostAuthenticatorFactory); 113 DISALLOW_COPY_AND_ASSIGN(FakeHostAuthenticatorFactory);
103 }; 114 };
104 115
105 } // namespace protocol 116 } // namespace protocol
106 } // namespace remoting 117 } // namespace remoting
107 118
108 #endif // REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_ 119 #endif // REMOTING_PROTOCOL_FAKE_AUTHENTICATOR_H_
OLDNEW
« no previous file with comments | « remoting/protocol/connection_to_host.cc ('k') | remoting/protocol/fake_authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698