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

Unified Diff: remoting/protocol/fake_authenticator.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/fake_authenticator.h ('k') | remoting/protocol/jingle_session.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/fake_authenticator.cc
diff --git a/remoting/protocol/fake_authenticator.cc b/remoting/protocol/fake_authenticator.cc
index 67f5d351db99787732997151327ce0b282e08f58..67c1ccabd91fab83ed9a953e3105e0871ed97c68 100644
--- a/remoting/protocol/fake_authenticator.cc
+++ b/remoting/protocol/fake_authenticator.cc
@@ -84,12 +84,17 @@ FakeAuthenticator::FakeAuthenticator(
round_trips_(round_trips),
action_(action),
async_(async),
- messages_(0) {
+ messages_(0),
+ messages_till_started_(0) {
}
FakeAuthenticator::~FakeAuthenticator() {
}
+void FakeAuthenticator::set_messages_till_started(int messages) {
+ messages_till_started_ = messages;
+}
+
Authenticator::State FakeAuthenticator::state() const {
EXPECT_LE(messages_, round_trips_ * 2);
if (messages_ >= round_trips_ * 2) {
@@ -116,6 +121,10 @@ Authenticator::State FakeAuthenticator::state() const {
}
}
+bool FakeAuthenticator::started() const {
+ return messages_ > messages_till_started_;
+}
+
Authenticator::RejectionReason FakeAuthenticator::rejection_reason() const {
EXPECT_EQ(REJECTED, state());
return INVALID_CREDENTIALS;
@@ -153,8 +162,10 @@ FakeAuthenticator::CreateChannelAuthenticator() const {
}
FakeHostAuthenticatorFactory::FakeHostAuthenticatorFactory(
- int round_trips, FakeAuthenticator::Action action, bool async)
+ int round_trips, int messages_till_started,
+ FakeAuthenticator::Action action, bool async)
: round_trips_(round_trips),
+ messages_till_started_(messages_till_started),
action_(action), async_(async) {
}
@@ -165,8 +176,12 @@ scoped_ptr<Authenticator> FakeHostAuthenticatorFactory::CreateAuthenticator(
const std::string& local_jid,
const std::string& remote_jid,
const buzz::XmlElement* first_message) {
- return scoped_ptr<Authenticator>(new FakeAuthenticator(
- FakeAuthenticator::HOST, round_trips_, action_, async_));
+ FakeAuthenticator* authenticator = new FakeAuthenticator(
+ FakeAuthenticator::HOST, round_trips_, action_, async_);
+ authenticator->set_messages_till_started(messages_till_started_);
+
+ scoped_ptr<Authenticator> result(authenticator);
+ return result.Pass();
}
} // namespace protocol
« no previous file with comments | « remoting/protocol/fake_authenticator.h ('k') | remoting/protocol/jingle_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698