| 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 #ifndef COMPONENTS_GCM_DRIVER_FAKE_GCM_CLIENT_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_FAKE_GCM_CLIENT_H_ |
| 6 #define COMPONENTS_GCM_DRIVER_FAKE_GCM_CLIENT_H_ | 6 #define COMPONENTS_GCM_DRIVER_FAKE_GCM_CLIENT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "components/gcm_driver/gcm_client.h" | 13 #include "components/gcm_driver/gcm_client.h" |
| 14 #include "components/gcm_driver/gcm_stats_recorder_impl.h" |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 class SequencedTaskRunner; | 17 class SequencedTaskRunner; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace gcm { | 20 namespace gcm { |
| 20 | 21 |
| 21 class FakeGCMClient : public GCMClient { | 22 class FakeGCMClient : public GCMClient { |
| 22 public: | 23 public: |
| 23 // For testing purpose. | 24 // For testing purpose. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 50 scoped_ptr<Encryptor> encryptor, | 51 scoped_ptr<Encryptor> encryptor, |
| 51 Delegate* delegate) override; | 52 Delegate* delegate) override; |
| 52 void Start(StartMode start_mode) override; | 53 void Start(StartMode start_mode) override; |
| 53 void Stop() override; | 54 void Stop() override; |
| 54 void Register(const linked_ptr<RegistrationInfo>& registration_info) override; | 55 void Register(const linked_ptr<RegistrationInfo>& registration_info) override; |
| 55 void Unregister( | 56 void Unregister( |
| 56 const linked_ptr<RegistrationInfo>& registration_info) override; | 57 const linked_ptr<RegistrationInfo>& registration_info) override; |
| 57 void Send(const std::string& app_id, | 58 void Send(const std::string& app_id, |
| 58 const std::string& receiver_id, | 59 const std::string& receiver_id, |
| 59 const OutgoingMessage& message) override; | 60 const OutgoingMessage& message) override; |
| 61 void RecordDecryptionFailure(const std::string& app_id, |
| 62 GCMEncryptionProvider::DecryptionFailure reason) |
| 63 override; |
| 60 void SetRecording(bool recording) override; | 64 void SetRecording(bool recording) override; |
| 61 void ClearActivityLogs() override; | 65 void ClearActivityLogs() override; |
| 62 GCMStatistics GetStatistics() const override; | 66 GCMStatistics GetStatistics() const override; |
| 63 void SetAccountTokens( | 67 void SetAccountTokens( |
| 64 const std::vector<AccountTokenInfo>& account_tokens) override; | 68 const std::vector<AccountTokenInfo>& account_tokens) override; |
| 65 void UpdateAccountMapping(const AccountMapping& account_mapping) override; | 69 void UpdateAccountMapping(const AccountMapping& account_mapping) override; |
| 66 void RemoveAccountMapping(const std::string& account_id) override; | 70 void RemoveAccountMapping(const std::string& account_id) override; |
| 67 void SetLastTokenFetchTime(const base::Time& time) override; | 71 void SetLastTokenFetchTime(const base::Time& time) override; |
| 68 void UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer) override; | 72 void UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer) override; |
| 69 void AddInstanceIDData(const std::string& app_id, | 73 void AddInstanceIDData(const std::string& app_id, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 void SendAcknowledgement(const std::string& app_id, | 112 void SendAcknowledgement(const std::string& app_id, |
| 109 const std::string& message_id); | 113 const std::string& message_id); |
| 110 | 114 |
| 111 Delegate* delegate_; | 115 Delegate* delegate_; |
| 112 bool started_; | 116 bool started_; |
| 113 StartMode start_mode_; | 117 StartMode start_mode_; |
| 114 StartModeOverridding start_mode_overridding_; | 118 StartModeOverridding start_mode_overridding_; |
| 115 scoped_refptr<base::SequencedTaskRunner> ui_thread_; | 119 scoped_refptr<base::SequencedTaskRunner> ui_thread_; |
| 116 scoped_refptr<base::SequencedTaskRunner> io_thread_; | 120 scoped_refptr<base::SequencedTaskRunner> io_thread_; |
| 117 std::map<std::string, std::pair<std::string, std::string>> instance_id_data_; | 121 std::map<std::string, std::pair<std::string, std::string>> instance_id_data_; |
| 122 GCMStatsRecorderImpl recorder_; |
| 118 base::WeakPtrFactory<FakeGCMClient> weak_ptr_factory_; | 123 base::WeakPtrFactory<FakeGCMClient> weak_ptr_factory_; |
| 119 | 124 |
| 120 DISALLOW_COPY_AND_ASSIGN(FakeGCMClient); | 125 DISALLOW_COPY_AND_ASSIGN(FakeGCMClient); |
| 121 }; | 126 }; |
| 122 | 127 |
| 123 } // namespace gcm | 128 } // namespace gcm |
| 124 | 129 |
| 125 #endif // COMPONENTS_GCM_DRIVER_FAKE_GCM_CLIENT_H_ | 130 #endif // COMPONENTS_GCM_DRIVER_FAKE_GCM_CLIENT_H_ |
| OLD | NEW |