| 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/bind.h" |
| 8 #include "base/bind_helpers.h" |
| 7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 11 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/test/simple_test_clock.h" | 15 #include "base/test/simple_test_clock.h" |
| 16 #include "base/timer/timer.h" |
| 13 #include "google_apis/gcm/base/fake_encryptor.h" | 17 #include "google_apis/gcm/base/fake_encryptor.h" |
| 14 #include "google_apis/gcm/base/mcs_util.h" | 18 #include "google_apis/gcm/base/mcs_util.h" |
| 15 #include "google_apis/gcm/engine/fake_connection_factory.h" | 19 #include "google_apis/gcm/engine/fake_connection_factory.h" |
| 16 #include "google_apis/gcm/engine/fake_connection_handler.h" | 20 #include "google_apis/gcm/engine/fake_connection_handler.h" |
| 17 #include "google_apis/gcm/engine/gcm_store_impl.h" | 21 #include "google_apis/gcm/engine/gcm_store_impl.h" |
| 18 #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h" | 22 #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 24 |
| 21 namespace gcm { | 25 namespace gcm { |
| 22 | 26 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 return MCSMessage(kDataMessageStanzaTag, data_message); | 67 return MCSMessage(kDataMessageStanzaTag, data_message); |
| 64 } | 68 } |
| 65 | 69 |
| 66 // MCSClient with overriden exposed persistent id logic. | 70 // MCSClient with overriden exposed persistent id logic. |
| 67 class TestMCSClient : public MCSClient { | 71 class TestMCSClient : public MCSClient { |
| 68 public: | 72 public: |
| 69 TestMCSClient(base::Clock* clock, | 73 TestMCSClient(base::Clock* clock, |
| 70 ConnectionFactory* connection_factory, | 74 ConnectionFactory* connection_factory, |
| 71 GCMStore* gcm_store, | 75 GCMStore* gcm_store, |
| 72 gcm::GCMStatsRecorder* recorder) | 76 gcm::GCMStatsRecorder* recorder) |
| 73 : MCSClient("", clock, connection_factory, gcm_store, recorder), | 77 : MCSClient("", clock, connection_factory, gcm_store, recorder, |
| 78 make_scoped_ptr(new base::Timer(true, false))), |
| 74 next_id_(0) { | 79 next_id_(0) { |
| 75 } | 80 } |
| 76 | 81 |
| 77 std::string GetNextPersistentId() override { | 82 std::string GetNextPersistentId() override { |
| 78 return base::UintToString(++next_id_); | 83 return base::UintToString(++next_id_); |
| 79 } | 84 } |
| 80 | 85 |
| 81 private: | 86 private: |
| 82 uint32 next_id_; | 87 uint32 next_id_; |
| 83 }; | 88 }; |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 | 866 |
| 862 LoginClient(std::vector<std::string>()); | 867 LoginClient(std::vector<std::string>()); |
| 863 GetFakeHandler()->ExpectOutgoingMessage(message); | 868 GetFakeHandler()->ExpectOutgoingMessage(message); |
| 864 GetFakeHandler()->ExpectOutgoingMessage(message2); | 869 GetFakeHandler()->ExpectOutgoingMessage(message2); |
| 865 PumpLoop(); | 870 PumpLoop(); |
| 866 } | 871 } |
| 867 | 872 |
| 868 } // namespace | 873 } // namespace |
| 869 | 874 |
| 870 } // namespace gcm | 875 } // namespace gcm |
| OLD | NEW |