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 "chrome/browser/services/gcm/gcm_profile_service.h" | 11 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
12 #include "components/gcm_driver/gcm_driver.h" | 12 #include "components/gcm_driver/gcm_driver.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class BrowserContext; | 15 class BrowserContext; |
16 } // namespace content | 16 } // namespace content |
17 | 17 |
18 namespace gcm { | 18 namespace gcm { |
19 | 19 |
20 // Acts as a bridge between GCM API and GCMClient layer for testing purposes. | 20 // Acts as a bridge between GCM API and GCMClient layer for testing purposes. |
21 class FakeGCMProfileService : public GCMProfileService { | 21 class FakeGCMProfileService : public GCMProfileService { |
22 public: | 22 public: |
23 // Helper function to be used with | 23 // Helper function to be used with |
24 // KeyedService::SetTestingFactory(). | 24 // KeyedService::SetTestingFactory(). |
25 static KeyedService* Build(content::BrowserContext* context); | 25 static KeyedService* Build(content::BrowserContext* context); |
26 | 26 |
27 explicit FakeGCMProfileService(Profile* profile); | 27 explicit FakeGCMProfileService(Profile* profile); |
28 virtual ~FakeGCMProfileService(); | 28 ~FakeGCMProfileService() override; |
29 | 29 |
30 void RegisterFinished(const std::string& app_id, | 30 void RegisterFinished(const std::string& app_id, |
31 const std::vector<std::string>& sender_ids); | 31 const std::vector<std::string>& sender_ids); |
32 void UnregisterFinished(const std::string& app_id); | 32 void UnregisterFinished(const std::string& app_id); |
33 void SendFinished(const std::string& app_id, | 33 void SendFinished(const std::string& app_id, |
34 const std::string& receiver_id, | 34 const std::string& receiver_id, |
35 const GCMClient::OutgoingMessage& message); | 35 const GCMClient::OutgoingMessage& message); |
36 | 36 |
37 void AddExpectedUnregisterResponse(GCMClient::Result result); | 37 void AddExpectedUnregisterResponse(GCMClient::Result result); |
38 | 38 |
(...skipping 26 matching lines...) Expand all Loading... |
65 std::list<GCMClient::Result> unregister_responses_; | 65 std::list<GCMClient::Result> unregister_responses_; |
66 GCMClient::OutgoingMessage last_sent_message_; | 66 GCMClient::OutgoingMessage last_sent_message_; |
67 std::string last_receiver_id_; | 67 std::string last_receiver_id_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(FakeGCMProfileService); | 69 DISALLOW_COPY_AND_ASSIGN(FakeGCMProfileService); |
70 }; | 70 }; |
71 | 71 |
72 } // namespace gcm | 72 } // namespace gcm |
73 | 73 |
74 #endif // CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_PROFILE_SERVICE_H_ | 74 #endif // CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_PROFILE_SERVICE_H_ |
OLD | NEW |