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

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

Issue 641943002: components: Introduce AlarmTimer class and use it for GCM heartbeat (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build error in mcs_probe Created 6 years, 1 month 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"
25 #include "base/values.h" 26 #include "base/values.h"
26 #include "google_apis/gcm/base/fake_encryptor.h" 27 #include "google_apis/gcm/base/fake_encryptor.h"
27 #include "google_apis/gcm/base/mcs_message.h" 28 #include "google_apis/gcm/base/mcs_message.h"
28 #include "google_apis/gcm/base/mcs_util.h" 29 #include "google_apis/gcm/base/mcs_util.h"
29 #include "google_apis/gcm/engine/checkin_request.h" 30 #include "google_apis/gcm/engine/checkin_request.h"
30 #include "google_apis/gcm/engine/connection_factory_impl.h" 31 #include "google_apis/gcm/engine/connection_factory_impl.h"
31 #include "google_apis/gcm/engine/gcm_store_impl.h" 32 #include "google_apis/gcm/engine/gcm_store_impl.h"
32 #include "google_apis/gcm/engine/gservices_settings.h" 33 #include "google_apis/gcm/engine/gservices_settings.h"
33 #include "google_apis/gcm/engine/mcs_client.h" 34 #include "google_apis/gcm/engine/mcs_client.h"
34 #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h" 35 #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 &net_log_, 298 &net_log_,
298 &recorder_)); 299 &recorder_));
299 gcm_store_.reset( 300 gcm_store_.reset(
300 new GCMStoreImpl(gcm_store_path_, 301 new GCMStoreImpl(gcm_store_path_,
301 file_thread_.message_loop_proxy(), 302 file_thread_.message_loop_proxy(),
302 make_scoped_ptr<Encryptor>(new FakeEncryptor))); 303 make_scoped_ptr<Encryptor>(new FakeEncryptor)));
303 mcs_client_.reset(new MCSClient("probe", 304 mcs_client_.reset(new MCSClient("probe",
304 &clock_, 305 &clock_,
305 connection_factory_.get(), 306 connection_factory_.get(),
306 gcm_store_.get(), 307 gcm_store_.get(),
307 &recorder_)); 308 &recorder_,
309 make_scoped_ptr(new base::Timer(true,
310 false))));
308 run_loop_.reset(new base::RunLoop()); 311 run_loop_.reset(new base::RunLoop());
309 gcm_store_->Load(base::Bind(&MCSProbe::LoadCallback, 312 gcm_store_->Load(base::Bind(&MCSProbe::LoadCallback,
310 base::Unretained(this))); 313 base::Unretained(this)));
311 run_loop_->Run(); 314 run_loop_->Run();
312 } 315 }
313 316
314 void MCSProbe::LoadCallback(scoped_ptr<GCMStore::LoadResult> load_result) { 317 void MCSProbe::LoadCallback(scoped_ptr<GCMStore::LoadResult> load_result) {
315 DCHECK(load_result->success); 318 DCHECK(load_result->success);
316 if (android_id_ != 0 && secret_ != 0) { 319 if (android_id_ != 0 && secret_ != 0) {
317 DVLOG(1) << "Presetting MCS id " << android_id_; 320 DVLOG(1) << "Presetting MCS id " << android_id_;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 495
493 return 0; 496 return 0;
494 } 497 }
495 498
496 } // namespace 499 } // namespace
497 } // namespace gcm 500 } // namespace gcm
498 501
499 int main(int argc, char* argv[]) { 502 int main(int argc, char* argv[]) {
500 return gcm::MCSProbeMain(argc, argv); 503 return gcm::MCSProbeMain(argc, argv);
501 } 504 }
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