| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 21 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| 22 #include "chrome/browser/signin/signin_manager_factory.h" | 22 #include "chrome/browser/signin/signin_manager_factory.h" |
| 23 #include "chrome/browser/signin/test_signin_client_builder.h" | 23 #include "chrome/browser/signin/test_signin_client_builder.h" |
| 24 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 25 #include "chrome/test/base/testing_browser_process.h" | 25 #include "chrome/test/base/testing_browser_process.h" |
| 26 #include "chrome/test/base/testing_profile.h" | 26 #include "chrome/test/base/testing_profile.h" |
| 27 #include "chrome/test/base/testing_profile_manager.h" | 27 #include "chrome/test/base/testing_profile_manager.h" |
| 28 #include "components/prefs/pref_service.h" | 28 #include "components/prefs/pref_service.h" |
| 29 #include "components/signin/core/browser/account_tracker_service.h" | 29 #include "components/signin/core/browser/account_tracker_service.h" |
| 30 #include "components/signin/core/common/signin_pref_names.h" | 30 #include "components/signin/core/common/signin_pref_names.h" |
| 31 #include "components/syncable_prefs/pref_service_syncable.h" | 31 #include "components/sync_preferences/pref_service_syncable.h" |
| 32 #include "testing/gmock/include/gmock/gmock.h" | 32 #include "testing/gmock/include/gmock/gmock.h" |
| 33 #include "ui/gfx/image/image.h" | 33 #include "ui/gfx/image/image.h" |
| 34 #include "ui/gfx/image/image_unittest_util.h" | 34 #include "ui/gfx/image/image_unittest_util.h" |
| 35 | 35 |
| 36 using ::testing::Return; | 36 using ::testing::Return; |
| 37 using ::testing::NiceMock; | 37 using ::testing::NiceMock; |
| 38 | 38 |
| 39 namespace { | 39 namespace { |
| 40 | 40 |
| 41 class ProfileDownloaderMock : public ProfileDownloader { | 41 class ProfileDownloaderMock : public ProfileDownloader { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 NiceMock<GAIAInfoUpdateServiceMock>* service() { return service_.get(); } | 87 NiceMock<GAIAInfoUpdateServiceMock>* service() { return service_.get(); } |
| 88 NiceMock<ProfileDownloaderMock>* downloader() { return downloader_.get(); } | 88 NiceMock<ProfileDownloaderMock>* downloader() { return downloader_.get(); } |
| 89 | 89 |
| 90 Profile* CreateProfile(const std::string& name) { | 90 Profile* CreateProfile(const std::string& name) { |
| 91 TestingProfile::TestingFactories testing_factories; | 91 TestingProfile::TestingFactories testing_factories; |
| 92 testing_factories.push_back(std::make_pair( | 92 testing_factories.push_back(std::make_pair( |
| 93 ChromeSigninClientFactory::GetInstance(), | 93 ChromeSigninClientFactory::GetInstance(), |
| 94 signin::BuildTestSigninClient)); | 94 signin::BuildTestSigninClient)); |
| 95 Profile* profile = testing_profile_manager_.CreateTestingProfile( | 95 Profile* profile = testing_profile_manager_.CreateTestingProfile( |
| 96 name, std::unique_ptr<syncable_prefs::PrefServiceSyncable>(), | 96 name, std::unique_ptr<sync_preferences::PrefServiceSyncable>(), |
| 97 base::UTF8ToUTF16(name), 0, std::string(), testing_factories); | 97 base::UTF8ToUTF16(name), 0, std::string(), testing_factories); |
| 98 // The testing manager sets the profile name manually, which counts as | 98 // The testing manager sets the profile name manually, which counts as |
| 99 // a user-customized profile name. Reset this to match the default name | 99 // a user-customized profile name. Reset this to match the default name |
| 100 // we are actually using. | 100 // we are actually using. |
| 101 ProfileAttributesEntry* entry = nullptr; | 101 ProfileAttributesEntry* entry = nullptr; |
| 102 // TODO(anthonyvd) : refactor the function so the following assertion can be | 102 // TODO(anthonyvd) : refactor the function so the following assertion can be |
| 103 // changed to ASSERT_TRUE. | 103 // changed to ASSERT_TRUE. |
| 104 EXPECT_TRUE(storage()->GetProfileAttributesWithPath(profile->GetPath(), | 104 EXPECT_TRUE(storage()->GetProfileAttributesWithPath(profile->GetPath(), |
| 105 &entry)); | 105 &entry)); |
| 106 entry->SetIsUsingDefaultName(true); | 106 entry->SetIsUsingDefaultName(true); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 // Log in. | 330 // Log in. |
| 331 EXPECT_CALL(*service(), Update()); | 331 EXPECT_CALL(*service(), Update()); |
| 332 AccountTrackerServiceFactory::GetForProfile(profile()) | 332 AccountTrackerServiceFactory::GetForProfile(profile()) |
| 333 ->SeedAccountInfo("gaia_id", "pat@example.com"); | 333 ->SeedAccountInfo("gaia_id", "pat@example.com"); |
| 334 SigninManager* signin_manager = | 334 SigninManager* signin_manager = |
| 335 SigninManagerFactory::GetForProfile(profile()); | 335 SigninManagerFactory::GetForProfile(profile()); |
| 336 signin_manager->OnExternalSigninCompleted("pat@example.com"); | 336 signin_manager->OnExternalSigninCompleted("pat@example.com"); |
| 337 } | 337 } |
| 338 | 338 |
| 339 #endif | 339 #endif |
| OLD | NEW |