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

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

Issue 1636483002: Update the PushEvent to have a nullable PushMessageData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 11 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
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 31446b929af4659a93fd3d6da179981c2e680f1f..48bb733e48f0025e86d2ad25acaa940b9933b239 100644
--- a/chrome/browser/push_messaging/push_messaging_service_unittest.cc
+++ b/chrome/browser/push_messaging/push_messaging_service_unittest.cc
@@ -27,6 +27,7 @@
#include "components/gcm_driver/fake_gcm_client_factory.h"
#include "components/gcm_driver/gcm_profile_service.h"
#include "content/public/common/content_switches.h"
+#include "content/public/common/push_event_payload.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -123,15 +124,15 @@ class PushMessagingServiceTest : public ::testing::Test {
void DidDispatchMessage(std::string* app_id_out,
GURL* origin_out,
int64_t* service_worker_registration_id_out,
- std::string* message_data_out,
+ content::PushEventPayload* payload_out,
const std::string& app_id,
const GURL& origin,
int64_t service_worker_registration_id,
- const std::string& message_data) {
+ const content::PushEventPayload& payload) {
*app_id_out = app_id;
*origin_out = origin;
*service_worker_registration_id_out = service_worker_registration_id;
- *message_data_out = message_data;
+ *payload_out = payload;
}
protected:
@@ -193,17 +194,17 @@ TEST_F(PushMessagingServiceTest, PayloadEncryptionTest) {
ASSERT_FALSE(app_identifier.is_null());
- std::string app_id, message_data;
+ std::string app_id;
GURL dispatched_origin;
int64_t service_worker_registration_id;
+ content::PushEventPayload payload;
// (5) Observe message dispatchings from the Push Messaging service, and then
// dispatch the |message| on the GCM driver as if it had actually been
// received by Google Cloud Messaging.
- push_service->SetMessageDispatchedCallbackForTesting(
- base::Bind(&PushMessagingServiceTest::DidDispatchMessage,
- base::Unretained(this), &app_id, &dispatched_origin,
- &service_worker_registration_id, &message_data));
+ push_service->SetMessageDispatchedCallbackForTesting(base::Bind(
+ &PushMessagingServiceTest::DidDispatchMessage, base::Unretained(this),
+ &app_id, &dispatched_origin, &service_worker_registration_id, &payload));
gcm::FakeGCMProfileService* fake_profile_service =
static_cast<gcm::FakeGCMProfileService*>(
@@ -220,5 +221,6 @@ TEST_F(PushMessagingServiceTest, PayloadEncryptionTest) {
EXPECT_EQ(origin, dispatched_origin);
EXPECT_EQ(service_worker_registration_id, kTestServiceWorkerId);
- EXPECT_EQ(kTestPayload, message_data);
+ EXPECT_FALSE(payload.is_null_);
+ EXPECT_EQ(kTestPayload, payload.data_);
}

Powered by Google App Engine
This is Rietveld 408576698