Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Unified Diff: components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.cc

Issue 1126233004: Persist Instance ID data to GCM store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mac Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.cc
diff --git a/components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.cc b/components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2a50a03ce7686f521fd21d828874e28d9935135c
--- /dev/null
+++ b/components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.cc
@@ -0,0 +1,45 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/gcm_driver/instance_id/fake_gcm_driver_for_instance_id.h"
+
+#include "base/bind.h"
+#include "base/message_loop/message_loop.h"
+
+namespace instance_id {
+
+FakeGCMDriverForInstanceID::FakeGCMDriverForInstanceID() {
+}
+
+FakeGCMDriverForInstanceID::~FakeGCMDriverForInstanceID() {
+}
+
+gcm::InstanceIDStore* FakeGCMDriverForInstanceID::GetInstanceIDStore() {
+ return this;
+}
+
+void FakeGCMDriverForInstanceID::AddInstanceIDData(
+ const std::string& app_id,
+ const std::string& instance_id_data) {
+ instance_id_data_[app_id] = instance_id_data;
+}
+
+void FakeGCMDriverForInstanceID::RemoveInstanceIDData(
+ const std::string& app_id) {
+ instance_id_data_.erase(app_id);
+}
+
+void FakeGCMDriverForInstanceID::GetInstanceIDData(
+ const std::string& app_id,
+ const gcm::InstanceIDStore::GetInstanceIDDataCallback& callback) {
+ std::string data;
+ auto iter = instance_id_data_.find(app_id);
+ if (iter != instance_id_data_.end())
+ data = iter->second;
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(callback, data));
+}
+
+} // namespace instance_id

Powered by Google App Engine
This is Rietveld 408576698