Make |context| passed to queryRequiredElement optional
[chromium-blink-merge.git] / components / gcm_driver / fake_gcm_driver.h
blobfd1c5125b4e9fbe77711c3aaca8471b4f14c3530
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_GCM_DRIVER_FAKE_GCM_DRIVER_H_
6 #define COMPONENTS_GCM_DRIVER_FAKE_GCM_DRIVER_H_
8 #include "base/compiler_specific.h"
9 #include "base/macros.h"
10 #include "components/gcm_driver/gcm_driver.h"
12 namespace gcm {
14 class FakeGCMDriver : public GCMDriver {
15 public:
16 FakeGCMDriver();
17 explicit FakeGCMDriver(
18 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner);
20 ~FakeGCMDriver() override;
22 // GCMDriver overrides:
23 void Shutdown() override;
24 void AddAppHandler(const std::string& app_id,
25 GCMAppHandler* handler) override;
26 void RemoveAppHandler(const std::string& app_id) override;
27 void OnSignedIn() override;
28 void OnSignedOut() override;
29 void AddConnectionObserver(GCMConnectionObserver* observer) override;
30 void RemoveConnectionObserver(GCMConnectionObserver* observer) override;
31 void Enable() override;
32 void Disable() override;
33 GCMClient* GetGCMClientForTesting() const override;
34 bool IsStarted() const override;
35 bool IsConnected() const override;
36 void GetGCMStatistics(const GetGCMStatisticsCallback& callback,
37 bool clear_logs) override;
38 void SetGCMRecording(const GetGCMStatisticsCallback& callback,
39 bool recording) override;
40 void SetAccountTokens(
41 const std::vector<GCMClient::AccountTokenInfo>& account_tokens) override;
42 void UpdateAccountMapping(const AccountMapping& account_mapping) override;
43 void RemoveAccountMapping(const std::string& account_id) override;
44 base::Time GetLastTokenFetchTime() override;
45 void SetLastTokenFetchTime(const base::Time& time) override;
46 void WakeFromSuspendForHeartbeat(bool wake) override;
47 InstanceIDHandler* GetInstanceIDHandler() override;
48 void AddHeartbeatInterval(const std::string& scope, int interval_ms) override;
49 void RemoveHeartbeatInterval(const std::string& scope) override;
51 protected:
52 // GCMDriver implementation:
53 GCMClient::Result EnsureStarted(
54 GCMClient::StartMode start_mode) override;
55 void RegisterImpl(const std::string& app_id,
56 const std::vector<std::string>& sender_ids) override;
57 void UnregisterImpl(const std::string& app_id) override;
58 void SendImpl(const std::string& app_id,
59 const std::string& receiver_id,
60 const OutgoingMessage& message) override;
62 private:
63 DISALLOW_COPY_AND_ASSIGN(FakeGCMDriver);
66 } // namespace gcm
68 #endif // COMPONENTS_GCM_DRIVER_FAKE_GCM_DRIVER_H_