Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Unified Diff: chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl_unittest.cc

Issue 1306183007: Switch to id-based affiliation determination (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 143a37e164c0174560fb692d8b885068dc5fd269..b9965e48edc7200ccbbaa7f009c29ab4c60a124c 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
@@ -88,7 +88,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 +222,9 @@ void AffiliatedInvalidationServiceProviderImplTest::TearDown() {
}
Profile* AffiliatedInvalidationServiceProviderImplTest::LogInAndReturnProfile(
- const std::string& user_id) {
- fake_user_manager_->AddUser(user_id);
+ const std::string& user_id,
+ bool is_affiliated) {
+ fake_user_manager_->AddUserWithAffiliation(user_id, is_affiliated);
Profile* profile = profile_manager_.CreateTestingProfile(user_id);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
@@ -234,7 +236,7 @@ Profile* AffiliatedInvalidationServiceProviderImplTest::LogInAndReturnProfile(
void AffiliatedInvalidationServiceProviderImplTest::
LogInAsAffiliatedUserAndConnectInvalidationService() {
// Log in as an affiliated user.
- Profile* profile = LogInAndReturnProfile(kAffiliatedUserID1);
+ Profile* profile = LogInAndReturnProfile(kAffiliatedUserID1, true);
Andrew T Wilson (Slow) 2015/10/09 12:35:46 this is fine, but consider defining a constant: c
peletskyi 2015/10/29 15:27:36 Done.
EXPECT_TRUE(profile);
// Verify that a per-profile invalidation service has been created.
@@ -260,7 +262,7 @@ void AffiliatedInvalidationServiceProviderImplTest::
void AffiliatedInvalidationServiceProviderImplTest::
LogInAsUnaffiliatedUserAndConnectInvalidationService() {
// Log in as an unaffiliated user.
- Profile* profile = LogInAndReturnProfile(kUnaffiliatedUserID);
+ Profile* profile = LogInAndReturnProfile(kUnaffiliatedUserID, false);
EXPECT_TRUE(profile);
// Verify that a per-profile invalidation service has been created.
@@ -335,7 +337,7 @@ TEST_F(AffiliatedInvalidationServiceProviderImplTest, NoConsumers) {
EXPECT_FALSE(provider_->GetDeviceInvalidationServiceForTest());
// Log in as an affiliated user.
- EXPECT_TRUE(LogInAndReturnProfile(kAffiliatedUserID1));
+ EXPECT_TRUE(LogInAndReturnProfile(kAffiliatedUserID1, true));
// Verify that no device-global invalidation service has been created.
EXPECT_FALSE(provider_->GetDeviceInvalidationServiceForTest());
@@ -506,7 +508,7 @@ TEST_F(AffiliatedInvalidationServiceProviderImplTest,
LogInAsAffiliatedUserAndConnectInvalidationService();
// Log in as a second affiliated user.
- Profile* second_profile = LogInAndReturnProfile(kAffiliatedUserID2);
+ Profile* second_profile = LogInAndReturnProfile(kAffiliatedUserID2, true);
EXPECT_TRUE(second_profile);
// Verify that the device-global invalidation service still does not exist.
@@ -605,7 +607,7 @@ 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, true);
EXPECT_TRUE(second_profile);
// Verify that the device-global invalidation service still does not exist.

Powered by Google App Engine
This is Rietveld 408576698