[GCM] Adding chrome.gcm.unregister to gcm API
* Updating the gcm.json to include chrome.gcm.unregister
* Modifying UnregistrationRequest to return proper Status
* Modifying callbacks to properly carry status up the stack as
GCMClient::Result
* Making GCMProfileService.Unregister function public.
* Adding tests for chrome.gcm.unregister
* Adding test for GCMProfileService.Unregister
BUG=351006
Review URL: https://codereview.chromium.org/196133002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257888 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/services/gcm/gcm_client_mock.cc b/chrome/browser/services/gcm/gcm_client_mock.cc
index 678d6bc..3292f3fa 100644
--- a/chrome/browser/services/gcm/gcm_client_mock.cc
+++ b/chrome/browser/services/gcm/gcm_client_mock.cc
@@ -80,6 +80,13 @@
}
void GCMClientMock::Unregister(const std::string& app_id) {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&GCMClientMock::UnregisterFinished,
+ weak_ptr_factory_.GetWeakPtr(),
+ app_id));
}
void GCMClientMock::Send(const std::string& app_id,
@@ -164,6 +171,10 @@
app_id, registrion_id, registrion_id.empty() ? SERVER_ERROR : SUCCESS);
}
+void GCMClientMock::UnregisterFinished(const std::string& app_id) {
+ delegate_->OnUnregisterFinished(app_id, GCMClient::SUCCESS);
+}
+
void GCMClientMock::SendFinished(const std::string& app_id,
const OutgoingMessage& message) {
delegate_->OnSendFinished(app_id, message.id, SUCCESS);