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

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

Issue 176823009: Show device information in chrome://gcm-internals page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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
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"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 #include "google_apis/gcm/gcm_client.h"
13 14
14 namespace gcm { 15 namespace gcm {
15 16
16 GCMClientMock::GCMClientMock(LoadingDelay loading_delay, 17 GCMClientMock::GCMClientMock(LoadingDelay loading_delay,
17 ErrorSimulation error_simulation) 18 ErrorSimulation error_simulation)
18 : delegate_(NULL), 19 : delegate_(NULL),
19 status_(UNINITIALIZED), 20 status_(UNINITIALIZED),
20 loading_delay_(loading_delay), 21 loading_delay_(loading_delay),
21 error_simulation_(error_simulation), 22 error_simulation_(error_simulation),
22 weak_ptr_factory_(this) { 23 weak_ptr_factory_(this) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 85 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
85 86
86 base::MessageLoop::current()->PostTask( 87 base::MessageLoop::current()->PostTask(
87 FROM_HERE, 88 FROM_HERE,
88 base::Bind(&GCMClientMock::SendFinished, 89 base::Bind(&GCMClientMock::SendFinished,
89 weak_ptr_factory_.GetWeakPtr(), 90 weak_ptr_factory_.GetWeakPtr(),
90 app_id, 91 app_id,
91 message.id)); 92 message.id));
92 } 93 }
93 94
95 GCMClient::GCMStatistics GCMClientMock::GetStatistics() const {
96 return stats_;
97 }
98
94 void GCMClientMock::PerformDelayedLoading() { 99 void GCMClientMock::PerformDelayedLoading() {
95 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 100 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
96 101
97 content::BrowserThread::PostTask( 102 content::BrowserThread::PostTask(
98 content::BrowserThread::IO, 103 content::BrowserThread::IO,
99 FROM_HERE, 104 FROM_HERE,
100 base::Bind(&GCMClientMock::DoLoading, weak_ptr_factory_.GetWeakPtr())); 105 base::Bind(&GCMClientMock::DoLoading, weak_ptr_factory_.GetWeakPtr()));
101 } 106 }
102 107
103 void GCMClientMock::ReceiveMessage(const std::string& app_id, 108 void GCMClientMock::ReceiveMessage(const std::string& app_id,
(...skipping 79 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

Powered by Google App Engine
This is Rietveld 408576698