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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 TestAttemptState local_state("", "", "", "", "", | 196 TestAttemptState local_state("", "", "", "", "", |
197 User::USER_TYPE_REGULAR, true); | 197 User::USER_TYPE_REGULAR, true); |
198 attempt_.reset(new OnlineAttempt(&local_state, resolver_.get())); | 198 attempt_.reset(new OnlineAttempt(&local_state, resolver_.get())); |
199 attempt_->Initiate(&profile); | 199 attempt_->Initiate(&profile); |
200 BrowserThread::PostTask( | 200 BrowserThread::PostTask( |
201 BrowserThread::UI, FROM_HERE, | 201 BrowserThread::UI, FROM_HERE, |
202 base::Bind(&OnlineAttemptTest::RunThreadTest)); | 202 base::Bind(&OnlineAttemptTest::RunThreadTest)); |
203 | 203 |
204 MessageLoop::current()->Run(); | 204 MessageLoop::current()->Run(); |
205 | 205 |
206 EXPECT_EQ(LoginFailure::None(), local_state.online_outcome()); | 206 EXPECT_EQ(LoginFailure::LoginFailureNone(), local_state.online_outcome()); |
207 } | 207 } |
208 | 208 |
209 TEST_F(OnlineAttemptTest, LoginNetFailure) { | 209 TEST_F(OnlineAttemptTest, LoginNetFailure) { |
210 RunFailureTest( | 210 RunFailureTest( |
211 GoogleServiceAuthError::FromConnectionError(net::ERR_CONNECTION_RESET)); | 211 GoogleServiceAuthError::FromConnectionError(net::ERR_CONNECTION_RESET)); |
212 } | 212 } |
213 | 213 |
214 TEST_F(OnlineAttemptTest, LoginDenied) { | 214 TEST_F(OnlineAttemptTest, LoginDenied) { |
215 RunFailureTest( | 215 RunFailureTest( |
216 GoogleServiceAuthError(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); | 216 GoogleServiceAuthError(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); |
(...skipping 29 matching lines...) Expand all Loading... |
246 .RetiresOnSaturation(); | 246 .RetiresOnSaturation(); |
247 GoogleServiceAuthError error(GoogleServiceAuthError::TWO_FACTOR); | 247 GoogleServiceAuthError error(GoogleServiceAuthError::TWO_FACTOR); |
248 BrowserThread::PostTask( | 248 BrowserThread::PostTask( |
249 BrowserThread::UI, FROM_HERE, | 249 BrowserThread::UI, FROM_HERE, |
250 base::Bind(&OnlineAttempt::OnClientLoginFailure, | 250 base::Bind(&OnlineAttempt::OnClientLoginFailure, |
251 attempt_->weak_factory_.GetWeakPtr(), | 251 attempt_->weak_factory_.GetWeakPtr(), |
252 error)); | 252 error)); |
253 | 253 |
254 // Force UI thread to finish tasks so I can verify |state_|. | 254 // Force UI thread to finish tasks so I can verify |state_|. |
255 message_loop_.RunUntilIdle(); | 255 message_loop_.RunUntilIdle(); |
256 EXPECT_TRUE(GoogleServiceAuthError::None() == | 256 EXPECT_TRUE(GoogleServiceAuthError::AuthErrorNone() == |
257 state_.online_outcome().error()); | 257 state_.online_outcome().error()); |
258 } | 258 } |
259 | 259 |
260 } // namespace chromeos | 260 } // namespace chromeos |
OLD | NEW |