Chromium Code Reviews| Index: remoting/protocol/authenticator_test_base.cc |
| diff --git a/remoting/protocol/authenticator_test_base.cc b/remoting/protocol/authenticator_test_base.cc |
| index 1e3f5409adb8578fef452286738897556548bb07..cd77841ecb5b90ef3d594c5ba6254d7c4820f242 100644 |
| --- a/remoting/protocol/authenticator_test_base.cc |
| +++ b/remoting/protocol/authenticator_test_base.cc |
| @@ -59,36 +59,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); |
| + RunAuthExchangeStep(client_.get(), host_.get()); |
|
Sergey Ulanov
2013/03/01 01:28:30
This changes behavior of this function. Should it
rmsousa
2013/03/01 02:22:11
It's the other one that's named wrongly - running
|
| +} |
| + |
| +void AuthenticatorTestBase::RunAuthExchangeStep(Authenticator* sender, |
|
Sergey Ulanov
2013/03/01 01:28:30
Can this be static?
rmsousa
2013/03/01 02:22:11
Yes.
|
| + 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(base::Bind( |
| + &AuthenticatorTestBase::RunAuthExchangeStep, |
| + base::Unretained(this), base::Unretained(receiver), |
| + base::Unretained(sender)), message.get()); |
| } |
| void AuthenticatorTestBase::RunChannelAuth(bool expected_fail) { |