OLD | NEW |
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/values.h" | 25 #include "base/values.h" |
26 #include "google_apis/gcm/base/fake_encryptor.h" | |
27 #include "google_apis/gcm/base/mcs_message.h" | 26 #include "google_apis/gcm/base/mcs_message.h" |
28 #include "google_apis/gcm/base/mcs_util.h" | 27 #include "google_apis/gcm/base/mcs_util.h" |
29 #include "google_apis/gcm/engine/checkin_request.h" | 28 #include "google_apis/gcm/engine/checkin_request.h" |
30 #include "google_apis/gcm/engine/connection_factory_impl.h" | 29 #include "google_apis/gcm/engine/connection_factory_impl.h" |
31 #include "google_apis/gcm/engine/gcm_store_impl.h" | 30 #include "google_apis/gcm/engine/gcm_store_impl.h" |
32 #include "google_apis/gcm/engine/gservices_settings.h" | 31 #include "google_apis/gcm/engine/gservices_settings.h" |
33 #include "google_apis/gcm/engine/mcs_client.h" | 32 #include "google_apis/gcm/engine/mcs_client.h" |
34 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h" | 33 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h" |
35 #include "net/base/host_mapping_rules.h" | 34 #include "net/base/host_mapping_rules.h" |
36 #include "net/base/net_log_logger.h" | 35 #include "net/base/net_log_logger.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 net::HostPortPair(server_host_, | 299 net::HostPortPair(server_host_, |
301 server_port_).ToString())); | 300 server_port_).ToString())); |
302 connection_factory_.reset( | 301 connection_factory_.reset( |
303 new ConnectionFactoryImpl(endpoints, | 302 new ConnectionFactoryImpl(endpoints, |
304 kDefaultBackoffPolicy, | 303 kDefaultBackoffPolicy, |
305 network_session_, | 304 network_session_, |
306 &net_log_, | 305 &net_log_, |
307 &recorder_)); | 306 &recorder_)); |
308 gcm_store_.reset( | 307 gcm_store_.reset( |
309 new GCMStoreImpl(gcm_store_path_, | 308 new GCMStoreImpl(gcm_store_path_, |
310 file_thread_.message_loop_proxy(), | 309 file_thread_.message_loop_proxy())); |
311 make_scoped_ptr<Encryptor>(new FakeEncryptor))); | |
312 mcs_client_.reset(new MCSClient("probe", | 310 mcs_client_.reset(new MCSClient("probe", |
313 &clock_, | 311 &clock_, |
314 connection_factory_.get(), | 312 connection_factory_.get(), |
315 gcm_store_.get(), | 313 gcm_store_.get(), |
316 &recorder_)); | 314 &recorder_)); |
317 run_loop_.reset(new base::RunLoop()); | 315 run_loop_.reset(new base::RunLoop()); |
318 gcm_store_->Load(base::Bind(&MCSProbe::LoadCallback, | 316 gcm_store_->Load(base::Bind(&MCSProbe::LoadCallback, |
319 base::Unretained(this))); | 317 base::Unretained(this))); |
320 run_loop_->Run(); | 318 run_loop_->Run(); |
321 } | 319 } |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 | 497 |
500 return 0; | 498 return 0; |
501 } | 499 } |
502 | 500 |
503 } // namespace | 501 } // namespace |
504 } // namespace gcm | 502 } // namespace gcm |
505 | 503 |
506 int main(int argc, char* argv[]) { | 504 int main(int argc, char* argv[]) { |
507 return gcm::MCSProbeMain(argc, argv); | 505 return gcm::MCSProbeMain(argc, argv); |
508 } | 506 } |
OLD | NEW |