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

Side by Side Diff: google_apis/gcm/tools/mcs_probe.cc

Issue 745123002: Link GCM heartbeat with wake on wifi preference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missing include Created 6 years 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
« no previous file with comments | « google_apis/gcm/engine/mcs_client_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // A standalone tool for testing MCS connections and the MCS client on their 5 // A standalone tool for testing MCS connections and the MCS client on their
6 // own. 6 // own.
7 7
8 #include <cstddef> 8 #include <cstddef>
9 #include <cstdio> 9 #include <cstdio>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/at_exit.h" 13 #include "base/at_exit.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/message_loop/message_loop.h" 19 #include "base/message_loop/message_loop.h"
20 #include "base/run_loop.h" 20 #include "base/run_loop.h"
21 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
22 #include "base/threading/thread.h" 22 #include "base/threading/thread.h"
23 #include "base/threading/worker_pool.h" 23 #include "base/threading/worker_pool.h"
24 #include "base/time/default_clock.h" 24 #include "base/time/default_clock.h"
25 #include "base/timer/timer.h"
26 #include "base/values.h" 25 #include "base/values.h"
27 #include "google_apis/gcm/base/fake_encryptor.h" 26 #include "google_apis/gcm/base/fake_encryptor.h"
28 #include "google_apis/gcm/base/mcs_message.h" 27 #include "google_apis/gcm/base/mcs_message.h"
29 #include "google_apis/gcm/base/mcs_util.h" 28 #include "google_apis/gcm/base/mcs_util.h"
30 #include "google_apis/gcm/engine/checkin_request.h" 29 #include "google_apis/gcm/engine/checkin_request.h"
31 #include "google_apis/gcm/engine/connection_factory_impl.h" 30 #include "google_apis/gcm/engine/connection_factory_impl.h"
32 #include "google_apis/gcm/engine/gcm_store_impl.h" 31 #include "google_apis/gcm/engine/gcm_store_impl.h"
33 #include "google_apis/gcm/engine/gservices_settings.h" 32 #include "google_apis/gcm/engine/gservices_settings.h"
34 #include "google_apis/gcm/engine/mcs_client.h" 33 #include "google_apis/gcm/engine/mcs_client.h"
35 #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h" 34 #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 &net_log_, 297 &net_log_,
299 &recorder_)); 298 &recorder_));
300 gcm_store_.reset( 299 gcm_store_.reset(
301 new GCMStoreImpl(gcm_store_path_, 300 new GCMStoreImpl(gcm_store_path_,
302 file_thread_.message_loop_proxy(), 301 file_thread_.message_loop_proxy(),
303 make_scoped_ptr<Encryptor>(new FakeEncryptor))); 302 make_scoped_ptr<Encryptor>(new FakeEncryptor)));
304 mcs_client_.reset(new MCSClient("probe", 303 mcs_client_.reset(new MCSClient("probe",
305 &clock_, 304 &clock_,
306 connection_factory_.get(), 305 connection_factory_.get(),
307 gcm_store_.get(), 306 gcm_store_.get(),
308 &recorder_, 307 &recorder_));
309 make_scoped_ptr(new base::Timer(true,
310 false))));
311 run_loop_.reset(new base::RunLoop()); 308 run_loop_.reset(new base::RunLoop());
312 gcm_store_->Load(base::Bind(&MCSProbe::LoadCallback, 309 gcm_store_->Load(base::Bind(&MCSProbe::LoadCallback,
313 base::Unretained(this))); 310 base::Unretained(this)));
314 run_loop_->Run(); 311 run_loop_->Run();
315 } 312 }
316 313
317 void MCSProbe::LoadCallback(scoped_ptr<GCMStore::LoadResult> load_result) { 314 void MCSProbe::LoadCallback(scoped_ptr<GCMStore::LoadResult> load_result) {
318 DCHECK(load_result->success); 315 DCHECK(load_result->success);
319 if (android_id_ != 0 && secret_ != 0) { 316 if (android_id_ != 0 && secret_ != 0) {
320 DVLOG(1) << "Presetting MCS id " << android_id_; 317 DVLOG(1) << "Presetting MCS id " << android_id_;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 492
496 return 0; 493 return 0;
497 } 494 }
498 495
499 } // namespace 496 } // namespace
500 } // namespace gcm 497 } // namespace gcm
501 498
502 int main(int argc, char* argv[]) { 499 int main(int argc, char* argv[]) {
503 return gcm::MCSProbeMain(argc, argv); 500 return gcm::MCSProbeMain(argc, argv);
504 } 501 }
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/mcs_client_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698