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

Side by Side Diff: google_apis/gcm/gcm_client_impl_unittest.cc

Issue 185133008: [GCM] Only allow the senders that the application is currently registered for (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moving the comment up Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « google_apis/gcm/gcm_client_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "google_apis/gcm/gcm_client_impl.h" 5 #include "google_apis/gcm/gcm_client_impl.h"
6 6
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/test/simple_test_clock.h" 10 #include "base/test/simple_test_clock.h"
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 MCSMessage message(BuildDownstreamMessage( 392 MCSMessage message(BuildDownstreamMessage(
393 "project_id", "app_id", expected_data)); 393 "project_id", "app_id", expected_data));
394 EXPECT_TRUE(message.IsValid()); 394 EXPECT_TRUE(message.IsValid());
395 ReceiveMessageFromMCS(message); 395 ReceiveMessageFromMCS(message);
396 396
397 expected_data.erase(expected_data.find("message_type")); 397 expected_data.erase(expected_data.find("message_type"));
398 EXPECT_EQ(MESSAGE_RECEIVED, last_event()); 398 EXPECT_EQ(MESSAGE_RECEIVED, last_event());
399 EXPECT_EQ("app_id", last_app_id()); 399 EXPECT_EQ("app_id", last_app_id());
400 EXPECT_EQ(expected_data.size(), last_message().data.size()); 400 EXPECT_EQ(expected_data.size(), last_message().data.size());
401 EXPECT_EQ(expected_data, last_message().data); 401 EXPECT_EQ(expected_data, last_message().data);
402 EXPECT_EQ("project_id", last_message().sender_id);
402 } 403 }
403 404
404 TEST_F(GCMClientImplTest, DispatchDownstreamMessageSendError) { 405 TEST_F(GCMClientImplTest, DispatchDownstreamMessageSendError) {
405 std::map<std::string, std::string> expected_data; 406 std::map<std::string, std::string> expected_data;
406 expected_data["message_type"] = "send_error"; 407 expected_data["message_type"] = "send_error";
407 expected_data["google.message_id"] = "007"; 408 expected_data["google.message_id"] = "007";
408 MCSMessage message(BuildDownstreamMessage( 409 MCSMessage message(BuildDownstreamMessage(
409 "project_id", "app_id", expected_data)); 410 "project_id", "app_id", expected_data));
410 EXPECT_TRUE(message.IsValid()); 411 EXPECT_TRUE(message.IsValid());
411 ReceiveMessageFromMCS(message); 412 ReceiveMessageFromMCS(message);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 EXPECT_EQ(CurrentTime(), mcs_client()->last_data_message_stanza().sent()); 445 EXPECT_EQ(CurrentTime(), mcs_client()->last_data_message_stanza().sent());
445 EXPECT_EQ("007", mcs_client()->last_data_message_stanza().id()); 446 EXPECT_EQ("007", mcs_client()->last_data_message_stanza().id());
446 EXPECT_EQ("gcm@chrome.com", mcs_client()->last_data_message_stanza().from()); 447 EXPECT_EQ("gcm@chrome.com", mcs_client()->last_data_message_stanza().from());
447 EXPECT_EQ("project_id", mcs_client()->last_data_message_stanza().to()); 448 EXPECT_EQ("project_id", mcs_client()->last_data_message_stanza().to());
448 EXPECT_EQ("key", mcs_client()->last_data_message_stanza().app_data(0).key()); 449 EXPECT_EQ("key", mcs_client()->last_data_message_stanza().app_data(0).key());
449 EXPECT_EQ("value", 450 EXPECT_EQ("value",
450 mcs_client()->last_data_message_stanza().app_data(0).value()); 451 mcs_client()->last_data_message_stanza().app_data(0).value());
451 } 452 }
452 453
453 } // namespace gcm 454 } // namespace gcm
OLDNEW
« no previous file with comments | « google_apis/gcm/gcm_client_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698