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

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: Add unittest to chromoting_host and jingle_session Created 6 years, 9 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
Index: remoting/protocol/fake_authenticator.cc
diff --git a/remoting/protocol/fake_authenticator.cc b/remoting/protocol/fake_authenticator.cc
index 67f5d351db99787732997151327ce0b282e08f58..8fd9f930ccc5e3b23fb92eac171ca25ea6d9dee4 100644
--- a/remoting/protocol/fake_authenticator.cc
+++ b/remoting/protocol/fake_authenticator.cc
@@ -79,12 +79,24 @@ void FakeChannelAuthenticator::OnAuthBytesRead(int result) {
}
FakeAuthenticator::FakeAuthenticator(
+ Type type, int round_trips, int messages_till_started,
+ Action action, bool async)
+ : type_(type),
+ round_trips_(round_trips),
+ action_(action),
+ async_(async),
+ messages_(0),
+ messages_till_started_(messages_till_started) {
+}
+
+FakeAuthenticator::FakeAuthenticator(
Type type, int round_trips, Action action, bool async)
: type_(type),
round_trips_(round_trips),
action_(action),
async_(async),
- messages_(0) {
+ messages_(0),
+ messages_till_started_(0) {
}
FakeAuthenticator::~FakeAuthenticator() {
@@ -116,6 +128,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 +169,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) {
}
@@ -166,7 +184,8 @@ scoped_ptr<Authenticator> FakeHostAuthenticatorFactory::CreateAuthenticator(
const std::string& remote_jid,
const buzz::XmlElement* first_message) {
return scoped_ptr<Authenticator>(new FakeAuthenticator(
- FakeAuthenticator::HOST, round_trips_, action_, async_));
+ FakeAuthenticator::HOST, round_trips_,
+ messages_till_started_, action_, async_));
}
} // namespace protocol

Powered by Google App Engine
This is Rietveld 408576698