| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/engine/mcs_client.h" | 5 #include "google_apis/gcm/engine/mcs_client.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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/test/simple_test_clock.h" | 12 #include "base/test/simple_test_clock.h" |
| 13 #include "google_apis/gcm/base/fake_encryptor.h" | 13 #include "google_apis/gcm/base/fake_encryptor.h" |
| 14 #include "google_apis/gcm/base/mcs_util.h" | 14 #include "google_apis/gcm/base/mcs_util.h" |
| 15 #include "google_apis/gcm/engine/fake_connection_factory.h" | 15 #include "google_apis/gcm/engine/fake_connection_factory.h" |
| 16 #include "google_apis/gcm/engine/fake_connection_handler.h" | 16 #include "google_apis/gcm/engine/fake_connection_handler.h" |
| 17 #include "google_apis/gcm/engine/gcm_store_impl.h" | 17 #include "google_apis/gcm/engine/gcm_store_impl.h" |
| 18 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h" | 18 #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 20 |
| 21 namespace gcm { | 21 namespace gcm { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 const uint64 kAndroidId = 54321; | 25 const uint64 kAndroidId = 54321; |
| 26 const uint64 kSecurityToken = 12345; | 26 const uint64 kSecurityToken = 12345; |
| 27 | 27 |
| 28 // Number of messages to send when testing batching. | 28 // Number of messages to send when testing batching. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 FakeConnectionFactory connection_factory_; | 133 FakeConnectionFactory connection_factory_; |
| 134 scoped_ptr<TestMCSClient> mcs_client_; | 134 scoped_ptr<TestMCSClient> mcs_client_; |
| 135 bool init_success_; | 135 bool init_success_; |
| 136 uint64 restored_android_id_; | 136 uint64 restored_android_id_; |
| 137 uint64 restored_security_token_; | 137 uint64 restored_security_token_; |
| 138 scoped_ptr<MCSMessage> received_message_; | 138 scoped_ptr<MCSMessage> received_message_; |
| 139 std::string sent_message_id_; | 139 std::string sent_message_id_; |
| 140 MCSClient::MessageSendStatus message_send_status_; | 140 MCSClient::MessageSendStatus message_send_status_; |
| 141 | 141 |
| 142 gcm::GCMStatsRecorder recorder_; | 142 gcm::FakeGCMStatsRecorder recorder_; |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 MCSClientTest::MCSClientTest() | 145 MCSClientTest::MCSClientTest() |
| 146 : run_loop_(new base::RunLoop()), | 146 : run_loop_(new base::RunLoop()), |
| 147 init_success_(true), | 147 init_success_(true), |
| 148 restored_android_id_(0), | 148 restored_android_id_(0), |
| 149 restored_security_token_(0), | 149 restored_security_token_(0), |
| 150 message_send_status_(MCSClient::SENT) { | 150 message_send_status_(MCSClient::SENT) { |
| 151 EXPECT_TRUE(temp_directory_.CreateUniqueTempDir()); | 151 EXPECT_TRUE(temp_directory_.CreateUniqueTempDir()); |
| 152 run_loop_.reset(new base::RunLoop()); | 152 run_loop_.reset(new base::RunLoop()); |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 | 790 |
| 791 LoginClient(std::vector<std::string>()); | 791 LoginClient(std::vector<std::string>()); |
| 792 GetFakeHandler()->ExpectOutgoingMessage(message); | 792 GetFakeHandler()->ExpectOutgoingMessage(message); |
| 793 GetFakeHandler()->ExpectOutgoingMessage(message2); | 793 GetFakeHandler()->ExpectOutgoingMessage(message2); |
| 794 PumpLoop(); | 794 PumpLoop(); |
| 795 } | 795 } |
| 796 | 796 |
| 797 } // namespace | 797 } // namespace |
| 798 | 798 |
| 799 } // namespace gcm | 799 } // namespace gcm |
| OLD | NEW |