| Index: jingle/notifier/communicator/single_login_attempt_unittest.cc
|
| diff --git a/jingle/notifier/communicator/single_login_attempt_unittest.cc b/jingle/notifier/communicator/single_login_attempt_unittest.cc
|
| index c00df3d3a4e96b048f32eac0ec3d018d0791426c..f731fd9871b139d32f950437714afdbede12d15e 100644
|
| --- a/jingle/notifier/communicator/single_login_attempt_unittest.cc
|
| +++ b/jingle/notifier/communicator/single_login_attempt_unittest.cc
|
| @@ -95,14 +95,19 @@ class SingleLoginAttemptTest : public ::testing::Test {
|
| net::HostPortPair("example.com", 100), SUPPORTS_SSLTCP)),
|
| false /* try_ssltcp_first */,
|
| "auth_mechanism"),
|
| - attempt_(login_settings_, &fake_delegate_) {}
|
| + attempt_(new SingleLoginAttempt(login_settings_, &fake_delegate_)) {}
|
|
|
| virtual void TearDown() OVERRIDE {
|
| message_loop_.RunUntilIdle();
|
| }
|
|
|
| void FireRedirect(buzz::XmlElement* redirect_error) {
|
| - attempt_.OnError(buzz::XmppEngine::ERROR_STREAM, 0, redirect_error);
|
| + attempt_->OnError(buzz::XmppEngine::ERROR_STREAM, 0, redirect_error);
|
| + }
|
| +
|
| + virtual ~SingleLoginAttemptTest() {
|
| + attempt_.reset();
|
| + message_loop_.RunUntilIdle();
|
| }
|
|
|
| private:
|
| @@ -110,7 +115,7 @@ class SingleLoginAttemptTest : public ::testing::Test {
|
| const LoginSettings login_settings_;
|
|
|
| protected:
|
| - SingleLoginAttempt attempt_;
|
| + scoped_ptr<SingleLoginAttempt> attempt_;
|
| FakeDelegate fake_delegate_;
|
| FakeBaseTask fake_base_task_;
|
| };
|
| @@ -118,7 +123,7 @@ class SingleLoginAttemptTest : public ::testing::Test {
|
| // Fire OnConnect and make sure the base task gets passed to the
|
| // delegate properly.
|
| TEST_F(SingleLoginAttemptTest, Basic) {
|
| - attempt_.OnConnect(fake_base_task_.AsWeakPtr());
|
| + attempt_->OnConnect(fake_base_task_.AsWeakPtr());
|
| EXPECT_EQ(CONNECTED, fake_delegate_.state());
|
| EXPECT_EQ(fake_base_task_.AsWeakPtr().get(),
|
| fake_delegate_.base_task().get());
|
| @@ -129,7 +134,7 @@ TEST_F(SingleLoginAttemptTest, Basic) {
|
| TEST_F(SingleLoginAttemptTest, Error) {
|
| for (int i = 0; i < 2; ++i) {
|
| EXPECT_EQ(IDLE, fake_delegate_.state());
|
| - attempt_.OnError(buzz::XmppEngine::ERROR_NONE, 0, NULL);
|
| + attempt_->OnError(buzz::XmppEngine::ERROR_NONE, 0, NULL);
|
| }
|
| EXPECT_EQ(SETTINGS_EXHAUSTED, fake_delegate_.state());
|
| }
|
| @@ -137,8 +142,8 @@ TEST_F(SingleLoginAttemptTest, Error) {
|
| // Fire OnErrors but replace the last one with OnConnect, and make
|
| // sure the delegate still gets the OnConnect message.
|
| TEST_F(SingleLoginAttemptTest, ErrorThenSuccess) {
|
| - attempt_.OnError(buzz::XmppEngine::ERROR_NONE, 0, NULL);
|
| - attempt_.OnConnect(fake_base_task_.AsWeakPtr());
|
| + attempt_->OnError(buzz::XmppEngine::ERROR_NONE, 0, NULL);
|
| + attempt_->OnConnect(fake_base_task_.AsWeakPtr());
|
| EXPECT_EQ(CONNECTED, fake_delegate_.state());
|
| EXPECT_EQ(fake_base_task_.AsWeakPtr().get(),
|
| fake_delegate_.base_task().get());
|
| @@ -245,7 +250,7 @@ TEST_F(SingleLoginAttemptTest, RedirectMissingSeeOtherHost) {
|
| // Fire 'Unauthorized' errors and make sure the delegate gets the
|
| // OnCredentialsRejected() event.
|
| TEST_F(SingleLoginAttemptTest, CredentialsRejected) {
|
| - attempt_.OnError(buzz::XmppEngine::ERROR_UNAUTHORIZED, 0, NULL);
|
| + attempt_->OnError(buzz::XmppEngine::ERROR_UNAUTHORIZED, 0, NULL);
|
| EXPECT_EQ(CREDENTIALS_REJECTED, fake_delegate_.state());
|
| }
|
|
|
|
|