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..0cb0924b739d0a1d85dca71597ea24b72de1b8d3 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 |
@@ -41,6 +41,8 @@ namespace { |
const char kAffiliatedUserID1[] = "test_1@example.com"; |
const char kAffiliatedUserID2[] = "test_2@example.com"; |
const char kUnaffiliatedUserID[] = "test@other_domain.test"; |
+const bool NOT_AFFILIATED = false; |
+const bool AFFILIATED = true; |
oshima
2015/11/13 19:53:04
optional suggestion. Please ignore if you prefer t
peletskyi
2015/11/16 14:33:15
Done.
|
scoped_ptr<KeyedService> BuildProfileInvalidationProvider( |
content::BrowserContext* context) { |
@@ -88,7 +90,8 @@ class AffiliatedInvalidationServiceProviderImplTest : public testing::Test { |
void TearDown() override; |
// Ownership is not passed. The Profile is owned by the global ProfileManager. |
- Profile* LogInAndReturnProfile(const std::string& user_id); |
+ Profile* LogInAndReturnProfile(const std::string& user_id, |
+ bool is_affiliated); |
// Logs in as an affiliated user and indicates that the per-profile |
// invalidation service for this user connected. Verifies that this |
@@ -221,8 +224,10 @@ void AffiliatedInvalidationServiceProviderImplTest::TearDown() { |
} |
Profile* AffiliatedInvalidationServiceProviderImplTest::LogInAndReturnProfile( |
- const std::string& user_id) { |
- fake_user_manager_->AddUser(AccountId::FromUserEmail(user_id)); |
+ 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 +239,7 @@ Profile* AffiliatedInvalidationServiceProviderImplTest::LogInAndReturnProfile( |
void AffiliatedInvalidationServiceProviderImplTest:: |
LogInAsAffiliatedUserAndConnectInvalidationService() { |
// Log in as an affiliated user. |
- Profile* profile = LogInAndReturnProfile(kAffiliatedUserID1); |
+ Profile* profile = LogInAndReturnProfile(kAffiliatedUserID1, AFFILIATED); |
EXPECT_TRUE(profile); |
// Verify that a per-profile invalidation service has been created. |
@@ -260,7 +265,7 @@ void AffiliatedInvalidationServiceProviderImplTest:: |
void AffiliatedInvalidationServiceProviderImplTest:: |
LogInAsUnaffiliatedUserAndConnectInvalidationService() { |
// Log in as an unaffiliated user. |
- Profile* profile = LogInAndReturnProfile(kUnaffiliatedUserID); |
+ Profile* profile = LogInAndReturnProfile(kUnaffiliatedUserID, NOT_AFFILIATED); |
EXPECT_TRUE(profile); |
// Verify that a per-profile invalidation service has been created. |
@@ -335,7 +340,7 @@ TEST_F(AffiliatedInvalidationServiceProviderImplTest, NoConsumers) { |
EXPECT_FALSE(provider_->GetDeviceInvalidationServiceForTest()); |
// Log in as an affiliated user. |
- EXPECT_TRUE(LogInAndReturnProfile(kAffiliatedUserID1)); |
+ EXPECT_TRUE(LogInAndReturnProfile(kAffiliatedUserID1, AFFILIATED)); |
// Verify that no device-global invalidation service has been created. |
EXPECT_FALSE(provider_->GetDeviceInvalidationServiceForTest()); |
@@ -506,7 +511,8 @@ TEST_F(AffiliatedInvalidationServiceProviderImplTest, |
LogInAsAffiliatedUserAndConnectInvalidationService(); |
// Log in as a second affiliated user. |
- Profile* second_profile = LogInAndReturnProfile(kAffiliatedUserID2); |
+ Profile* second_profile = |
+ LogInAndReturnProfile(kAffiliatedUserID2, AFFILIATED); |
EXPECT_TRUE(second_profile); |
// Verify that the device-global invalidation service still does not exist. |
@@ -605,7 +611,8 @@ TEST_F(AffiliatedInvalidationServiceProviderImplTest, NoServiceAfterShutdown) { |
EXPECT_FALSE(provider_->GetDeviceInvalidationServiceForTest()); |
// Log in as a second affiliated user. |
- Profile* second_profile = LogInAndReturnProfile(kAffiliatedUserID2); |
+ Profile* second_profile = |
+ LogInAndReturnProfile(kAffiliatedUserID2, AFFILIATED); |
EXPECT_TRUE(second_profile); |
// Verify that the device-global invalidation service still does not exist. |