| Index: components/gcm_driver/gcm_channel_status_request_unittest.cc
|
| diff --git a/components/gcm_driver/gcm_channel_status_request_unittest.cc b/components/gcm_driver/gcm_channel_status_request_unittest.cc
|
| index 4029be47eb65c4686cf5476b326fa785061cc733..80db23c1cc18529e02f4819e76bb28b6595b3b51 100644
|
| --- a/components/gcm_driver/gcm_channel_status_request_unittest.cc
|
| +++ b/components/gcm_driver/gcm_channel_status_request_unittest.cc
|
| @@ -29,13 +29,16 @@ class GCMChannelStatusRequestTest : public testing::Test {
|
| const std::string& response_body);
|
| void SetResponseProtoData(GCMStatus status, int poll_interval_seconds);
|
| void CompleteFetch();
|
| - void OnRequestCompleted(bool enabled, int poll_interval_seconds);
|
| + void OnRequestCompleted(bool update_received,
|
| + bool enabled,
|
| + int poll_interval_seconds);
|
|
|
| scoped_ptr<GCMChannelStatusRequest> request_;
|
| base::MessageLoop message_loop_;
|
| net::TestURLFetcherFactory url_fetcher_factory_;
|
| scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_;
|
| bool request_callback_invoked_;
|
| + bool update_received_;
|
| bool enabled_;
|
| int poll_interval_seconds_;
|
| };
|
| @@ -44,6 +47,7 @@ GCMChannelStatusRequestTest::GCMChannelStatusRequestTest()
|
| : url_request_context_getter_(new net::TestURLRequestContextGetter(
|
| message_loop_.message_loop_proxy())),
|
| request_callback_invoked_(false),
|
| + update_received_(false),
|
| enabled_(true),
|
| poll_interval_seconds_(0) {
|
| }
|
| @@ -97,8 +101,9 @@ void GCMChannelStatusRequestTest::CompleteFetch() {
|
| }
|
|
|
| void GCMChannelStatusRequestTest::OnRequestCompleted(
|
| - bool enabled, int poll_interval_seconds) {
|
| + bool update_received, bool enabled, int poll_interval_seconds) {
|
| request_callback_invoked_ = true;
|
| + update_received_ = update_received;
|
| enabled_ = enabled;
|
| poll_interval_seconds_ = poll_interval_seconds;
|
| }
|
| @@ -116,7 +121,8 @@ TEST_F(GCMChannelStatusRequestTest, ResponseEmpty) {
|
| SetResponseStatusAndString(net::HTTP_OK, "");
|
| CompleteFetch();
|
|
|
| - EXPECT_FALSE(request_callback_invoked_);
|
| + EXPECT_TRUE(request_callback_invoked_);
|
| + EXPECT_FALSE(update_received_);
|
| }
|
|
|
| TEST_F(GCMChannelStatusRequestTest, ResponseNotInProtoFormat) {
|
| @@ -132,7 +138,8 @@ TEST_F(GCMChannelStatusRequestTest, ResponseEmptyProtoData) {
|
| SetResponseProtoData(NOT_SPECIFIED, 0);
|
| CompleteFetch();
|
|
|
| - EXPECT_FALSE(request_callback_invoked_);
|
| + EXPECT_TRUE(request_callback_invoked_);
|
| + EXPECT_FALSE(update_received_);
|
| }
|
|
|
| TEST_F(GCMChannelStatusRequestTest, ResponseWithDisabledStatus) {
|
| @@ -141,6 +148,7 @@ TEST_F(GCMChannelStatusRequestTest, ResponseWithDisabledStatus) {
|
| CompleteFetch();
|
|
|
| EXPECT_TRUE(request_callback_invoked_);
|
| + EXPECT_TRUE(update_received_);
|
| EXPECT_FALSE(enabled_);
|
| EXPECT_EQ(
|
| GCMChannelStatusRequest::default_poll_interval_seconds(),
|
| @@ -153,6 +161,7 @@ TEST_F(GCMChannelStatusRequestTest, ResponseWithEnabledStatus) {
|
| CompleteFetch();
|
|
|
| EXPECT_TRUE(request_callback_invoked_);
|
| + EXPECT_TRUE(update_received_);
|
| EXPECT_TRUE(enabled_);
|
| EXPECT_EQ(
|
| GCMChannelStatusRequest::default_poll_interval_seconds(),
|
| @@ -169,6 +178,7 @@ TEST_F(GCMChannelStatusRequestTest, ResponseWithPollInterval) {
|
| CompleteFetch();
|
|
|
| EXPECT_TRUE(request_callback_invoked_);
|
| + EXPECT_TRUE(update_received_);
|
| EXPECT_TRUE(enabled_);
|
| EXPECT_EQ(poll_interval_seconds, poll_interval_seconds_);
|
| }
|
| @@ -183,6 +193,7 @@ TEST_F(GCMChannelStatusRequestTest, ResponseWithShortPollInterval) {
|
| CompleteFetch();
|
|
|
| EXPECT_TRUE(request_callback_invoked_);
|
| + EXPECT_TRUE(update_received_);
|
| EXPECT_TRUE(enabled_);
|
| EXPECT_EQ(GCMChannelStatusRequest::min_poll_interval_seconds(),
|
| poll_interval_seconds_);
|
| @@ -196,6 +207,7 @@ TEST_F(GCMChannelStatusRequestTest, ResponseWithDisabledStatusAndPollInterval) {
|
| CompleteFetch();
|
|
|
| EXPECT_TRUE(request_callback_invoked_);
|
| + EXPECT_TRUE(update_received_);
|
| EXPECT_FALSE(enabled_);
|
| EXPECT_EQ(poll_interval_seconds, poll_interval_seconds_);
|
| }
|
|
|