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