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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 SigninTrackerTest() {} | 54 SigninTrackerTest() {} |
55 virtual void SetUp() OVERRIDE { | 55 virtual void SetUp() OVERRIDE { |
56 profile_.reset(ProfileSyncServiceMock::MakeSignedInTestingProfile()); | 56 profile_.reset(ProfileSyncServiceMock::MakeSignedInTestingProfile()); |
57 mock_token_service_ = static_cast<MockTokenService*>( | 57 mock_token_service_ = static_cast<MockTokenService*>( |
58 TokenServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 58 TokenServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
59 profile_.get(), BuildMockTokenService)); | 59 profile_.get(), BuildMockTokenService)); |
60 mock_pss_ = static_cast<ProfileSyncServiceMock*>( | 60 mock_pss_ = static_cast<ProfileSyncServiceMock*>( |
61 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 61 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
62 profile_.get(), | 62 profile_.get(), |
63 ProfileSyncServiceMock::BuildMockProfileSyncService)); | 63 ProfileSyncServiceMock::BuildMockProfileSyncService)); |
| 64 mock_pss_->Initialize(); |
64 // Make gmock not spam the output with information about these uninteresting | 65 // Make gmock not spam the output with information about these uninteresting |
65 // calls. | 66 // calls. |
66 EXPECT_CALL(*mock_pss_, AddObserver(_)).Times(AnyNumber()); | 67 EXPECT_CALL(*mock_pss_, AddObserver(_)).Times(AnyNumber()); |
67 EXPECT_CALL(*mock_pss_, RemoveObserver(_)).Times(AnyNumber()); | 68 EXPECT_CALL(*mock_pss_, RemoveObserver(_)).Times(AnyNumber()); |
68 tracker_.reset(new SigninTracker(profile_.get(), &observer_)); | 69 tracker_.reset(new SigninTracker(profile_.get(), &observer_)); |
69 } | 70 } |
70 virtual void TearDown() OVERRIDE { | 71 virtual void TearDown() OVERRIDE { |
71 tracker_.reset(); | 72 tracker_.reset(); |
72 profile_.reset(); | 73 profile_.reset(); |
73 } | 74 } |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 EXPECT_CALL(*mock_pss_, waiting_for_auth()).WillRepeatedly(Return(false)); | 328 EXPECT_CALL(*mock_pss_, waiting_for_auth()).WillRepeatedly(Return(false)); |
328 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error)); | 329 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error)); |
329 EXPECT_CALL(*mock_pss_, HasUnrecoverableError()).WillRepeatedly( | 330 EXPECT_CALL(*mock_pss_, HasUnrecoverableError()).WillRepeatedly( |
330 Return(false)); | 331 Return(false)); |
331 EXPECT_CALL(*mock_pss_, sync_initialized()).WillRepeatedly(Return(true)); | 332 EXPECT_CALL(*mock_pss_, sync_initialized()).WillRepeatedly(Return(true)); |
332 // Any error should result in SigninFailed() being called. | 333 // Any error should result in SigninFailed() being called. |
333 EXPECT_CALL(observer_, SigninFailed(error)); | 334 EXPECT_CALL(observer_, SigninFailed(error)); |
334 tracker_.reset(new SigninTracker(profile_.get(), &observer_, | 335 tracker_.reset(new SigninTracker(profile_.get(), &observer_, |
335 SigninTracker::SERVICES_INITIALIZING)); | 336 SigninTracker::SERVICES_INITIALIZING)); |
336 } | 337 } |
OLD | NEW |