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

Unified Diff: components/gcm_driver/fake_gcm_client.h

Issue 2578583002: Provide a mechanism for the GCM driver to send message receipts to GCM.
Patch Set: Adding new file I missed previously. Created 3 years, 11 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/fake_gcm_client.h
diff --git a/components/gcm_driver/fake_gcm_client.h b/components/gcm_driver/fake_gcm_client.h
index 251b0fd5b22fe49d83ff94857fae1f775510d225..ca5916d37bf3ebc920ee9e69555f73bc2d411a57 100644
--- a/components/gcm_driver/fake_gcm_client.h
+++ b/components/gcm_driver/fake_gcm_client.h
@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "components/gcm_driver/gcm_client.h"
+#include "components/gcm_driver/gcm_message_status.h"
#include "components/gcm_driver/gcm_stats_recorder_impl.h"
namespace base {
@@ -58,6 +59,9 @@ class FakeGCMClient : public GCMClient {
void Send(const std::string& app_id,
const std::string& receiver_id,
const OutgoingMessage& message) override;
+ void SendMessageReceipt(const std::string& message_id,
+ const std::string& app_id,
+ GCMMessageStatus status) override;
void RecordDecryptionFailure(const std::string& app_id,
GCMEncryptionProvider::DecryptionResult result)
override;
@@ -87,6 +91,7 @@ class FakeGCMClient : public GCMClient {
// Simulate receiving something from the server.
// Called on UI thread.
void ReceiveMessage(const std::string& app_id,
+ const std::string& message_id,
const IncomingMessage& message);
void DeleteMessages(const std::string& app_id);
@@ -94,6 +99,10 @@ class FakeGCMClient : public GCMClient {
start_mode_overridding_ = overridding;
}
+ const std::string& receipt_app_id() { return receipt_app_id_; }
+ const std::string& receipt_message_id() { return receipt_message_id_; }
+ GCMMessageStatus receipt_status() { return receipt_status_; }
+
private:
// Called on IO thread.
void DoStart();
@@ -105,7 +114,8 @@ class FakeGCMClient : public GCMClient {
const linked_ptr<RegistrationInfo>& registration_info);
void SendFinished(const std::string& app_id, const OutgoingMessage& message);
void MessageReceived(const std::string& app_id,
- const IncomingMessage& message);
+ const IncomingMessage& message,
+ const GCMClient::MessageReceiptCallback& callback);
void MessagesDeleted(const std::string& app_id);
void MessageSendError(const std::string& app_id,
const SendErrorDetails& send_error_details);
@@ -121,6 +131,9 @@ class FakeGCMClient : public GCMClient {
scoped_refptr<base::SequencedTaskRunner> io_thread_;
std::map<std::string, std::pair<std::string, std::string>> instance_id_data_;
GCMStatsRecorderImpl recorder_;
+ std::string receipt_app_id_;
+ std::string receipt_message_id_;
+ GCMMessageStatus receipt_status_;
base::WeakPtrFactory<FakeGCMClient> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(FakeGCMClient);

Powered by Google App Engine
This is Rietveld 408576698