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

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

Issue 183013007: [GCM] Stop/restart GCM when the state is forced off/on (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/browser/sync/profile_sync_service.cc » ('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 d060cc0b7d6df22be5debf3978129a503be8ff15..cb9c7df424450311dd21d2893c6c353730b2bc47 100644
--- a/chrome/browser/services/gcm/gcm_profile_service_unittest.cc
+++ b/chrome/browser/services/gcm/gcm_profile_service_unittest.cc
@@ -649,6 +649,47 @@ TEST_F(GCMProfileServiceTest, SignOutAndThenSignIn) {
EXPECT_EQ(GCMClientMock::LOADED, consumer()->GetGCMClient()->status());
}
+TEST_F(GCMProfileServiceTest, StopAndRestartGCM) {
+ // Positive channel signal is provided in SetUp.
+ consumer()->CreateGCMProfileServiceInstance();
+ consumer()->SignIn(kTestingUsername);
+
+ // GCMClient should be loaded.
+ EXPECT_TRUE(consumer()->IsGCMClientReady());
+ EXPECT_EQ(GCMClientMock::LOADED, consumer()->GetGCMClient()->status());
+
+ // Stops the GCM.
+ consumer()->GetGCMProfileService()->Stop();
+ PumpIOLoop();
+
+ // GCMClient should be stopped.
+ EXPECT_FALSE(consumer()->IsGCMClientReady());
+ EXPECT_EQ(GCMClientMock::STOPPED, consumer()->GetGCMClient()->status());
+
+ // Restarts the GCM.
+ consumer()->GetGCMProfileService()->Start();
+ PumpIOLoop();
+
+ // GCMClient should be loaded.
+ EXPECT_TRUE(consumer()->IsGCMClientReady());
+ EXPECT_EQ(GCMClientMock::LOADED, consumer()->GetGCMClient()->status());
+
+ // Stops the GCM.
+ consumer()->GetGCMProfileService()->Stop();
+ PumpIOLoop();
+
+ // GCMClient should be stopped.
+ EXPECT_FALSE(consumer()->IsGCMClientReady());
+ EXPECT_EQ(GCMClientMock::STOPPED, consumer()->GetGCMClient()->status());
+
+ // Signs out.
+ consumer()->SignOut();
+
+ // GCMClient should be checked out.
+ EXPECT_FALSE(consumer()->IsGCMClientReady());
+ EXPECT_EQ(GCMClientMock::CHECKED_OUT, consumer()->GetGCMClient()->status());
+}
+
TEST_F(GCMProfileServiceTest, RegisterWhenNotSignedIn) {
consumer()->CreateGCMProfileServiceInstance();
« no previous file with comments | « chrome/browser/services/gcm/gcm_profile_service.cc ('k') | chrome/browser/sync/profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698