| Index: google_apis/gcm/engine/heartbeat_manager_unittest.cc
|
| diff --git a/google_apis/gcm/engine/heartbeat_manager_unittest.cc b/google_apis/gcm/engine/heartbeat_manager_unittest.cc
|
| index e09707b2a21e9ffcc655257959622cebf4595b19..6efe2fe52eedb1e76c4c50079d97d0a718edd348 100644
|
| --- a/google_apis/gcm/engine/heartbeat_manager_unittest.cc
|
| +++ b/google_apis/gcm/engine/heartbeat_manager_unittest.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "base/bind.h"
|
| #include "base/bind_helpers.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/time/time.h"
|
| #include "base/timer/timer.h"
|
| @@ -175,6 +176,25 @@ TEST_F(HeartbeatManagerTest, StartThenUpdateInterval) {
|
| EXPECT_NE(heartbeat, manager()->GetNextHeartbeatTime());
|
| }
|
|
|
| +// Updating the timer used for heartbeats before starting should not start the
|
| +// timer.
|
| +TEST_F(HeartbeatManagerTest, UpdateTimerBeforeStart) {
|
| + manager()->UpdateHeartbeatTimer(
|
| + make_scoped_ptr(new base::Timer(true, false)));
|
| + EXPECT_TRUE(manager()->GetNextHeartbeatTime().is_null());
|
| +}
|
| +
|
| +// Updating the timer used for heartbeats after starting should restart the
|
| +// timer but not change the heartbeat time.
|
| +TEST_F(HeartbeatManagerTest, UpdateTimerAfterStart) {
|
| + StartManager();
|
| + base::TimeTicks heartbeat = manager()->GetNextHeartbeatTime();
|
| +
|
| + manager()->UpdateHeartbeatTimer(
|
| + make_scoped_ptr(new base::Timer(true, false)));
|
| + EXPECT_EQ(heartbeat, manager()->GetNextHeartbeatTime());
|
| +}
|
| +
|
| // Stopping the manager should reset the heartbeat timer.
|
| TEST_F(HeartbeatManagerTest, Stop) {
|
| StartManager();
|
|
|