Chromium Code Reviews| Index: chrome/browser/push_messaging/push_messaging_service_unittest.cc |
| diff --git a/chrome/browser/push_messaging/push_messaging_service_unittest.cc b/chrome/browser/push_messaging/push_messaging_service_unittest.cc |
| index e17bf35e576833498f99e896ee72ae050b4ee58c..f1d2a2d2282fb483312af6205e308a8267024b73 100644 |
| --- a/chrome/browser/push_messaging/push_messaging_service_unittest.cc |
| +++ b/chrome/browser/push_messaging/push_messaging_service_unittest.cc |
| @@ -25,6 +25,7 @@ |
| #include "components/content_settings/core/browser/host_content_settings_map.h" |
| #include "components/gcm_driver/crypto/gcm_crypto_test_helpers.h" |
| #include "components/gcm_driver/fake_gcm_client_factory.h" |
| +#include "components/gcm_driver/gcm_message_status.h" |
| #include "components/gcm_driver/gcm_profile_service.h" |
| #include "content/public/common/push_event_payload.h" |
| #include "content/public/common/push_subscription_options.h" |
| @@ -136,6 +137,12 @@ class PushMessagingServiceTest : public ::testing::Test { |
| *payload_out = payload; |
| } |
| + // Callback to use to observe message receipts returned to GCM. |
| + void DidSendReceipt(gcm::GCMMessageStatus* status_out, |
| + gcm::GCMMessageStatus status) { |
| + *status_out = status; |
| + } |
| + |
| protected: |
| PushMessagingTestingProfile* profile() { return &profile_; } |
| @@ -222,7 +229,12 @@ TEST_F(PushMessagingServiceTest, PayloadEncryptionTest) { |
| static_cast<gcm::FakeGCMProfileService*>( |
| gcm::GCMProfileServiceFactory::GetForProfile(profile())); |
| - fake_profile_service->DispatchMessage(app_identifier.app_id(), message); |
| + gcm::GCMMessageStatus receipt_status = gcm::GCM_UNRESOLVED; |
| + |
| + fake_profile_service->DispatchMessage( |
| + app_identifier.app_id(), message, |
| + base::Bind(&PushMessagingServiceTest::DidSendReceipt, |
| + base::Unretained(this), &receipt_status)); |
| base::RunLoop().RunUntilIdle(); |
| @@ -235,6 +247,12 @@ TEST_F(PushMessagingServiceTest, PayloadEncryptionTest) { |
| EXPECT_FALSE(payload.is_null); |
| EXPECT_EQ(kTestPayload, payload.data); |
| + |
| + // Verify that no receipt was sent. |
| + // TODO(harkness): Once the push service sends receipts for completed |
| + // messages, |
|
Peter Beverloo
2017/01/13 01:46:11
nit: weird linebreak?
harkness
2017/01/19 13:20:41
Done.
|
| + // update this check. |
| + EXPECT_EQ(gcm::GCM_UNRESOLVED, receipt_status); |
| } |
| TEST_F(PushMessagingServiceTest, NormalizeSenderInfo) { |