| 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 "components/gcm_driver/gcm_client_impl.h" | 5 #include "components/gcm_driver/gcm_client_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 EXPECT_EQ(kDeviceSecurityToken, mcs_client()->last_security_token()); | 593 EXPECT_EQ(kDeviceSecurityToken, mcs_client()->last_security_token()); |
| 594 | 594 |
| 595 // Checking freshly loaded CheckinInfo. | 595 // Checking freshly loaded CheckinInfo. |
| 596 EXPECT_EQ(kDeviceAndroidId, device_checkin_info().android_id); | 596 EXPECT_EQ(kDeviceAndroidId, device_checkin_info().android_id); |
| 597 EXPECT_EQ(kDeviceSecurityToken, device_checkin_info().secret); | 597 EXPECT_EQ(kDeviceSecurityToken, device_checkin_info().secret); |
| 598 EXPECT_TRUE(device_checkin_info().last_checkin_accounts.empty()); | 598 EXPECT_TRUE(device_checkin_info().last_checkin_accounts.empty()); |
| 599 EXPECT_TRUE(device_checkin_info().accounts_set); | 599 EXPECT_TRUE(device_checkin_info().accounts_set); |
| 600 EXPECT_TRUE(device_checkin_info().account_tokens.empty()); | 600 EXPECT_TRUE(device_checkin_info().account_tokens.empty()); |
| 601 } | 601 } |
| 602 | 602 |
| 603 TEST_F(GCMClientImplTest, CheckOut) { | |
| 604 EXPECT_TRUE(mcs_client()); | |
| 605 EXPECT_TRUE(connection_factory()); | |
| 606 gcm_client()->CheckOut(); | |
| 607 EXPECT_FALSE(mcs_client()); | |
| 608 EXPECT_FALSE(connection_factory()); | |
| 609 } | |
| 610 | |
| 611 TEST_F(GCMClientImplTest, RegisterApp) { | 603 TEST_F(GCMClientImplTest, RegisterApp) { |
| 612 EXPECT_FALSE(ExistsRegistration(kAppId)); | 604 EXPECT_FALSE(ExistsRegistration(kAppId)); |
| 613 | 605 |
| 614 std::vector<std::string> senders; | 606 std::vector<std::string> senders; |
| 615 senders.push_back("sender"); | 607 senders.push_back("sender"); |
| 616 gcm_client()->Register(kAppId, senders); | 608 gcm_client()->Register(kAppId, senders); |
| 617 CompleteRegistration("reg_id"); | 609 CompleteRegistration("reg_id"); |
| 618 | 610 |
| 619 EXPECT_EQ(REGISTRATION_COMPLETED, last_event()); | 611 EXPECT_EQ(REGISTRATION_COMPLETED, last_event()); |
| 620 EXPECT_EQ(kAppId, last_app_id()); | 612 EXPECT_EQ(kAppId, last_app_id()); |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 ASSERT_EQ(1UL, last_account_mappings().size()); | 1098 ASSERT_EQ(1UL, last_account_mappings().size()); |
| 1107 const AccountMapping& actual_mapping = last_account_mappings()[0]; | 1099 const AccountMapping& actual_mapping = last_account_mappings()[0]; |
| 1108 EXPECT_EQ(expected_mapping.account_id, actual_mapping.account_id); | 1100 EXPECT_EQ(expected_mapping.account_id, actual_mapping.account_id); |
| 1109 EXPECT_EQ(expected_mapping.email, actual_mapping.email); | 1101 EXPECT_EQ(expected_mapping.email, actual_mapping.email); |
| 1110 EXPECT_EQ(expected_mapping.status, actual_mapping.status); | 1102 EXPECT_EQ(expected_mapping.status, actual_mapping.status); |
| 1111 EXPECT_EQ(expected_mapping.status_change_timestamp, | 1103 EXPECT_EQ(expected_mapping.status_change_timestamp, |
| 1112 actual_mapping.status_change_timestamp); | 1104 actual_mapping.status_change_timestamp); |
| 1113 } | 1105 } |
| 1114 | 1106 |
| 1115 } // namespace gcm | 1107 } // namespace gcm |
| OLD | NEW |