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 ca9e35c0da32c81a70df36ecdd010526d74c6229..2c2b3f121c3b9547a69941c8eaf5f50ba18310c6 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::GCMMessageStatus::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,11 @@ 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, update this check. |
+ EXPECT_EQ(gcm::GCMMessageStatus::GCM_UNRESOLVED, receipt_status); |
} |
TEST_F(PushMessagingServiceTest, NormalizeSenderInfo) { |