| 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_DRIVER_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_FAKE_GCM_DRIVER_H_ |
| 6 #define COMPONENTS_GCM_DRIVER_FAKE_GCM_DRIVER_H_ | 6 #define COMPONENTS_GCM_DRIVER_FAKE_GCM_DRIVER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "components/gcm_driver/gcm_driver.h" | 10 #include "components/gcm_driver/gcm_driver.h" |
| 11 | 11 |
| 12 namespace gcm { | 12 namespace gcm { |
| 13 | 13 |
| 14 class FakeGCMDriver : public GCMDriver { | 14 class FakeGCMDriver : public GCMDriver { |
| 15 public: | 15 public: |
| 16 FakeGCMDriver(); | 16 FakeGCMDriver(); |
| 17 virtual ~FakeGCMDriver(); | 17 ~FakeGCMDriver() override; |
| 18 | 18 |
| 19 // GCMDriver overrides: | 19 // GCMDriver overrides: |
| 20 virtual void Shutdown() override; | 20 void Shutdown() override; |
| 21 virtual void AddAppHandler(const std::string& app_id, | 21 void AddAppHandler(const std::string& app_id, |
| 22 GCMAppHandler* handler) override; | 22 GCMAppHandler* handler) override; |
| 23 virtual void RemoveAppHandler(const std::string& app_id) override; | 23 void RemoveAppHandler(const std::string& app_id) override; |
| 24 virtual void OnSignedIn() override; | 24 void OnSignedIn() override; |
| 25 virtual void OnSignedOut() override; | 25 void OnSignedOut() override; |
| 26 virtual void Purge() override; | 26 void Purge() override; |
| 27 virtual void AddConnectionObserver(GCMConnectionObserver* observer) override; | 27 void AddConnectionObserver(GCMConnectionObserver* observer) override; |
| 28 virtual void RemoveConnectionObserver( | 28 void RemoveConnectionObserver(GCMConnectionObserver* observer) override; |
| 29 GCMConnectionObserver* observer) override; | 29 void Enable() override; |
| 30 virtual void Enable() override; | 30 void Disable() override; |
| 31 virtual void Disable() override; | 31 GCMClient* GetGCMClientForTesting() const override; |
| 32 virtual GCMClient* GetGCMClientForTesting() const override; | 32 bool IsStarted() const override; |
| 33 virtual bool IsStarted() const override; | 33 bool IsConnected() const override; |
| 34 virtual bool IsConnected() const override; | 34 void GetGCMStatistics(const GetGCMStatisticsCallback& callback, |
| 35 virtual void GetGCMStatistics(const GetGCMStatisticsCallback& callback, | 35 bool clear_logs) override; |
| 36 bool clear_logs) override; | 36 void SetGCMRecording(const GetGCMStatisticsCallback& callback, |
| 37 virtual void SetGCMRecording(const GetGCMStatisticsCallback& callback, | 37 bool recording) override; |
| 38 bool recording) override; | 38 void SetAccountTokens( |
| 39 virtual void SetAccountTokens( | |
| 40 const std::vector<GCMClient::AccountTokenInfo>& account_tokens) override; | 39 const std::vector<GCMClient::AccountTokenInfo>& account_tokens) override; |
| 41 virtual void UpdateAccountMapping( | 40 void UpdateAccountMapping(const AccountMapping& account_mapping) override; |
| 42 const AccountMapping& account_mapping) override; | 41 void RemoveAccountMapping(const std::string& account_id) override; |
| 43 virtual void RemoveAccountMapping(const std::string& account_id) override; | |
| 44 | 42 |
| 45 protected: | 43 protected: |
| 46 // GCMDriver implementation: | 44 // GCMDriver implementation: |
| 47 virtual GCMClient::Result EnsureStarted() override; | 45 GCMClient::Result EnsureStarted() override; |
| 48 virtual void RegisterImpl( | 46 void RegisterImpl(const std::string& app_id, |
| 49 const std::string& app_id, | 47 const std::vector<std::string>& sender_ids) override; |
| 50 const std::vector<std::string>& sender_ids) override; | 48 void UnregisterImpl(const std::string& app_id) override; |
| 51 virtual void UnregisterImpl(const std::string& app_id) override; | 49 void SendImpl(const std::string& app_id, |
| 52 virtual void SendImpl(const std::string& app_id, | 50 const std::string& receiver_id, |
| 53 const std::string& receiver_id, | 51 const GCMClient::OutgoingMessage& message) override; |
| 54 const GCMClient::OutgoingMessage& message) override; | |
| 55 | 52 |
| 56 private: | 53 private: |
| 57 DISALLOW_COPY_AND_ASSIGN(FakeGCMDriver); | 54 DISALLOW_COPY_AND_ASSIGN(FakeGCMDriver); |
| 58 }; | 55 }; |
| 59 | 56 |
| 60 } // namespace gcm | 57 } // namespace gcm |
| 61 | 58 |
| 62 #endif // COMPONENTS_GCM_DRIVER_FAKE_GCM_DRIVER_H_ | 59 #endif // COMPONENTS_GCM_DRIVER_FAKE_GCM_DRIVER_H_ |
| OLD | NEW |