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

Side by Side Diff: chrome/browser/services/gcm/gcm_client_mock.cc

Issue 183013007: [GCM] Stop/restart GCM when the state is forced off/on (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch to land Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/gcm_client_mock.h" 5 #include "chrome/browser/services/gcm/gcm_client_mock.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/sys_byteorder.h" 10 #include "base/sys_byteorder.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 47
48 void GCMClientMock::DoLoading() { 48 void GCMClientMock::DoLoading() {
49 status_ = LOADED; 49 status_ = LOADED;
50 base::MessageLoop::current()->PostTask( 50 base::MessageLoop::current()->PostTask(
51 FROM_HERE, 51 FROM_HERE,
52 base::Bind(&GCMClientMock::CheckinFinished, 52 base::Bind(&GCMClientMock::CheckinFinished,
53 weak_ptr_factory_.GetWeakPtr())); 53 weak_ptr_factory_.GetWeakPtr()));
54 } 54 }
55 55
56 void GCMClientMock::Stop() {
57 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
58 status_ = STOPPED;
59 }
60
56 void GCMClientMock::CheckOut() { 61 void GCMClientMock::CheckOut() {
57 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 62 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
58 status_ = CHECKED_OUT; 63 status_ = CHECKED_OUT;
59 } 64 }
60 65
61 void GCMClientMock::Register(const std::string& app_id, 66 void GCMClientMock::Register(const std::string& app_id,
62 const std::string& cert, 67 const std::string& cert,
63 const std::vector<std::string>& sender_ids) { 68 const std::vector<std::string>& sender_ids) {
64 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 69 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
65 70
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 delegate_->OnMessagesDeleted(app_id); 188 delegate_->OnMessagesDeleted(app_id);
184 } 189 }
185 190
186 void GCMClientMock::MessageSendError(const std::string& app_id, 191 void GCMClientMock::MessageSendError(const std::string& app_id,
187 const std::string& message_id) { 192 const std::string& message_id) {
188 if (delegate_) 193 if (delegate_)
189 delegate_->OnMessageSendError(app_id, message_id, NETWORK_ERROR); 194 delegate_->OnMessageSendError(app_id, message_id, NETWORK_ERROR);
190 } 195 }
191 196
192 } // namespace gcm 197 } // namespace gcm
OLDNEW
« no previous file with comments | « chrome/browser/services/gcm/gcm_client_mock.h ('k') | chrome/browser/services/gcm/gcm_profile_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698