| 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/profiles/gaia_info_update_service.h" | 5 #include "chrome/browser/profiles/gaia_info_update_service.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/prefs/pref_service_syncable.h" | 10 #include "chrome/browser/prefs/pref_service_syncable.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "ui/gfx/image/image.h" | 25 #include "ui/gfx/image/image.h" |
| 26 #include "ui/gfx/image/image_unittest_util.h" | 26 #include "ui/gfx/image/image_unittest_util.h" |
| 27 | 27 |
| 28 using ::testing::Return; | 28 using ::testing::Return; |
| 29 using ::testing::NiceMock; | 29 using ::testing::NiceMock; |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 class ProfileDownloaderMock : public ProfileDownloader { | 33 class ProfileDownloaderMock : public ProfileDownloader { |
| 34 public: | 34 public: |
| 35 explicit ProfileDownloaderMock(ProfileDownloaderDelegate* delegate) | 35 explicit ProfileDownloaderMock(ProfileDownloaderDelegate* delegate, |
| 36 : ProfileDownloader(delegate) { | 36 SigninClient* signin_client) |
| 37 : ProfileDownloader(delegate, signin_client) { |
| 37 } | 38 } |
| 38 | 39 |
| 39 virtual ~ProfileDownloaderMock() { | 40 virtual ~ProfileDownloaderMock() { |
| 40 } | 41 } |
| 41 | 42 |
| 42 MOCK_CONST_METHOD0(GetProfileFullName, base::string16()); | 43 MOCK_CONST_METHOD0(GetProfileFullName, base::string16()); |
| 43 MOCK_CONST_METHOD0(GetProfileGivenName, base::string16()); | 44 MOCK_CONST_METHOD0(GetProfileGivenName, base::string16()); |
| 44 MOCK_CONST_METHOD0(GetProfilePicture, SkBitmap()); | 45 MOCK_CONST_METHOD0(GetProfilePicture, SkBitmap()); |
| 45 MOCK_CONST_METHOD0(GetProfilePictureStatus, | 46 MOCK_CONST_METHOD0(GetProfilePictureStatus, |
| 46 ProfileDownloader::PictureStatus()); | 47 ProfileDownloader::PictureStatus()); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 void TearDown() override; | 142 void TearDown() override; |
| 142 | 143 |
| 143 Profile* profile_; | 144 Profile* profile_; |
| 144 scoped_ptr<NiceMock<GAIAInfoUpdateServiceMock> > service_; | 145 scoped_ptr<NiceMock<GAIAInfoUpdateServiceMock> > service_; |
| 145 scoped_ptr<NiceMock<ProfileDownloaderMock> > downloader_; | 146 scoped_ptr<NiceMock<ProfileDownloaderMock> > downloader_; |
| 146 }; | 147 }; |
| 147 | 148 |
| 148 void GAIAInfoUpdateServiceTest::SetUp() { | 149 void GAIAInfoUpdateServiceTest::SetUp() { |
| 149 ProfileInfoCacheTest::SetUp(); | 150 ProfileInfoCacheTest::SetUp(); |
| 150 service_.reset(new NiceMock<GAIAInfoUpdateServiceMock>(profile())); | 151 service_.reset(new NiceMock<GAIAInfoUpdateServiceMock>(profile())); |
| 151 downloader_.reset(new NiceMock<ProfileDownloaderMock>(service())); | 152 downloader_.reset(new NiceMock<ProfileDownloaderMock>( |
| 153 service(), ChromeSigninClientFactory::GetForProfile(profile()))); |
| 152 } | 154 } |
| 153 | 155 |
| 154 void GAIAInfoUpdateServiceTest::TearDown() { | 156 void GAIAInfoUpdateServiceTest::TearDown() { |
| 155 downloader_.reset(); | 157 downloader_.reset(); |
| 156 service_->Shutdown(); | 158 service_->Shutdown(); |
| 157 service_.reset(); | 159 service_.reset(); |
| 158 ProfileInfoCacheTest::TearDown(); | 160 ProfileInfoCacheTest::TearDown(); |
| 159 } | 161 } |
| 160 | 162 |
| 161 } // namespace | 163 } // namespace |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 EXPECT_CALL(*service(), Update()); | 309 EXPECT_CALL(*service(), Update()); |
| 308 std::string account_id = | 310 std::string account_id = |
| 309 AccountTrackerServiceFactory::GetForProfile(profile()) | 311 AccountTrackerServiceFactory::GetForProfile(profile()) |
| 310 ->SeedAccountInfo("gaia_id", "pat@example.com"); | 312 ->SeedAccountInfo("gaia_id", "pat@example.com"); |
| 311 SigninManager* signin_manager = | 313 SigninManager* signin_manager = |
| 312 SigninManagerFactory::GetForProfile(profile()); | 314 SigninManagerFactory::GetForProfile(profile()); |
| 313 signin_manager->OnExternalSigninCompleted(account_id); | 315 signin_manager->OnExternalSigninCompleted(account_id); |
| 314 } | 316 } |
| 315 | 317 |
| 316 #endif | 318 #endif |
| OLD | NEW |