| 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 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" | 5 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 KeyedService* FakeGCMProfileService::Build(content::BrowserContext* context) { | 108 KeyedService* FakeGCMProfileService::Build(content::BrowserContext* context) { |
| 109 Profile* profile = static_cast<Profile*>(context); | 109 Profile* profile = static_cast<Profile*>(context); |
| 110 FakeGCMProfileService* service = new FakeGCMProfileService(profile); | 110 FakeGCMProfileService* service = new FakeGCMProfileService(profile); |
| 111 service->SetDriverForTesting(new CustomFakeGCMDriver(service)); | 111 service->SetDriverForTesting(new CustomFakeGCMDriver(service)); |
| 112 return service; | 112 return service; |
| 113 } | 113 } |
| 114 | 114 |
| 115 FakeGCMProfileService::FakeGCMProfileService(Profile* profile) | 115 FakeGCMProfileService::FakeGCMProfileService(Profile* profile) |
| 116 : collect_(false), | 116 : collect_(false), |
| 117 registration_count_(0) { | 117 registration_count_(0) { |
| 118 static_cast<PushMessagingServiceImpl*>(push_messaging_service()) | |
| 119 ->SetProfileForTesting(profile); | |
| 120 } | 118 } |
| 121 | 119 |
| 122 FakeGCMProfileService::~FakeGCMProfileService() {} | 120 FakeGCMProfileService::~FakeGCMProfileService() {} |
| 123 | 121 |
| 124 void FakeGCMProfileService::RegisterFinished( | 122 void FakeGCMProfileService::RegisterFinished( |
| 125 const std::string& app_id, | 123 const std::string& app_id, |
| 126 const std::vector<std::string>& sender_ids) { | 124 const std::vector<std::string>& sender_ids) { |
| 127 if (collect_) { | 125 if (collect_) { |
| 128 last_registered_app_id_ = app_id; | 126 last_registered_app_id_ = app_id; |
| 129 last_registered_sender_ids_ = sender_ids; | 127 last_registered_sender_ids_ = sender_ids; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 GCMClient::Result result) { | 174 GCMClient::Result result) { |
| 177 unregister_responses_.push_back(result); | 175 unregister_responses_.push_back(result); |
| 178 } | 176 } |
| 179 | 177 |
| 180 void FakeGCMProfileService::SetUnregisterCallback( | 178 void FakeGCMProfileService::SetUnregisterCallback( |
| 181 const UnregisterCallback& callback) { | 179 const UnregisterCallback& callback) { |
| 182 unregister_callback_ = callback; | 180 unregister_callback_ = callback; |
| 183 } | 181 } |
| 184 | 182 |
| 185 } // namespace gcm | 183 } // namespace gcm |
| OLD | NEW |