| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "jingle/notifier/communicator/single_login_attempt.h" | 5 #include "jingle/notifier/communicator/single_login_attempt.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 scoped_ptr<net::TestURLRequestContext>( | 86 scoped_ptr<net::TestURLRequestContext>( |
| 87 new MyTestURLRequestContext())), | 87 new MyTestURLRequestContext())), |
| 88 ServerList( | 88 ServerList( |
| 89 1, | 89 1, |
| 90 ServerInformation( | 90 ServerInformation( |
| 91 net::HostPortPair("example.com", 100), SUPPORTS_SSLTCP)), | 91 net::HostPortPair("example.com", 100), SUPPORTS_SSLTCP)), |
| 92 false /* try_ssltcp_first */, | 92 false /* try_ssltcp_first */, |
| 93 "auth_mechanism"), | 93 "auth_mechanism"), |
| 94 attempt_(new SingleLoginAttempt(login_settings_, &fake_delegate_)) {} | 94 attempt_(new SingleLoginAttempt(login_settings_, &fake_delegate_)) {} |
| 95 | 95 |
| 96 virtual void TearDown() override { | 96 void TearDown() override { message_loop_.RunUntilIdle(); } |
| 97 message_loop_.RunUntilIdle(); | |
| 98 } | |
| 99 | 97 |
| 100 void FireRedirect(buzz::XmlElement* redirect_error) { | 98 void FireRedirect(buzz::XmlElement* redirect_error) { |
| 101 attempt_->OnError(buzz::XmppEngine::ERROR_STREAM, 0, redirect_error); | 99 attempt_->OnError(buzz::XmppEngine::ERROR_STREAM, 0, redirect_error); |
| 102 } | 100 } |
| 103 | 101 |
| 104 virtual ~SingleLoginAttemptTest() { | 102 ~SingleLoginAttemptTest() override { |
| 105 attempt_.reset(); | 103 attempt_.reset(); |
| 106 message_loop_.RunUntilIdle(); | 104 message_loop_.RunUntilIdle(); |
| 107 } | 105 } |
| 108 | 106 |
| 109 private: | 107 private: |
| 110 base::MessageLoop message_loop_; | 108 base::MessageLoop message_loop_; |
| 111 const LoginSettings login_settings_; | 109 const LoginSettings login_settings_; |
| 112 | 110 |
| 113 protected: | 111 protected: |
| 114 scoped_ptr<SingleLoginAttempt> attempt_; | 112 scoped_ptr<SingleLoginAttempt> attempt_; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // Fire 'Unauthorized' errors and make sure the delegate gets the | 244 // Fire 'Unauthorized' errors and make sure the delegate gets the |
| 247 // OnCredentialsRejected() event. | 245 // OnCredentialsRejected() event. |
| 248 TEST_F(SingleLoginAttemptTest, CredentialsRejected) { | 246 TEST_F(SingleLoginAttemptTest, CredentialsRejected) { |
| 249 attempt_->OnError(buzz::XmppEngine::ERROR_UNAUTHORIZED, 0, NULL); | 247 attempt_->OnError(buzz::XmppEngine::ERROR_UNAUTHORIZED, 0, NULL); |
| 250 EXPECT_EQ(CREDENTIALS_REJECTED, fake_delegate_.state()); | 248 EXPECT_EQ(CREDENTIALS_REJECTED, fake_delegate_.state()); |
| 251 } | 249 } |
| 252 | 250 |
| 253 } // namespace | 251 } // namespace |
| 254 | 252 |
| 255 } // namespace notifier | 253 } // namespace notifier |
| OLD | NEW |