Move Webstore URL concepts to //extensions and out
[chromium-blink-merge.git] / chrome / browser / services / gcm / fake_gcm_profile_service.h
blobbc9ade990d2e8f6f9f50cbb0ce3c758a4db152f4
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_PROFILE_SERVICE_H_
6 #define CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_PROFILE_SERVICE_H_
8 #include <list>
9 #include <vector>
11 #include "chrome/browser/services/gcm/gcm_profile_service.h"
12 #include "components/gcm_driver/gcm_driver.h"
14 namespace content {
15 class BrowserContext;
16 } // namespace content
18 namespace gcm {
20 // Acts as a bridge between GCM API and GCMClient layer for testing purposes.
21 class FakeGCMProfileService : public GCMProfileService {
22 public:
23 // Helper function to be used with
24 // KeyedService::SetTestingFactory().
25 static KeyedService* Build(content::BrowserContext* context);
27 explicit FakeGCMProfileService(Profile* profile);
28 virtual ~FakeGCMProfileService();
30 void RegisterFinished(const std::string& app_id,
31 const std::vector<std::string>& sender_ids);
32 void UnregisterFinished(const std::string& app_id);
33 void SendFinished(const std::string& app_id,
34 const std::string& receiver_id,
35 const GCMClient::OutgoingMessage& message);
37 void AddExpectedUnregisterResponse(GCMClient::Result result);
39 const GCMClient::OutgoingMessage& last_sent_message() const {
40 return last_sent_message_;
43 const std::string& last_receiver_id() const {
44 return last_receiver_id_;
47 const std::string& last_registered_app_id() const {
48 return last_registered_app_id_;
51 const std::vector<std::string>& last_registered_sender_ids() const {
52 return last_registered_sender_ids_;
55 void set_collect(bool collect) {
56 collect_ = collect;
59 private:
60 // Indicates whether the service will collect paramters of the calls for
61 // furter verification in tests.
62 bool collect_;
63 std::string last_registered_app_id_;
64 std::vector<std::string> last_registered_sender_ids_;
65 std::list<GCMClient::Result> unregister_responses_;
66 GCMClient::OutgoingMessage last_sent_message_;
67 std::string last_receiver_id_;
69 DISALLOW_COPY_AND_ASSIGN(FakeGCMProfileService);
72 } // namespace gcm
74 #endif // CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_PROFILE_SERVICE_H_