| OLD | NEW |
| 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 Loading... |
| 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 gcm_client()->Register("app_id", "cert", "sender"); |
| 368 senders.push_back("sender"); | |
| 369 gcm_client()->Register("app_id", "cert", senders); | |
| 370 CompleteRegistration("reg_id"); | 368 CompleteRegistration("reg_id"); |
| 371 | 369 |
| 372 EXPECT_EQ(REGISTRATION_COMPLETED, last_event()); | 370 EXPECT_EQ(REGISTRATION_COMPLETED, last_event()); |
| 373 EXPECT_EQ("app_id", last_app_id()); | 371 EXPECT_EQ("app_id", last_app_id()); |
| 374 EXPECT_EQ("reg_id", last_registration_id()); | 372 EXPECT_EQ("reg_id", last_registration_id()); |
| 375 EXPECT_EQ(GCMClient::SUCCESS, last_result()); | 373 EXPECT_EQ(GCMClient::SUCCESS, last_result()); |
| 376 } | 374 } |
| 377 | 375 |
| 378 TEST_F(GCMClientImplTest, UnregisterApp) { | 376 TEST_F(GCMClientImplTest, UnregisterApp) { |
| 379 gcm_client()->Unregister("app_id"); | 377 gcm_client()->Unregister("app_id"); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 EXPECT_EQ(CurrentTime(), mcs_client()->last_data_message_stanza().sent()); | 442 EXPECT_EQ(CurrentTime(), mcs_client()->last_data_message_stanza().sent()); |
| 445 EXPECT_EQ("007", mcs_client()->last_data_message_stanza().id()); | 443 EXPECT_EQ("007", mcs_client()->last_data_message_stanza().id()); |
| 446 EXPECT_EQ("gcm@chrome.com", mcs_client()->last_data_message_stanza().from()); | 444 EXPECT_EQ("gcm@chrome.com", mcs_client()->last_data_message_stanza().from()); |
| 447 EXPECT_EQ("project_id", mcs_client()->last_data_message_stanza().to()); | 445 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()); | 446 EXPECT_EQ("key", mcs_client()->last_data_message_stanza().app_data(0).key()); |
| 449 EXPECT_EQ("value", | 447 EXPECT_EQ("value", |
| 450 mcs_client()->last_data_message_stanza().app_data(0).value()); | 448 mcs_client()->last_data_message_stanza().app_data(0).value()); |
| 451 } | 449 } |
| 452 | 450 |
| 453 } // namespace gcm | 451 } // namespace gcm |
| OLD | NEW |