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 "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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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<FakeSigninManagerBase*>( | 73 mock_signin_manager_ = static_cast<FakeSigninManagerBase*>( |
74 SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse( | 74 SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse( |
75 profile_.get(), FakeSigninManagerBase::Build)); | 75 profile_.get(), FakeSigninManagerBase::Build)); |
76 mock_signin_manager_->Initialize(profile_.get()); | 76 mock_signin_manager_->Initialize(profile_.get(), NULL); |
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 } |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 362 |
363 TEST_F(SigninTrackerTest, SigninFailedWhenInitializing) { | 363 TEST_F(SigninTrackerTest, SigninFailedWhenInitializing) { |
364 tracker_.reset(); | 364 tracker_.reset(); |
365 // SigninFailed() should be called. | 365 // SigninFailed() should be called. |
366 GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED); | 366 GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED); |
367 EXPECT_CALL(observer_, SigninFailed(error)); | 367 EXPECT_CALL(observer_, SigninFailed(error)); |
368 tracker_.reset(new SigninTracker(profile_.get(), &observer_, | 368 tracker_.reset(new SigninTracker(profile_.get(), &observer_, |
369 SigninTracker::SERVICES_INITIALIZING)); | 369 SigninTracker::SERVICES_INITIALIZING)); |
370 tracker_->OnStateChanged(); | 370 tracker_->OnStateChanged(); |
371 } | 371 } |
OLD | NEW |