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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 GCMStatsRecorder* recorder) { | 229 GCMStatsRecorder* recorder) { |
230 return make_scoped_ptr<ConnectionFactory>(new FakeConnectionFactory()); | 230 return make_scoped_ptr<ConnectionFactory>(new FakeConnectionFactory()); |
231 } | 231 } |
232 | 232 |
233 } // namespace | 233 } // namespace |
234 | 234 |
235 class GCMClientImplTest : public testing::Test, | 235 class GCMClientImplTest : public testing::Test, |
236 public GCMClient::Delegate { | 236 public GCMClient::Delegate { |
237 public: | 237 public: |
238 GCMClientImplTest(); | 238 GCMClientImplTest(); |
239 virtual ~GCMClientImplTest(); | 239 ~GCMClientImplTest() override; |
240 | 240 |
241 virtual void SetUp() override; | 241 void SetUp() override; |
242 | 242 |
243 void SetUpUrlFetcherFactory(); | 243 void SetUpUrlFetcherFactory(); |
244 | 244 |
245 void BuildGCMClient(base::TimeDelta clock_step); | 245 void BuildGCMClient(base::TimeDelta clock_step); |
246 void InitializeGCMClient(); | 246 void InitializeGCMClient(); |
247 void StartGCMClient(); | 247 void StartGCMClient(); |
248 void ReceiveMessageFromMCS(const MCSMessage& message); | 248 void ReceiveMessageFromMCS(const MCSMessage& message); |
249 void ReceiveOnMessageSentToMCS( | 249 void ReceiveOnMessageSentToMCS( |
250 const std::string& app_id, | 250 const std::string& app_id, |
251 const std::string& message_id, | 251 const std::string& message_id, |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 TEST_F(GCMClientImplTest, SendMessageAcknowledged) { | 779 TEST_F(GCMClientImplTest, SendMessageAcknowledged) { |
780 ReceiveOnMessageSentToMCS(kAppId, "007", MCSClient::SENT); | 780 ReceiveOnMessageSentToMCS(kAppId, "007", MCSClient::SENT); |
781 EXPECT_EQ(MESSAGE_SEND_ACK, last_event()); | 781 EXPECT_EQ(MESSAGE_SEND_ACK, last_event()); |
782 EXPECT_EQ(kAppId, last_app_id()); | 782 EXPECT_EQ(kAppId, last_app_id()); |
783 EXPECT_EQ("007", last_message_id()); | 783 EXPECT_EQ("007", last_message_id()); |
784 } | 784 } |
785 | 785 |
786 class GCMClientImplCheckinTest : public GCMClientImplTest { | 786 class GCMClientImplCheckinTest : public GCMClientImplTest { |
787 public: | 787 public: |
788 GCMClientImplCheckinTest(); | 788 GCMClientImplCheckinTest(); |
789 virtual ~GCMClientImplCheckinTest(); | 789 ~GCMClientImplCheckinTest() override; |
790 | 790 |
791 virtual void SetUp() override; | 791 void SetUp() override; |
792 }; | 792 }; |
793 | 793 |
794 GCMClientImplCheckinTest::GCMClientImplCheckinTest() { | 794 GCMClientImplCheckinTest::GCMClientImplCheckinTest() { |
795 } | 795 } |
796 | 796 |
797 GCMClientImplCheckinTest::~GCMClientImplCheckinTest() { | 797 GCMClientImplCheckinTest::~GCMClientImplCheckinTest() { |
798 } | 798 } |
799 | 799 |
800 void GCMClientImplCheckinTest::SetUp() { | 800 void GCMClientImplCheckinTest::SetUp() { |
801 testing::Test::SetUp(); | 801 testing::Test::SetUp(); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 accounts.insert("test_user2@gmail.com"); | 1008 accounts.insert("test_user2@gmail.com"); |
1009 EXPECT_EQ(accounts, device_checkin_info().last_checkin_accounts); | 1009 EXPECT_EQ(accounts, device_checkin_info().last_checkin_accounts); |
1010 EXPECT_TRUE(device_checkin_info().accounts_set); | 1010 EXPECT_TRUE(device_checkin_info().accounts_set); |
1011 EXPECT_EQ(MakeEmailToTokenMap(account_tokens), | 1011 EXPECT_EQ(MakeEmailToTokenMap(account_tokens), |
1012 device_checkin_info().account_tokens); | 1012 device_checkin_info().account_tokens); |
1013 } | 1013 } |
1014 | 1014 |
1015 class GCMClientImplStartAndStopTest : public GCMClientImplTest { | 1015 class GCMClientImplStartAndStopTest : public GCMClientImplTest { |
1016 public: | 1016 public: |
1017 GCMClientImplStartAndStopTest(); | 1017 GCMClientImplStartAndStopTest(); |
1018 virtual ~GCMClientImplStartAndStopTest(); | 1018 ~GCMClientImplStartAndStopTest() override; |
1019 | 1019 |
1020 virtual void SetUp() override; | 1020 void SetUp() override; |
1021 | 1021 |
1022 void DefaultCompleteCheckin(); | 1022 void DefaultCompleteCheckin(); |
1023 }; | 1023 }; |
1024 | 1024 |
1025 GCMClientImplStartAndStopTest::GCMClientImplStartAndStopTest() { | 1025 GCMClientImplStartAndStopTest::GCMClientImplStartAndStopTest() { |
1026 } | 1026 } |
1027 | 1027 |
1028 GCMClientImplStartAndStopTest::~GCMClientImplStartAndStopTest() { | 1028 GCMClientImplStartAndStopTest::~GCMClientImplStartAndStopTest() { |
1029 } | 1029 } |
1030 | 1030 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 ASSERT_EQ(1UL, last_account_mappings().size()); | 1107 ASSERT_EQ(1UL, last_account_mappings().size()); |
1108 const AccountMapping& actual_mapping = last_account_mappings()[0]; | 1108 const AccountMapping& actual_mapping = last_account_mappings()[0]; |
1109 EXPECT_EQ(expected_mapping.account_id, actual_mapping.account_id); | 1109 EXPECT_EQ(expected_mapping.account_id, actual_mapping.account_id); |
1110 EXPECT_EQ(expected_mapping.email, actual_mapping.email); | 1110 EXPECT_EQ(expected_mapping.email, actual_mapping.email); |
1111 EXPECT_EQ(expected_mapping.status, actual_mapping.status); | 1111 EXPECT_EQ(expected_mapping.status, actual_mapping.status); |
1112 EXPECT_EQ(expected_mapping.status_change_timestamp, | 1112 EXPECT_EQ(expected_mapping.status_change_timestamp, |
1113 actual_mapping.status_change_timestamp); | 1113 actual_mapping.status_change_timestamp); |
1114 } | 1114 } |
1115 | 1115 |
1116 } // namespace gcm | 1116 } // namespace gcm |
OLD | NEW |