fake_gcm_driver.cc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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.
  4. #include "components/gcm_driver/fake_gcm_driver.h"
  5. #include "base/bind.h"
  6. #include "base/files/file_path.h"
  7. #include "base/task/sequenced_task_runner.h"
  8. #include "base/threading/thread_task_runner_handle.h"
  9. namespace gcm {
  10. FakeGCMDriver::FakeGCMDriver() : GCMDriver(base::FilePath(), nullptr) {}
  11. FakeGCMDriver::FakeGCMDriver(
  12. const base::FilePath& store_path,
  13. const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner)
  14. : GCMDriver(store_path, blocking_task_runner) {}
  15. FakeGCMDriver::~FakeGCMDriver() = default;
  16. void FakeGCMDriver::ValidateRegistration(
  17. const std::string& app_id,
  18. const std::vector<std::string>& sender_ids,
  19. const std::string& registration_id,
  20. ValidateRegistrationCallback callback) {
  21. base::ThreadTaskRunnerHandle::Get()->PostTask(
  22. FROM_HERE, base::BindOnce(std::move(callback), true /* is_valid */));
  23. }
  24. void FakeGCMDriver::OnSignedIn() {
  25. }
  26. void FakeGCMDriver::OnSignedOut() {
  27. }
  28. void FakeGCMDriver::AddConnectionObserver(GCMConnectionObserver* observer) {
  29. }
  30. void FakeGCMDriver::RemoveConnectionObserver(GCMConnectionObserver* observer) {
  31. }
  32. GCMClient* FakeGCMDriver::GetGCMClientForTesting() const {
  33. return nullptr;
  34. }
  35. bool FakeGCMDriver::IsStarted() const {
  36. return true;
  37. }
  38. bool FakeGCMDriver::IsConnected() const {
  39. return true;
  40. }
  41. void FakeGCMDriver::GetGCMStatistics(GetGCMStatisticsCallback callback,
  42. ClearActivityLogs clear_logs) {}
  43. void FakeGCMDriver::SetGCMRecording(
  44. const GCMStatisticsRecordingCallback& callback,
  45. bool recording) {}
  46. GCMClient::Result FakeGCMDriver::EnsureStarted(
  47. GCMClient::StartMode start_mode) {
  48. return GCMClient::SUCCESS;
  49. }
  50. void FakeGCMDriver::RegisterImpl(const std::string& app_id,
  51. const std::vector<std::string>& sender_ids) {
  52. }
  53. void FakeGCMDriver::UnregisterImpl(const std::string& app_id) {
  54. }
  55. void FakeGCMDriver::SendImpl(const std::string& app_id,
  56. const std::string& receiver_id,
  57. const OutgoingMessage& message) {
  58. }
  59. void FakeGCMDriver::RecordDecryptionFailure(const std::string& app_id,
  60. GCMDecryptionResult result) {}
  61. void FakeGCMDriver::SetAccountTokens(
  62. const std::vector<GCMClient::AccountTokenInfo>& account_tokens) {
  63. }
  64. void FakeGCMDriver::UpdateAccountMapping(
  65. const AccountMapping& account_mapping) {
  66. }
  67. void FakeGCMDriver::RemoveAccountMapping(const CoreAccountId& account_id) {}
  68. base::Time FakeGCMDriver::GetLastTokenFetchTime() {
  69. return base::Time();
  70. }
  71. void FakeGCMDriver::SetLastTokenFetchTime(const base::Time& time) {
  72. }
  73. InstanceIDHandler* FakeGCMDriver::GetInstanceIDHandlerInternal() {
  74. return nullptr;
  75. }
  76. void FakeGCMDriver::AddHeartbeatInterval(const std::string& scope,
  77. int interval_ms) {
  78. }
  79. void FakeGCMDriver::RemoveHeartbeatInterval(const std::string& scope) {
  80. }
  81. } // namespace gcm