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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 new MyTestURLRequestContext())), | 91 new MyTestURLRequestContext())), |
92 ServerList( | 92 ServerList( |
93 1, | 93 1, |
94 ServerInformation( | 94 ServerInformation( |
95 net::HostPortPair("example.com", 100), SUPPORTS_SSLTCP)), | 95 net::HostPortPair("example.com", 100), SUPPORTS_SSLTCP)), |
96 false /* try_ssltcp_first */, | 96 false /* try_ssltcp_first */, |
97 "auth_mechanism"), | 97 "auth_mechanism"), |
98 attempt_(login_settings_, &fake_delegate_) {} | 98 attempt_(login_settings_, &fake_delegate_) {} |
99 | 99 |
100 virtual void TearDown() OVERRIDE { | 100 virtual void TearDown() OVERRIDE { |
101 message_loop_.RunAllPending(); | 101 message_loop_.RunUntilIdle(); |
102 } | 102 } |
103 | 103 |
104 void FireRedirect(buzz::XmlElement* redirect_error) { | 104 void FireRedirect(buzz::XmlElement* redirect_error) { |
105 attempt_.OnError(buzz::XmppEngine::ERROR_STREAM, 0, redirect_error); | 105 attempt_.OnError(buzz::XmppEngine::ERROR_STREAM, 0, redirect_error); |
106 } | 106 } |
107 | 107 |
108 private: | 108 private: |
109 MessageLoop message_loop_; | 109 MessageLoop message_loop_; |
110 const LoginSettings login_settings_; | 110 const LoginSettings login_settings_; |
111 | 111 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 // Fire 'Unauthorized' errors and make sure the delegate gets the | 245 // Fire 'Unauthorized' errors and make sure the delegate gets the |
246 // OnCredentialsRejected() event. | 246 // OnCredentialsRejected() event. |
247 TEST_F(SingleLoginAttemptTest, CredentialsRejected) { | 247 TEST_F(SingleLoginAttemptTest, CredentialsRejected) { |
248 attempt_.OnError(buzz::XmppEngine::ERROR_UNAUTHORIZED, 0, NULL); | 248 attempt_.OnError(buzz::XmppEngine::ERROR_UNAUTHORIZED, 0, NULL); |
249 EXPECT_EQ(CREDENTIALS_REJECTED, fake_delegate_.state()); | 249 EXPECT_EQ(CREDENTIALS_REJECTED, fake_delegate_.state()); |
250 } | 250 } |
251 | 251 |
252 } // namespace | 252 } // namespace |
253 | 253 |
254 } // namespace notifier | 254 } // namespace notifier |
OLD | NEW |