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

Unified Diff: chrome/browser/services/gcm/gcm_profile_service_unittest.cc

Issue 162233002: [GCM] Remove all persisted data and close connections when signing out of a profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch to land Created 6 years, 10 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
« no previous file with comments | « chrome/browser/services/gcm/gcm_profile_service.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/services/gcm/gcm_profile_service_unittest.cc
diff --git a/chrome/browser/services/gcm/gcm_profile_service_unittest.cc b/chrome/browser/services/gcm/gcm_profile_service_unittest.cc
index 821f60b2330b955595e1f1eea612f29dda7d1ef6..395fa14d47d581cd47fbdc53bc3328eb5eff4677 100644
--- a/chrome/browser/services/gcm/gcm_profile_service_unittest.cc
+++ b/chrome/browser/services/gcm/gcm_profile_service_unittest.cc
@@ -765,10 +765,8 @@ TEST_F(GCMProfileServiceSingleProfileTest, ReadRegistrationFromStateStore) {
consumer()->ReloadExtension(extension);
// This should read the registration info from the extension's state store.
- // We still need to wait since the reading from state store might happen at
- // the same time.
consumer()->Register(extension->id(), sender_ids);
- WaitUntilCompleted();
+ PumpUILoop();
EXPECT_EQ(old_registration_id, consumer()->registration_id());
EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result());
}
@@ -813,6 +811,25 @@ TEST_F(GCMProfileServiceSingleProfileTest,
EXPECT_EQ(GCMClient::SUCCESS, consumer()->registration_result());
}
+TEST_F(GCMProfileServiceSingleProfileTest,
+ PersistedRegistrationInfoRemoveAfterSignOut) {
+ std::vector<std::string> sender_ids;
+ sender_ids.push_back("sender1");
+ consumer()->Register(kTestingAppId, sender_ids);
+ WaitUntilCompleted();
+
+ // The app id and registration info should be persisted.
+ EXPECT_TRUE(profile()->GetPrefs()->HasPrefPath(prefs::kGCMRegisteredAppIDs));
+ EXPECT_TRUE(consumer()->HasPersistedRegistrationInfo(kTestingAppId));
+
+ consumer()->SignOut();
+ PumpUILoop();
+
+ // The app id and persisted registration info should be removed.
+ EXPECT_FALSE(profile()->GetPrefs()->HasPrefPath(prefs::kGCMRegisteredAppIDs));
+ EXPECT_FALSE(consumer()->HasPersistedRegistrationInfo(kTestingAppId));
+}
+
TEST_F(GCMProfileServiceSingleProfileTest, RegisterAfterSignOut) {
// This will trigger check-out.
consumer()->SignOut();
« no previous file with comments | « chrome/browser/services/gcm/gcm_profile_service.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698