| 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" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 class TestMCSClient : public MCSClient { | 67 class TestMCSClient : public MCSClient { |
| 68 public: | 68 public: |
| 69 TestMCSClient(base::Clock* clock, | 69 TestMCSClient(base::Clock* clock, |
| 70 ConnectionFactory* connection_factory, | 70 ConnectionFactory* connection_factory, |
| 71 GCMStore* gcm_store, | 71 GCMStore* gcm_store, |
| 72 gcm::GCMStatsRecorder* recorder) | 72 gcm::GCMStatsRecorder* recorder) |
| 73 : MCSClient("", clock, connection_factory, gcm_store, recorder), | 73 : MCSClient("", clock, connection_factory, gcm_store, recorder), |
| 74 next_id_(0) { | 74 next_id_(0) { |
| 75 } | 75 } |
| 76 | 76 |
| 77 virtual std::string GetNextPersistentId() OVERRIDE { | 77 virtual std::string GetNextPersistentId() override { |
| 78 return base::UintToString(++next_id_); | 78 return base::UintToString(++next_id_); |
| 79 } | 79 } |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 uint32 next_id_; | 82 uint32 next_id_; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 class MCSClientTest : public testing::Test { | 85 class MCSClientTest : public testing::Test { |
| 86 public: | 86 public: |
| 87 MCSClientTest(); | 87 MCSClientTest(); |
| 88 virtual ~MCSClientTest(); | 88 virtual ~MCSClientTest(); |
| 89 | 89 |
| 90 virtual void SetUp() OVERRIDE; | 90 virtual void SetUp() override; |
| 91 | 91 |
| 92 void BuildMCSClient(); | 92 void BuildMCSClient(); |
| 93 void InitializeClient(); | 93 void InitializeClient(); |
| 94 void StoreCredentials(); | 94 void StoreCredentials(); |
| 95 void LoginClient(const std::vector<std::string>& acknowledged_ids); | 95 void LoginClient(const std::vector<std::string>& acknowledged_ids); |
| 96 | 96 |
| 97 base::SimpleTestClock* clock() { return &clock_; } | 97 base::SimpleTestClock* clock() { return &clock_; } |
| 98 TestMCSClient* mcs_client() const { return mcs_client_.get(); } | 98 TestMCSClient* mcs_client() const { return mcs_client_.get(); } |
| 99 FakeConnectionFactory* connection_factory() { | 99 FakeConnectionFactory* connection_factory() { |
| 100 return &connection_factory_; | 100 return &connection_factory_; |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 | 879 |
| 880 LoginClient(std::vector<std::string>()); | 880 LoginClient(std::vector<std::string>()); |
| 881 GetFakeHandler()->ExpectOutgoingMessage(message); | 881 GetFakeHandler()->ExpectOutgoingMessage(message); |
| 882 GetFakeHandler()->ExpectOutgoingMessage(message2); | 882 GetFakeHandler()->ExpectOutgoingMessage(message2); |
| 883 PumpLoop(); | 883 PumpLoop(); |
| 884 } | 884 } |
| 885 | 885 |
| 886 } // namespace | 886 } // namespace |
| 887 | 887 |
| 888 } // namespace gcm | 888 } // namespace gcm |
| OLD | NEW |