| 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 #ifndef CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_PROFILE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_PROFILE_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_PROFILE_SERVICE_H_ | 6 #define CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_PROFILE_SERVICE_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 8 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| 11 class BrowserContext; | 11 class BrowserContext; |
| 12 } // namespace content | 12 } // namespace content |
| 13 | 13 |
| 14 namespace gcm { | 14 namespace gcm { |
| 15 | 15 |
| 16 // Acts as a bridge between GCM API and GCMClient layer for testing purposes. | 16 // Acts as a bridge between GCM API and GCMClient layer for testing purposes. |
| 17 class FakeGCMProfileService : public GCMProfileService { | 17 class FakeGCMProfileService : public GCMProfileService { |
| 18 public: | 18 public: |
| 19 // Helper function to be used with | 19 // Helper function to be used with |
| 20 // BrowserContextKeyedService::SetTestingFactory(). | 20 // BrowserContextKeyedService::SetTestingFactory(). |
| 21 static BrowserContextKeyedService* Build(content::BrowserContext* context); | 21 static BrowserContextKeyedService* Build(content::BrowserContext* context); |
| 22 | 22 |
| 23 static void EnableGCMForTesting(); | |
| 24 | |
| 25 explicit FakeGCMProfileService(Profile* profile); | 23 explicit FakeGCMProfileService(Profile* profile); |
| 26 virtual ~FakeGCMProfileService(); | 24 virtual ~FakeGCMProfileService(); |
| 27 | 25 |
| 28 // GCMProfileService overrides. | 26 // GCMProfileService overrides. |
| 29 virtual void Register(const std::string& app_id, | 27 virtual void Register(const std::string& app_id, |
| 30 const std::vector<std::string>& sender_ids, | 28 const std::vector<std::string>& sender_ids, |
| 31 const std::string& cert, | 29 const std::string& cert, |
| 32 RegisterCallback callback) OVERRIDE; | 30 RegisterCallback callback) OVERRIDE; |
| 33 virtual void Send(const std::string& app_id, | 31 virtual void Send(const std::string& app_id, |
| 34 const std::string& receiver_id, | 32 const std::string& receiver_id, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 std::string last_registered_cert_; | 76 std::string last_registered_cert_; |
| 79 GCMClient::OutgoingMessage last_sent_message_; | 77 GCMClient::OutgoingMessage last_sent_message_; |
| 80 std::string last_receiver_id_; | 78 std::string last_receiver_id_; |
| 81 | 79 |
| 82 DISALLOW_COPY_AND_ASSIGN(FakeGCMProfileService); | 80 DISALLOW_COPY_AND_ASSIGN(FakeGCMProfileService); |
| 83 }; | 81 }; |
| 84 | 82 |
| 85 } // namespace gcm | 83 } // namespace gcm |
| 86 | 84 |
| 87 #endif // CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_PROFILE_SERVICE_H_ | 85 #endif // CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_PROFILE_SERVICE_H_ |
| OLD | NEW |