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

Unified Diff: remoting/protocol/authenticator_test_base.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/authenticator_test_base.cc
diff --git a/remoting/protocol/authenticator_test_base.cc b/remoting/protocol/authenticator_test_base.cc
index 25b0efecb80d4deeee21dc93502b3e023e89ab6b..1b65dbe4d7e24db3ea5ca72af676f5526c6354f8 100644
--- a/remoting/protocol/authenticator_test_base.cc
+++ b/remoting/protocol/authenticator_test_base.cc
@@ -60,22 +60,43 @@ void AuthenticatorTestBase::SetUp() {
}
void AuthenticatorTestBase::RunAuthExchange() {
- ContinueAuthExchangeWith(client_.get(), host_.get());
+ ContinueAuthExchangeWith(client_.get(),
+ host_.get(),
+ client_->started(),
+ host_->started());
}
void AuthenticatorTestBase::RunHostInitiatedAuthExchange() {
- ContinueAuthExchangeWith(host_.get(), client_.get());
+ ContinueAuthExchangeWith(host_.get(),
+ client_.get(),
+ host_->started(),
+ client_->started());
}
// static
+// This function sends a message from the sender and receiver and recursively
+// calls itself to the send the next message from the receiver to the sender
+// untils the authentication completes.
void AuthenticatorTestBase::ContinueAuthExchangeWith(Authenticator* sender,
- Authenticator* receiver) {
+ Authenticator* receiver,
+ bool sender_started,
+ bool receiver_started) {
scoped_ptr<buzz::XmlElement> message;
ASSERT_NE(Authenticator::WAITING_MESSAGE, sender->state());
if (sender->state() == Authenticator::ACCEPTED ||
sender->state() == Authenticator::REJECTED)
return;
- // Pass message from client to host.
+
+ // Verify that once the started flag for either party is set to true,
+ // it should always stay true.
+ if (receiver_started) {
+ ASSERT_TRUE(receiver->started());
+ }
+
+ if (sender_started) {
+ ASSERT_TRUE(sender->started());
+ }
+
ASSERT_EQ(Authenticator::MESSAGE_READY, sender->state());
message = sender->GetNextMessage();
ASSERT_TRUE(message.get());
@@ -84,7 +105,8 @@ void AuthenticatorTestBase::ContinueAuthExchangeWith(Authenticator* sender,
ASSERT_EQ(Authenticator::WAITING_MESSAGE, receiver->state());
receiver->ProcessMessage(message.get(), base::Bind(
&AuthenticatorTestBase::ContinueAuthExchangeWith,
- base::Unretained(receiver), base::Unretained(sender)));
+ base::Unretained(receiver), base::Unretained(sender),
+ receiver->started(), sender->started()));
}
void AuthenticatorTestBase::RunChannelAuth(bool expected_fail) {

Powered by Google App Engine
This is Rietveld 408576698