| Index: remoting/protocol/authenticator_test_base.cc
|
| diff --git a/remoting/protocol/authenticator_test_base.cc b/remoting/protocol/authenticator_test_base.cc
|
| index 18450987f3f0559e79f491eda89cd4a47491cfe1..2805d99ed83a3e766b855ba985182ceb3e517226 100644
|
| --- a/remoting/protocol/authenticator_test_base.cc
|
| +++ b/remoting/protocol/authenticator_test_base.cc
|
| @@ -60,36 +60,27 @@ void AuthenticatorTestBase::SetUp() {
|
| }
|
|
|
| void AuthenticatorTestBase::RunAuthExchange() {
|
| - do {
|
| - scoped_ptr<buzz::XmlElement> message;
|
| -
|
| - // Pass message from client to host.
|
| - ASSERT_EQ(Authenticator::MESSAGE_READY, client_->state());
|
| - message = client_->GetNextMessage();
|
| - ASSERT_TRUE(message.get());
|
| - ASSERT_NE(Authenticator::MESSAGE_READY, client_->state());
|
| -
|
| - ASSERT_EQ(Authenticator::WAITING_MESSAGE, host_->state());
|
| - host_->ProcessMessage(message.get());
|
| - ASSERT_NE(Authenticator::WAITING_MESSAGE, host_->state());
|
| -
|
| - // Are we done yet?
|
| - if (host_->state() == Authenticator::ACCEPTED ||
|
| - host_->state() == Authenticator::REJECTED) {
|
| - break;
|
| - }
|
| -
|
| - // Pass message from host to client.
|
| - ASSERT_EQ(Authenticator::MESSAGE_READY, host_->state());
|
| - message = host_->GetNextMessage();
|
| - ASSERT_TRUE(message.get());
|
| - ASSERT_NE(Authenticator::MESSAGE_READY, host_->state());
|
| -
|
| - ASSERT_EQ(Authenticator::WAITING_MESSAGE, client_->state());
|
| - client_->ProcessMessage(message.get());
|
| - ASSERT_NE(Authenticator::WAITING_MESSAGE, client_->state());
|
| - } while (client_->state() != Authenticator::ACCEPTED &&
|
| - client_->state() != Authenticator::REJECTED);
|
| + ContinueAuthExchangeWith(client_.get(), host_.get());
|
| +}
|
| +
|
| +// static
|
| +void AuthenticatorTestBase::ContinueAuthExchangeWith(Authenticator* sender,
|
| + Authenticator* receiver) {
|
| + 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.
|
| + ASSERT_EQ(Authenticator::MESSAGE_READY, sender->state());
|
| + message = sender->GetNextMessage();
|
| + ASSERT_TRUE(message.get());
|
| + ASSERT_NE(Authenticator::MESSAGE_READY, sender->state());
|
| +
|
| + ASSERT_EQ(Authenticator::WAITING_MESSAGE, receiver->state());
|
| + receiver->ProcessMessage(message.get(), base::Bind(
|
| + &AuthenticatorTestBase::ContinueAuthExchangeWith,
|
| + base::Unretained(receiver), base::Unretained(sender)));
|
| }
|
|
|
| void AuthenticatorTestBase::RunChannelAuth(bool expected_fail) {
|
|
|