| Index: chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl_unittest.cc
|
| diff --git a/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl_unittest.cc b/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl_unittest.cc
|
| index 90096776450fa4ac85770f874c843d3dcc383f94..e0f90102acf23cf5baecccd040f175a0ecb6bb03 100644
|
| --- a/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl_unittest.cc
|
| +++ b/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl_unittest.cc
|
| @@ -87,8 +87,10 @@ class AffiliatedInvalidationServiceProviderImplTest : public testing::Test {
|
| void SetUp() override;
|
| void TearDown() override;
|
|
|
| - // Ownership is not passed. The Profile is owned by the global ProfileManager.
|
| - Profile* LogInAndReturnProfile(const std::string& user_id);
|
| + // Both functions don't pass ownership of the profile. The Profile is owned
|
| + // by the global ProfileManager.
|
| + Profile* LogInAndReturnAffiliatedProfile(const std::string& user_id);
|
| + Profile* LogInAndReturnNonAffiliatedProfile(const std::string& user_id);
|
|
|
| // Logs in as an affiliated user and indicates that the per-profile
|
| // invalidation service for this user connected. Verifies that this
|
| @@ -116,6 +118,9 @@ class AffiliatedInvalidationServiceProviderImplTest : public testing::Test {
|
| bool create);
|
|
|
| protected:
|
| + // Ownership is not passed. The Profile is owned by the global ProfileManager.
|
| + Profile* LogInAndReturnProfile(const std::string& user_id,
|
| + bool is_affiliated);
|
| scoped_ptr<AffiliatedInvalidationServiceProviderImpl> provider_;
|
| scoped_ptr<FakeConsumer> consumer_;
|
| invalidation::TiclInvalidationService* device_invalidation_service_;
|
| @@ -220,9 +225,22 @@ void AffiliatedInvalidationServiceProviderImplTest::TearDown() {
|
| chromeos::SystemSaltGetter::Shutdown();
|
| }
|
|
|
| -Profile* AffiliatedInvalidationServiceProviderImplTest::LogInAndReturnProfile(
|
| +Profile*
|
| +AffiliatedInvalidationServiceProviderImplTest::LogInAndReturnAffiliatedProfile(
|
| const std::string& user_id) {
|
| - fake_user_manager_->AddUser(AccountId::FromUserEmail(user_id));
|
| + return LogInAndReturnProfile(user_id, true);
|
| +}
|
| +
|
| +Profile* AffiliatedInvalidationServiceProviderImplTest::
|
| + LogInAndReturnNonAffiliatedProfile(const std::string& user_id) {
|
| + return LogInAndReturnProfile(user_id, false);
|
| +}
|
| +
|
| +Profile* AffiliatedInvalidationServiceProviderImplTest::LogInAndReturnProfile(
|
| + const std::string& user_id,
|
| + bool is_affiliated) {
|
| + fake_user_manager_->AddUserWithAffiliation(AccountId::FromUserEmail(user_id),
|
| + is_affiliated);
|
| Profile* profile = profile_manager_.CreateTestingProfile(user_id);
|
| content::NotificationService::current()->Notify(
|
| chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
|
| @@ -234,7 +252,7 @@ Profile* AffiliatedInvalidationServiceProviderImplTest::LogInAndReturnProfile(
|
| void AffiliatedInvalidationServiceProviderImplTest::
|
| LogInAsAffiliatedUserAndConnectInvalidationService() {
|
| // Log in as an affiliated user.
|
| - Profile* profile = LogInAndReturnProfile(kAffiliatedUserID1);
|
| + Profile* profile = LogInAndReturnAffiliatedProfile(kAffiliatedUserID1);
|
| EXPECT_TRUE(profile);
|
|
|
| // Verify that a per-profile invalidation service has been created.
|
| @@ -260,7 +278,7 @@ void AffiliatedInvalidationServiceProviderImplTest::
|
| void AffiliatedInvalidationServiceProviderImplTest::
|
| LogInAsUnaffiliatedUserAndConnectInvalidationService() {
|
| // Log in as an unaffiliated user.
|
| - Profile* profile = LogInAndReturnProfile(kUnaffiliatedUserID);
|
| + Profile* profile = LogInAndReturnNonAffiliatedProfile(kUnaffiliatedUserID);
|
| EXPECT_TRUE(profile);
|
|
|
| // Verify that a per-profile invalidation service has been created.
|
| @@ -335,7 +353,7 @@ TEST_F(AffiliatedInvalidationServiceProviderImplTest, NoConsumers) {
|
| EXPECT_FALSE(provider_->GetDeviceInvalidationServiceForTest());
|
|
|
| // Log in as an affiliated user.
|
| - EXPECT_TRUE(LogInAndReturnProfile(kAffiliatedUserID1));
|
| + EXPECT_TRUE(LogInAndReturnAffiliatedProfile(kAffiliatedUserID1));
|
|
|
| // Verify that no device-global invalidation service has been created.
|
| EXPECT_FALSE(provider_->GetDeviceInvalidationServiceForTest());
|
| @@ -506,7 +524,7 @@ TEST_F(AffiliatedInvalidationServiceProviderImplTest,
|
| LogInAsAffiliatedUserAndConnectInvalidationService();
|
|
|
| // Log in as a second affiliated user.
|
| - Profile* second_profile = LogInAndReturnProfile(kAffiliatedUserID2);
|
| + Profile* second_profile = LogInAndReturnAffiliatedProfile(kAffiliatedUserID2);
|
| EXPECT_TRUE(second_profile);
|
|
|
| // Verify that the device-global invalidation service still does not exist.
|
| @@ -605,7 +623,7 @@ TEST_F(AffiliatedInvalidationServiceProviderImplTest, NoServiceAfterShutdown) {
|
| EXPECT_FALSE(provider_->GetDeviceInvalidationServiceForTest());
|
|
|
| // Log in as a second affiliated user.
|
| - Profile* second_profile = LogInAndReturnProfile(kAffiliatedUserID2);
|
| + Profile* second_profile = LogInAndReturnAffiliatedProfile(kAffiliatedUserID2);
|
| EXPECT_TRUE(second_profile);
|
|
|
| // Verify that the device-global invalidation service still does not exist.
|
|
|