Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: chrome/browser/signin/signin_tracker_unittest.cc

Issue 12502017: signin: pull basic SigninManager functionality into new SigninManagerBase class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: deal with new enterprise_platform_keys_private_api Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/signin/signin_tracker.cc ('k') | chrome/browser/signin/signin_ui_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/signin/signin_tracker.h" 5 #include "chrome/browser/signin/signin_tracker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 profile_.reset(ProfileSyncServiceMock::MakeSignedInTestingProfile()); 63 profile_.reset(ProfileSyncServiceMock::MakeSignedInTestingProfile());
64 mock_token_service_ = static_cast<MockTokenService*>( 64 mock_token_service_ = static_cast<MockTokenService*>(
65 TokenServiceFactory::GetInstance()->SetTestingFactoryAndUse( 65 TokenServiceFactory::GetInstance()->SetTestingFactoryAndUse(
66 profile_.get(), BuildMockTokenService)); 66 profile_.get(), BuildMockTokenService));
67 mock_pss_ = static_cast<ProfileSyncServiceMock*>( 67 mock_pss_ = static_cast<ProfileSyncServiceMock*>(
68 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( 68 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
69 profile_.get(), 69 profile_.get(),
70 ProfileSyncServiceMock::BuildMockProfileSyncService)); 70 ProfileSyncServiceMock::BuildMockProfileSyncService));
71 mock_pss_->Initialize(); 71 mock_pss_->Initialize();
72 72
73 mock_signin_manager_ = static_cast<FakeSigninManager*>( 73 mock_signin_manager_ = static_cast<FakeSigninManagerBase*>(
74 SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse( 74 SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse(
75 profile_.get(), FakeSigninManager::Build)); 75 profile_.get(), FakeSigninManagerBase::Build));
76 76
77 // Make gmock not spam the output with information about these uninteresting 77 // Make gmock not spam the output with information about these uninteresting
78 // calls. 78 // calls.
79 EXPECT_CALL(*mock_pss_, AddObserver(_)).Times(AnyNumber()); 79 EXPECT_CALL(*mock_pss_, AddObserver(_)).Times(AnyNumber());
80 EXPECT_CALL(*mock_pss_, RemoveObserver(_)).Times(AnyNumber()); 80 EXPECT_CALL(*mock_pss_, RemoveObserver(_)).Times(AnyNumber());
81 tracker_.reset(new SigninTracker(profile_.get(), &observer_)); 81 tracker_.reset(new SigninTracker(profile_.get(), &observer_));
82 } 82 }
83 virtual void TearDown() OVERRIDE { 83 virtual void TearDown() OVERRIDE {
84 tracker_.reset(); 84 tracker_.reset();
85 profile_.reset(); 85 profile_.reset();
86 } 86 }
87 scoped_ptr<SigninTracker> tracker_; 87 scoped_ptr<SigninTracker> tracker_;
88 scoped_ptr<TestingProfile> profile_; 88 scoped_ptr<TestingProfile> profile_;
89 ProfileSyncServiceMock* mock_pss_; 89 ProfileSyncServiceMock* mock_pss_;
90 FakeSigninManager* mock_signin_manager_; 90 FakeSigninManagerBase* mock_signin_manager_;
91 MockTokenService* mock_token_service_; 91 MockTokenService* mock_token_service_;
92 MockObserver observer_; 92 MockObserver observer_;
93 }; 93 };
94 94
95 TEST_F(SigninTrackerTest, GaiaSignInFailed) { 95 TEST_F(SigninTrackerTest, GaiaSignInFailed) {
96 // SIGNIN_FAILED notification should result in a SigninFailed callback. 96 // SIGNIN_FAILED notification should result in a SigninFailed callback.
97 GoogleServiceAuthError error( 97 GoogleServiceAuthError error(
98 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); 98 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
99 EXPECT_CALL(observer_, SigninFailed(error)); 99 EXPECT_CALL(observer_, SigninFailed(error));
100 content::NotificationService::current()->Notify( 100 content::NotificationService::current()->Notify(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 } 138 }
139 139
140 TEST_F(SigninTrackerTest, GaiaSigninWhenServicesAlreadyRunning) { 140 TEST_F(SigninTrackerTest, GaiaSigninWhenServicesAlreadyRunning) {
141 // SIGNIN_SUCCEEDED notification should result in a SigninSuccess() callback 141 // SIGNIN_SUCCEEDED notification should result in a SigninSuccess() callback
142 // if we're already signed in. 142 // if we're already signed in.
143 EXPECT_CALL(observer_, GaiaCredentialsValid()); 143 EXPECT_CALL(observer_, GaiaCredentialsValid());
144 EXPECT_CALL(observer_, SigninSuccess()); 144 EXPECT_CALL(observer_, SigninSuccess());
145 GoogleServiceAuthError error(GoogleServiceAuthError::NONE); 145 GoogleServiceAuthError error(GoogleServiceAuthError::NONE);
146 ExpectSignedInSyncService(mock_pss_, mock_token_service_, error); 146 ExpectSignedInSyncService(mock_pss_, mock_token_service_, error);
147 mock_signin_manager_->StartSignInWithCredentials("0", "username@gmail.com", 147 mock_signin_manager_->SetAuthenticatedUsername("username@gmail.com");
148 "password");
149 GoogleServiceSigninSuccessDetails details("username@gmail.com", "password"); 148 GoogleServiceSigninSuccessDetails details("username@gmail.com", "password");
150 content::NotificationService::current()->Notify( 149 content::NotificationService::current()->Notify(
151 chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, 150 chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL,
152 content::Source<Profile>(profile_.get()), 151 content::Source<Profile>(profile_.get()),
153 content::Details<const GoogleServiceSigninSuccessDetails>(&details)); 152 content::Details<const GoogleServiceSigninSuccessDetails>(&details));
154 } 153 }
155 154
156 TEST_F(SigninTrackerTest, NoGaiaSigninWhenOAuthTokensNotAvailable) { 155 TEST_F(SigninTrackerTest, NoGaiaSigninWhenOAuthTokensNotAvailable) {
157 // SIGNIN_SUCCESSFUL notification should not result in a SigninSuccess() 156 // SIGNIN_SUCCESSFUL notification should not result in a SigninSuccess()
158 // callback if our oauth token hasn't been fetched. 157 // callback if our oauth token hasn't been fetched.
(...skipping 18 matching lines...) Expand all
177 // callback until after our oauth token hasn't been fetched. 176 // callback until after our oauth token hasn't been fetched.
178 EXPECT_CALL(observer_, GaiaCredentialsValid()); 177 EXPECT_CALL(observer_, GaiaCredentialsValid());
179 GoogleServiceAuthError none(GoogleServiceAuthError::NONE); 178 GoogleServiceAuthError none(GoogleServiceAuthError::NONE);
180 ExpectSignedInSyncService(mock_pss_, NULL, none); 179 ExpectSignedInSyncService(mock_pss_, NULL, none);
181 EXPECT_CALL(*mock_token_service_, 180 EXPECT_CALL(*mock_token_service_,
182 HasTokenForService(GaiaConstants::kSyncService)) 181 HasTokenForService(GaiaConstants::kSyncService))
183 .WillRepeatedly(Return(true)); 182 .WillRepeatedly(Return(true));
184 EXPECT_CALL(*mock_token_service_, 183 EXPECT_CALL(*mock_token_service_,
185 HasTokenForService(GaiaConstants::kGaiaOAuth2LoginRefreshToken)) 184 HasTokenForService(GaiaConstants::kGaiaOAuth2LoginRefreshToken))
186 .WillRepeatedly(Return(false)); 185 .WillRepeatedly(Return(false));
187 mock_signin_manager_->StartSignInWithCredentials("0", "username@gmail.com", 186 mock_signin_manager_->SetAuthenticatedUsername("username@gmail.com");
188 "password");
189 GoogleServiceSigninSuccessDetails details("username@gmail.com", "password"); 187 GoogleServiceSigninSuccessDetails details("username@gmail.com", "password");
190 content::NotificationService::current()->Notify( 188 content::NotificationService::current()->Notify(
191 chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, 189 chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL,
192 content::Source<Profile>(profile_.get()), 190 content::Source<Profile>(profile_.get()),
193 content::Details<const GoogleServiceSigninSuccessDetails>(&details)); 191 content::Details<const GoogleServiceSigninSuccessDetails>(&details));
194 Mock::VerifyAndClearExpectations(mock_pss_); 192 Mock::VerifyAndClearExpectations(mock_pss_);
195 Mock::VerifyAndClearExpectations(mock_token_service_); 193 Mock::VerifyAndClearExpectations(mock_token_service_);
196 EXPECT_CALL(observer_, SigninSuccess()); 194 EXPECT_CALL(observer_, SigninSuccess());
197 ExpectSignedInSyncService(mock_pss_, mock_token_service_, none); 195 ExpectSignedInSyncService(mock_pss_, mock_token_service_, none);
198 TokenService::TokenAvailableDetails available( 196 TokenService::TokenAvailableDetails available(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 247 }
250 248
251 TEST_F(SigninTrackerTest, GaiaSigninAfterSyncStarts) { 249 TEST_F(SigninTrackerTest, GaiaSigninAfterSyncStarts) {
252 // Make sure that we don't get a SigninSuccess() callback until after the 250 // Make sure that we don't get a SigninSuccess() callback until after the
253 // sync service reports that it's signed in. 251 // sync service reports that it's signed in.
254 EXPECT_CALL(observer_, GaiaCredentialsValid()); 252 EXPECT_CALL(observer_, GaiaCredentialsValid());
255 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()).WillOnce( 253 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()).WillOnce(
256 Return(false)); 254 Return(false));
257 EXPECT_CALL(*mock_token_service_, HasTokenForService(_)) 255 EXPECT_CALL(*mock_token_service_, HasTokenForService(_))
258 .WillRepeatedly(Return(true)); 256 .WillRepeatedly(Return(true));
259 mock_signin_manager_->StartSignInWithCredentials("0", "username@gmail.com", 257 mock_signin_manager_->SetAuthenticatedUsername("username@gmail.com");
260 "password");
261 GoogleServiceSigninSuccessDetails details("username@gmail.com", "password"); 258 GoogleServiceSigninSuccessDetails details("username@gmail.com", "password");
262 content::NotificationService::current()->Notify( 259 content::NotificationService::current()->Notify(
263 chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, 260 chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL,
264 content::Source<Profile>(profile_.get()), 261 content::Source<Profile>(profile_.get()),
265 content::Details<const GoogleServiceSigninSuccessDetails>(&details)); 262 content::Details<const GoogleServiceSigninSuccessDetails>(&details));
266 Mock::VerifyAndClearExpectations(mock_pss_); 263 Mock::VerifyAndClearExpectations(mock_pss_);
267 // Mimic the sync engine getting credentials. 264 // Mimic the sync engine getting credentials.
268 EXPECT_CALL(observer_, SigninSuccess()); 265 EXPECT_CALL(observer_, SigninSuccess());
269 GoogleServiceAuthError error(GoogleServiceAuthError::NONE); 266 GoogleServiceAuthError error(GoogleServiceAuthError::NONE);
270 ExpectSignedInSyncService(mock_pss_, mock_token_service_, error); 267 ExpectSignedInSyncService(mock_pss_, mock_token_service_, error);
271 tracker_->OnStateChanged(); 268 tracker_->OnStateChanged();
272 } 269 }
273 270
274 TEST_F(SigninTrackerTest, SyncSigninError) { 271 TEST_F(SigninTrackerTest, SyncSigninError) {
275 // Make sure that we get a SigninFailed() callback if sync gets an error after 272 // Make sure that we get a SigninFailed() callback if sync gets an error after
276 // initializaiton. 273 // initializaiton.
277 EXPECT_CALL(observer_, GaiaCredentialsValid()); 274 EXPECT_CALL(observer_, GaiaCredentialsValid());
278 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()).WillRepeatedly( 275 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()).WillRepeatedly(
279 Return(false)); 276 Return(false));
280 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()).WillRepeatedly( 277 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()).WillRepeatedly(
281 Return(false)); 278 Return(false));
282 EXPECT_CALL(*mock_token_service_, HasTokenForService(_)) 279 EXPECT_CALL(*mock_token_service_, HasTokenForService(_))
283 .WillRepeatedly(Return(true)); 280 .WillRepeatedly(Return(true));
284 mock_signin_manager_->StartSignInWithCredentials("0", "username@gmail.com", 281 mock_signin_manager_->SetAuthenticatedUsername("username@gmail.com");
285 "password");
286 GoogleServiceSigninSuccessDetails details("username@gmail.com", "password"); 282 GoogleServiceSigninSuccessDetails details("username@gmail.com", "password");
287 content::NotificationService::current()->Notify( 283 content::NotificationService::current()->Notify(
288 chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, 284 chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL,
289 content::Source<Profile>(profile_.get()), 285 content::Source<Profile>(profile_.get()),
290 content::Details<const GoogleServiceSigninSuccessDetails>(&details)); 286 content::Details<const GoogleServiceSigninSuccessDetails>(&details));
291 287
292 // Still waiting for auth, so sync state changes should be ignored. 288 // Still waiting for auth, so sync state changes should be ignored.
293 EXPECT_CALL(*mock_pss_, waiting_for_auth()).WillOnce(Return(true)); 289 EXPECT_CALL(*mock_pss_, waiting_for_auth()).WillOnce(Return(true));
294 tracker_->OnStateChanged(); 290 tracker_->OnStateChanged();
295 // Now mimic an auth error - this should cause us to fail (not waiting for 291 // Now mimic an auth error - this should cause us to fail (not waiting for
296 // auth, but still have no credentials). 292 // auth, but still have no credentials).
297 GoogleServiceAuthError error( 293 GoogleServiceAuthError error(
298 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); 294 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
299 FakeAuthStatusProvider provider(mock_signin_manager_->signin_global_error()); 295 FakeAuthStatusProvider provider(mock_signin_manager_->signin_global_error());
300 provider.SetAuthError(error); 296 provider.SetAuthError(error);
301 EXPECT_CALL(*mock_pss_, waiting_for_auth()).WillRepeatedly(Return(false)); 297 EXPECT_CALL(*mock_pss_, waiting_for_auth()).WillRepeatedly(Return(false));
302 EXPECT_CALL(observer_, SigninFailed(error)); 298 EXPECT_CALL(observer_, SigninFailed(error));
303 tracker_->OnStateChanged(); 299 tracker_->OnStateChanged();
304 } 300 }
305 301
306 // Test cases for initial state = SERVICES_INITIALIZING. 302 // Test cases for initial state = SERVICES_INITIALIZING.
307 TEST_F(SigninTrackerTest, SigninSuccess) { 303 TEST_F(SigninTrackerTest, SigninSuccess) {
308 // Reset the |tracker_| and restart with initial state parameter for its 304 // Reset the |tracker_| and restart with initial state parameter for its
309 // constructor later. 305 // constructor later.
310 tracker_.reset(); 306 tracker_.reset();
311 GoogleServiceAuthError error(GoogleServiceAuthError::NONE); 307 GoogleServiceAuthError error(GoogleServiceAuthError::NONE);
312 ExpectSignedInSyncService(mock_pss_, mock_token_service_, error); 308 ExpectSignedInSyncService(mock_pss_, mock_token_service_, error);
313 mock_signin_manager_->StartSignInWithCredentials("0", "username@gmail.com", 309 mock_signin_manager_->SetAuthenticatedUsername("username@gmail.com");
314 "password"); 310
315 // Finally SigninSuccess() is expected to be called when everything is ready. 311 // Finally SigninSuccess() is expected to be called when everything is ready.
316 EXPECT_CALL(observer_, SigninSuccess()); 312 EXPECT_CALL(observer_, SigninSuccess());
317 tracker_.reset(new SigninTracker(profile_.get(), &observer_, 313 tracker_.reset(new SigninTracker(profile_.get(), &observer_,
318 SigninTracker::SERVICES_INITIALIZING)); 314 SigninTracker::SERVICES_INITIALIZING));
319 } 315 }
320 316
321 TEST_F(SigninTrackerTest, SigninFailedSyncTokenUnavailable) { 317 TEST_F(SigninTrackerTest, SigninFailedSyncTokenUnavailable) {
322 tracker_.reset(); 318 tracker_.reset();
323 EXPECT_CALL(*mock_token_service_, HasTokenForService(_)) 319 EXPECT_CALL(*mock_token_service_, HasTokenForService(_))
324 .WillRepeatedly(Return(true)); 320 .WillRepeatedly(Return(true));
325 mock_signin_manager_->StartSignInWithCredentials("0", "username@gmail.com", 321 mock_signin_manager_->SetAuthenticatedUsername("username@gmail.com");
326 "password");
327 GoogleServiceAuthError error(GoogleServiceAuthError::NONE); 322 GoogleServiceAuthError error(GoogleServiceAuthError::NONE);
328 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()).WillRepeatedly( 323 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()).WillRepeatedly(
329 Return(true)); 324 Return(true));
330 // Inject Token unavailable error. 325 // Inject Token unavailable error.
331 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()).WillRepeatedly( 326 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()).WillRepeatedly(
332 Return(false)); 327 Return(false));
333 EXPECT_CALL(*mock_pss_, waiting_for_auth()).WillRepeatedly(Return(false)); 328 EXPECT_CALL(*mock_pss_, waiting_for_auth()).WillRepeatedly(Return(false));
334 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error)); 329 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error));
335 EXPECT_CALL(*mock_pss_, HasUnrecoverableError()).WillRepeatedly( 330 EXPECT_CALL(*mock_pss_, HasUnrecoverableError()).WillRepeatedly(
336 Return(false)); 331 Return(false));
337 EXPECT_CALL(*mock_pss_, sync_initialized()).WillRepeatedly(Return(true)); 332 EXPECT_CALL(*mock_pss_, sync_initialized()).WillRepeatedly(Return(true));
338 // Any error should result in SigninFailed() being called. 333 // Any error should result in SigninFailed() being called.
339 EXPECT_CALL(observer_, SigninFailed(error)); 334 EXPECT_CALL(observer_, SigninFailed(error));
340 tracker_.reset(new SigninTracker(profile_.get(), &observer_, 335 tracker_.reset(new SigninTracker(profile_.get(), &observer_,
341 SigninTracker::SERVICES_INITIALIZING)); 336 SigninTracker::SERVICES_INITIALIZING));
342 } 337 }
343 338
344 TEST_F(SigninTrackerTest, SigninFailedGoogleServiceAuthError) { 339 TEST_F(SigninTrackerTest, SigninFailedGoogleServiceAuthError) {
345 tracker_.reset(); 340 tracker_.reset();
346 EXPECT_CALL(*mock_token_service_, HasTokenForService(_)) 341 EXPECT_CALL(*mock_token_service_, HasTokenForService(_))
347 .WillRepeatedly(Return(true)); 342 .WillRepeatedly(Return(true));
348 mock_signin_manager_->StartSignInWithCredentials("0", "username@gmail.com", 343 mock_signin_manager_->SetAuthenticatedUsername("username@gmail.com");
349 "password");
350 // Inject authentication error. 344 // Inject authentication error.
351 GoogleServiceAuthError error(GoogleServiceAuthError::SERVICE_UNAVAILABLE); 345 GoogleServiceAuthError error(GoogleServiceAuthError::SERVICE_UNAVAILABLE);
352 FakeAuthStatusProvider provider(mock_signin_manager_->signin_global_error()); 346 FakeAuthStatusProvider provider(mock_signin_manager_->signin_global_error());
353 provider.SetAuthError(error); 347 provider.SetAuthError(error);
354 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()).WillRepeatedly( 348 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()).WillRepeatedly(
355 Return(true)); 349 Return(true));
356 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()).WillRepeatedly( 350 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()).WillRepeatedly(
357 Return(true)); 351 Return(true));
358 EXPECT_CALL(*mock_pss_, waiting_for_auth()).WillRepeatedly(Return(false)); 352 EXPECT_CALL(*mock_pss_, waiting_for_auth()).WillRepeatedly(Return(false));
359 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error)); 353 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error));
360 EXPECT_CALL(*mock_pss_, HasUnrecoverableError()).WillRepeatedly( 354 EXPECT_CALL(*mock_pss_, HasUnrecoverableError()).WillRepeatedly(
361 Return(false)); 355 Return(false));
362 EXPECT_CALL(*mock_pss_, sync_initialized()).WillRepeatedly(Return(true)); 356 EXPECT_CALL(*mock_pss_, sync_initialized()).WillRepeatedly(Return(true));
363 // Any error should result in SigninFailed() being called. 357 // Any error should result in SigninFailed() being called.
364 EXPECT_CALL(observer_, SigninFailed(error)); 358 EXPECT_CALL(observer_, SigninFailed(error));
365 tracker_.reset(new SigninTracker(profile_.get(), &observer_, 359 tracker_.reset(new SigninTracker(profile_.get(), &observer_,
366 SigninTracker::SERVICES_INITIALIZING)); 360 SigninTracker::SERVICES_INITIALIZING));
367 } 361 }
368 362
369 363
370 TEST_F(SigninTrackerTest, SigninFailedWhenInitializing) { 364 TEST_F(SigninTrackerTest, SigninFailedWhenInitializing) {
371 tracker_.reset(); 365 tracker_.reset();
372 // SigninFailed() should be called. 366 // SigninFailed() should be called.
373 GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED); 367 GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED);
374 EXPECT_CALL(observer_, SigninFailed(error)); 368 EXPECT_CALL(observer_, SigninFailed(error));
375 tracker_.reset(new SigninTracker(profile_.get(), &observer_, 369 tracker_.reset(new SigninTracker(profile_.get(), &observer_,
376 SigninTracker::SERVICES_INITIALIZING)); 370 SigninTracker::SERVICES_INITIALIZING));
377 tracker_->OnStateChanged(); 371 tracker_->OnStateChanged();
378 } 372 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_tracker.cc ('k') | chrome/browser/signin/signin_ui_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698