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

Unified Diff: components/gcm_driver/gcm_driver_desktop_unittest.cc

Issue 1616113003: List message decryption failures on chrome://gcm-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after CL 1619053003 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
« no previous file with comments | « components/gcm_driver/gcm_driver_desktop.cc ('k') | components/gcm_driver/gcm_internals_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/gcm_driver/gcm_driver_desktop_unittest.cc
diff --git a/components/gcm_driver/gcm_driver_desktop_unittest.cc b/components/gcm_driver/gcm_driver_desktop_unittest.cc
index d33b9bc4c6e18996fea0ad8f41c4e3ead8f6708c..58063d292726c5f7414ed34aa2037f4a73dd42e5 100644
--- a/components/gcm_driver/gcm_driver_desktop_unittest.cc
+++ b/components/gcm_driver/gcm_driver_desktop_unittest.cc
@@ -19,6 +19,7 @@
#include "base/test/test_simple_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "base/threading/thread.h"
+#include "components/gcm_driver/crypto/gcm_encryption_provider.h"
#include "components/gcm_driver/fake_gcm_app_handler.h"
#include "components/gcm_driver/fake_gcm_client.h"
#include "components/gcm_driver/fake_gcm_client_factory.h"
@@ -810,6 +811,30 @@ TEST_F(GCMDriverFunctionalTest, MessageWithCollapseKeyReceived) {
gcm_app_handler()->message().collapse_key);
}
+TEST_F(GCMDriverFunctionalTest, EncryptedMessageReceivedError) {
+ // GCM registration has to be performed otherwise GCM will not be started.
+ Register(kTestAppID1, ToSenderList("sender"), GCMDriverTest::WAIT);
+
+ IncomingMessage message;
+
+ // All required information to trigger the encryption path, but with an
+ // invalid Crypto-Key header value to trigger an error.
+ message.data["encryption"] = "salt=ysyxqlYTgE0WvcZrmHbUbg";
+ message.data["crypto-key"] = "hey=thereisnopublickey";
+ message.sender_id = "sender";
+ message.raw_data = "foobar";
+
+ GetGCMClient()->SetRecording(true);
+ GetGCMClient()->ReceiveMessage(kTestAppID1, message);
+
+ PumpIOLoop();
+
+ GCMClient::GCMStatistics statistics = GetGCMClient()->GetStatistics();
+ EXPECT_TRUE(statistics.is_recording);
+ EXPECT_EQ(
+ 1u, statistics.recorded_activities.decryption_failure_activities.size());
+}
+
TEST_F(GCMDriverFunctionalTest, MessagesDeleted) {
// GCM registration has to be performed otherwise GCM will not be started.
Register(kTestAppID1, ToSenderList("sender"), GCMDriverTest::WAIT);
« no previous file with comments | « components/gcm_driver/gcm_driver_desktop.cc ('k') | components/gcm_driver/gcm_internals_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698