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 <list> | 8 #include <list> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" |
11 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 12 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
12 #include "components/gcm_driver/gcm_driver.h" | 13 #include "components/gcm_driver/gcm_driver.h" |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 class BrowserContext; | 16 class BrowserContext; |
16 } // namespace content | 17 } // namespace content |
17 | 18 |
18 namespace gcm { | 19 namespace gcm { |
19 | 20 |
20 // Acts as a bridge between GCM API and GCMClient layer for testing purposes. | 21 // Acts as a bridge between GCM API and GCMClient layer for testing purposes. |
21 class FakeGCMProfileService : public GCMProfileService { | 22 class FakeGCMProfileService : public GCMProfileService { |
22 public: | 23 public: |
23 typedef base::Callback<void(const std::string&)> UnregisterCallback; | 24 typedef base::Callback<void(const std::string&)> UnregisterCallback; |
24 | 25 |
25 // Helper function to be used with | 26 // Helper function to be used with |
26 // KeyedService::SetTestingFactory(). | 27 // KeyedService::SetTestingFactory(). |
27 static KeyedService* Build(content::BrowserContext* context); | 28 static scoped_ptr<KeyedService> Build(content::BrowserContext* context); |
28 | 29 |
29 explicit FakeGCMProfileService(Profile* profile); | 30 explicit FakeGCMProfileService(Profile* profile); |
30 ~FakeGCMProfileService() override; | 31 ~FakeGCMProfileService() override; |
31 | 32 |
32 void RegisterFinished(const std::string& app_id, | 33 void RegisterFinished(const std::string& app_id, |
33 const std::vector<std::string>& sender_ids); | 34 const std::vector<std::string>& sender_ids); |
34 void UnregisterFinished(const std::string& app_id); | 35 void UnregisterFinished(const std::string& app_id); |
35 void SendFinished(const std::string& app_id, | 36 void SendFinished(const std::string& app_id, |
36 const std::string& receiver_id, | 37 const std::string& receiver_id, |
37 const GCMClient::OutgoingMessage& message); | 38 const GCMClient::OutgoingMessage& message); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 GCMClient::OutgoingMessage last_sent_message_; | 74 GCMClient::OutgoingMessage last_sent_message_; |
74 std::string last_receiver_id_; | 75 std::string last_receiver_id_; |
75 UnregisterCallback unregister_callback_; | 76 UnregisterCallback unregister_callback_; |
76 | 77 |
77 DISALLOW_COPY_AND_ASSIGN(FakeGCMProfileService); | 78 DISALLOW_COPY_AND_ASSIGN(FakeGCMProfileService); |
78 }; | 79 }; |
79 | 80 |
80 } // namespace gcm | 81 } // namespace gcm |
81 | 82 |
82 #endif // CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_PROFILE_SERVICE_H_ | 83 #endif // CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_PROFILE_SERVICE_H_ |
OLD | NEW |