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

Unified Diff: chrome/browser/push_messaging/push_messaging_service_unittest.cc

Issue 2578583002: Provide a mechanism for the GCM driver to send message receipts to GCM.
Patch Set: Fix issue with rebase Created 3 years, 10 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 | « chrome/browser/gcm/fake_gcm_profile_service.cc ('k') | components/gcm_driver/fake_gcm_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « chrome/browser/gcm/fake_gcm_profile_service.cc ('k') | components/gcm_driver/fake_gcm_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698