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

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

Issue 185933003: [GCM] Only allow the senders that the application is currently registered for (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 MCSMessage message(BuildDownstreamMessage( 390 MCSMessage message(BuildDownstreamMessage(
391 "project_id", "app_id", expected_data)); 391 "project_id", "app_id", expected_data));
392 EXPECT_TRUE(message.IsValid()); 392 EXPECT_TRUE(message.IsValid());
393 ReceiveMessageFromMCS(message); 393 ReceiveMessageFromMCS(message);
394 394
395 expected_data.erase(expected_data.find("message_type")); 395 expected_data.erase(expected_data.find("message_type"));
396 EXPECT_EQ(MESSAGE_RECEIVED, last_event()); 396 EXPECT_EQ(MESSAGE_RECEIVED, last_event());
397 EXPECT_EQ("app_id", last_app_id()); 397 EXPECT_EQ("app_id", last_app_id());
398 EXPECT_EQ(expected_data.size(), last_message().data.size()); 398 EXPECT_EQ(expected_data.size(), last_message().data.size());
399 EXPECT_EQ(expected_data, last_message().data); 399 EXPECT_EQ(expected_data, last_message().data);
400 EXPECT_EQ("project_id", last_message().sender_id);
400 } 401 }
401 402
402 TEST_F(GCMClientImplTest, DispatchDownstreamMessageSendError) { 403 TEST_F(GCMClientImplTest, DispatchDownstreamMessageSendError) {
403 std::map<std::string, std::string> expected_data; 404 std::map<std::string, std::string> expected_data;
404 expected_data["message_type"] = "send_error"; 405 expected_data["message_type"] = "send_error";
405 expected_data["google.message_id"] = "007"; 406 expected_data["google.message_id"] = "007";
406 MCSMessage message(BuildDownstreamMessage( 407 MCSMessage message(BuildDownstreamMessage(
407 "project_id", "app_id", expected_data)); 408 "project_id", "app_id", expected_data));
408 EXPECT_TRUE(message.IsValid()); 409 EXPECT_TRUE(message.IsValid());
409 ReceiveMessageFromMCS(message); 410 ReceiveMessageFromMCS(message);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 EXPECT_EQ(CurrentTime(), mcs_client()->last_data_message_stanza().sent()); 443 EXPECT_EQ(CurrentTime(), mcs_client()->last_data_message_stanza().sent());
443 EXPECT_EQ("007", mcs_client()->last_data_message_stanza().id()); 444 EXPECT_EQ("007", mcs_client()->last_data_message_stanza().id());
444 EXPECT_EQ("gcm@chrome.com", mcs_client()->last_data_message_stanza().from()); 445 EXPECT_EQ("gcm@chrome.com", mcs_client()->last_data_message_stanza().from());
445 EXPECT_EQ("project_id", mcs_client()->last_data_message_stanza().to()); 446 EXPECT_EQ("project_id", mcs_client()->last_data_message_stanza().to());
446 EXPECT_EQ("key", mcs_client()->last_data_message_stanza().app_data(0).key()); 447 EXPECT_EQ("key", mcs_client()->last_data_message_stanza().app_data(0).key());
447 EXPECT_EQ("value", 448 EXPECT_EQ("value",
448 mcs_client()->last_data_message_stanza().app_data(0).value()); 449 mcs_client()->last_data_message_stanza().app_data(0).value());
449 } 450 }
450 451
451 } // namespace gcm 452 } // 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