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

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

Issue 183923006: [GCM] API update to allow only a single sender in registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 EXPECT_EQ(kDeviceSecurityToken, mcs_client()->last_security_token()); 357 EXPECT_EQ(kDeviceSecurityToken, mcs_client()->last_security_token());
358 } 358 }
359 359
360 TEST_F(GCMClientImplTest, CheckOut) { 360 TEST_F(GCMClientImplTest, CheckOut) {
361 EXPECT_TRUE(mcs_client()); 361 EXPECT_TRUE(mcs_client());
362 gcm_client()->CheckOut(); 362 gcm_client()->CheckOut();
363 EXPECT_FALSE(mcs_client()); 363 EXPECT_FALSE(mcs_client());
364 } 364 }
365 365
366 TEST_F(GCMClientImplTest, RegisterApp) { 366 TEST_F(GCMClientImplTest, RegisterApp) {
367 std::vector<std::string> senders; 367 std::vector<std::string> senders;
jianli 2014/03/03 21:29:31 nit: senders should be removed
fgorski 2014/03/03 23:14:16 Done.
368 senders.push_back("sender"); 368 gcm_client()->Register("app_id", "cert", "sender");
369 gcm_client()->Register("app_id", "cert", senders);
370 CompleteRegistration("reg_id"); 369 CompleteRegistration("reg_id");
371 370
372 EXPECT_EQ(REGISTRATION_COMPLETED, last_event()); 371 EXPECT_EQ(REGISTRATION_COMPLETED, last_event());
373 EXPECT_EQ("app_id", last_app_id()); 372 EXPECT_EQ("app_id", last_app_id());
374 EXPECT_EQ("reg_id", last_registration_id()); 373 EXPECT_EQ("reg_id", last_registration_id());
375 EXPECT_EQ(GCMClient::SUCCESS, last_result()); 374 EXPECT_EQ(GCMClient::SUCCESS, last_result());
376 } 375 }
377 376
378 TEST_F(GCMClientImplTest, UnregisterApp) { 377 TEST_F(GCMClientImplTest, UnregisterApp) {
379 gcm_client()->Unregister("app_id"); 378 gcm_client()->Unregister("app_id");
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 EXPECT_EQ(CurrentTime(), mcs_client()->last_data_message_stanza().sent()); 443 EXPECT_EQ(CurrentTime(), mcs_client()->last_data_message_stanza().sent());
445 EXPECT_EQ("007", mcs_client()->last_data_message_stanza().id()); 444 EXPECT_EQ("007", mcs_client()->last_data_message_stanza().id());
446 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());
447 EXPECT_EQ("project_id", mcs_client()->last_data_message_stanza().to()); 446 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()); 447 EXPECT_EQ("key", mcs_client()->last_data_message_stanza().app_data(0).key());
449 EXPECT_EQ("value", 448 EXPECT_EQ("value",
450 mcs_client()->last_data_message_stanza().app_data(0).value()); 449 mcs_client()->last_data_message_stanza().app_data(0).value());
451 } 450 }
452 451
453 } // namespace gcm 452 } // namespace gcm
OLDNEW
« google_apis/gcm/engine/registration_request.h ('K') | « 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