| 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);
|
|
|