[GCM] Make GCMProfileService persist check-in info
[email protected], [email protected]
[email protected]
BUG=284553
TEST=new tests added
Review URL: https://codereview.chromium.org/79433008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237394 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 3fe7859..d4888b905 100644
--- a/chrome/browser/services/gcm/gcm_client_mock.cc
+++ b/chrome/browser/services/gcm/gcm_client_mock.cc
@@ -25,24 +25,26 @@
} // namespace
-GCMClientMock::GCMClientMock() {
+GCMClientMock::GCMClientMock() : checkin_failure_enabled_(false) {
}
GCMClientMock::~GCMClientMock() {
}
-void GCMClientMock::AddUser(const std::string& username, Delegate* delegate) {
+void GCMClientMock::CheckIn(const std::string& username, Delegate* delegate) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(delegates_.find(username) == delegates_.end());
delegates_[username] = delegate;
// Simulate the android_id and secret by some sort of hashing.
- CheckInInfo checkin_info = GetCheckInInfoFromUsername(username);
+ CheckInInfo checkin_info;
+ if (!checkin_failure_enabled_)
+ checkin_info = GetCheckInInfoFromUsername(username);
base::MessageLoop::current()->PostTask(
FROM_HERE,
- base::Bind(&GCMClientMock::AddUserFinished,
+ base::Bind(&GCMClientMock::CheckInFinished,
base::Unretained(this),
username,
checkin_info));
@@ -149,9 +151,9 @@
return iter->second;
}
-void GCMClientMock::AddUserFinished(std::string username,
+void GCMClientMock::CheckInFinished(std::string username,
CheckInInfo checkin_info) {
- GetDelegate(username)->OnAddUserFinished(
+ GetDelegate(username)->OnCheckInFinished(
checkin_info, checkin_info.IsValid() ? SUCCESS : SERVER_ERROR);
}