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

Unified Diff: components/gcm_driver/gcm_driver_desktop_unittest.cc

Issue 653843003: [GCM] Start GCMChannelStatusSyncer when GCM is disabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for GCM not reenabled after being disabled on the fly Created 6 years, 2 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 | « components/gcm_driver/gcm_driver_desktop.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/gcm_driver/gcm_driver_desktop_unittest.cc
diff --git a/components/gcm_driver/gcm_driver_desktop_unittest.cc b/components/gcm_driver/gcm_driver_desktop_unittest.cc
index 57429577b0353e3a90797b808866ed2f7bdfd177..9c8a353aa87c6bee809e1216bdd4ab675905e79b 100644
--- a/components/gcm_driver/gcm_driver_desktop_unittest.cc
+++ b/components/gcm_driver/gcm_driver_desktop_unittest.cc
@@ -1017,6 +1017,8 @@ GCMChannelStatusSyncerTest::~GCMChannelStatusSyncerTest() {
void GCMChannelStatusSyncerTest::SetUp() {
GCMDriverTest::SetUp();
+ url_fetcher_factory_.set_remove_fetcher_on_delete(true);
+
// Turn on all-user support.
ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("GCM", "Enabled"));
}
@@ -1091,7 +1093,7 @@ TEST_F(GCMChannelStatusSyncerTest, DisableAndEnable) {
EXPECT_TRUE(driver()->IsStarted());
}
-TEST_F(GCMChannelStatusSyncerTest, DisableAndRestart) {
+TEST_F(GCMChannelStatusSyncerTest, DisableRestartAndEnable) {
// Create GCMDriver first. GCM is not started.
CreateDriver(FakeGCMClient::NO_DELAY_START);
EXPECT_FALSE(driver()->IsStarted());
@@ -1124,6 +1126,9 @@ TEST_F(GCMChannelStatusSyncerTest, DisableAndRestart) {
ShutdownDriver();
CreateDriver(FakeGCMClient::NO_DELAY_START);
+ // Remove delay such that the request could be executed immediately.
+ syncer()->set_delay_removed_for_testing(true);
+
// GCM is still disabled.
EXPECT_FALSE(driver()->gcm_enabled());
EXPECT_FALSE(syncer()->gcm_enabled());
@@ -1133,6 +1138,15 @@ TEST_F(GCMChannelStatusSyncerTest, DisableAndRestart) {
EXPECT_FALSE(driver()->gcm_enabled());
EXPECT_FALSE(syncer()->gcm_enabled());
EXPECT_FALSE(driver()->IsStarted());
+
+ // Wait until the GCM channel status request gets triggered.
+ PumpUILoop();
+
+ // Complete the request that re-enables the GCM.
+ CompleteGCMChannelStatusRequest(true, 0);
+ EXPECT_TRUE(driver()->gcm_enabled());
+ EXPECT_TRUE(syncer()->gcm_enabled());
+ EXPECT_TRUE(driver()->IsStarted());
}
TEST_F(GCMChannelStatusSyncerTest, FirstTimePolling) {
« no previous file with comments | « components/gcm_driver/gcm_driver_desktop.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698