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> |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 net::NetLog net_log_; | 222 net::NetLog net_log_; |
223 scoped_ptr<net::WriteToFileNetLogObserver> logger_; | 223 scoped_ptr<net::WriteToFileNetLogObserver> logger_; |
224 scoped_ptr<net::HostResolver> host_resolver_; | 224 scoped_ptr<net::HostResolver> host_resolver_; |
225 scoped_ptr<net::CertVerifier> cert_verifier_; | 225 scoped_ptr<net::CertVerifier> cert_verifier_; |
226 scoped_ptr<net::ChannelIDService> system_channel_id_service_; | 226 scoped_ptr<net::ChannelIDService> system_channel_id_service_; |
227 scoped_ptr<net::TransportSecurityState> transport_security_state_; | 227 scoped_ptr<net::TransportSecurityState> transport_security_state_; |
228 scoped_ptr<net::URLSecurityManager> url_security_manager_; | 228 scoped_ptr<net::URLSecurityManager> url_security_manager_; |
229 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory_; | 229 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory_; |
230 scoped_ptr<net::HttpServerPropertiesImpl> http_server_properties_; | 230 scoped_ptr<net::HttpServerPropertiesImpl> http_server_properties_; |
231 scoped_ptr<net::HostMappingRules> host_mapping_rules_; | 231 scoped_ptr<net::HostMappingRules> host_mapping_rules_; |
232 scoped_ptr<net::HttpNetworkSession> network_session_; | 232 scoped_refptr<net::HttpNetworkSession> network_session_; |
233 scoped_ptr<net::ProxyService> proxy_service_; | 233 scoped_ptr<net::ProxyService> proxy_service_; |
234 | 234 |
235 FakeGCMStatsRecorder recorder_; | 235 FakeGCMStatsRecorder recorder_; |
236 scoped_ptr<GCMStore> gcm_store_; | 236 scoped_ptr<GCMStore> gcm_store_; |
237 scoped_ptr<MCSClient> mcs_client_; | 237 scoped_ptr<MCSClient> mcs_client_; |
238 scoped_ptr<CheckinRequest> checkin_request_; | 238 scoped_ptr<CheckinRequest> checkin_request_; |
239 | 239 |
240 scoped_ptr<ConnectionFactoryImpl> connection_factory_; | 240 scoped_ptr<ConnectionFactoryImpl> connection_factory_; |
241 | 241 |
242 base::Thread file_thread_; | 242 base::Thread file_thread_; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 file_thread_.Start(); | 286 file_thread_.Start(); |
287 InitializeNetworkState(); | 287 InitializeNetworkState(); |
288 BuildNetworkSession(); | 288 BuildNetworkSession(); |
289 std::vector<GURL> endpoints(1, | 289 std::vector<GURL> endpoints(1, |
290 GURL("https://" + | 290 GURL("https://" + |
291 net::HostPortPair(server_host_, | 291 net::HostPortPair(server_host_, |
292 server_port_).ToString())); | 292 server_port_).ToString())); |
293 connection_factory_.reset( | 293 connection_factory_.reset( |
294 new ConnectionFactoryImpl(endpoints, | 294 new ConnectionFactoryImpl(endpoints, |
295 kDefaultBackoffPolicy, | 295 kDefaultBackoffPolicy, |
296 network_session_.get(), | 296 network_session_, |
297 NULL, | 297 NULL, |
298 &net_log_, | 298 &net_log_, |
299 &recorder_)); | 299 &recorder_)); |
300 gcm_store_.reset( | 300 gcm_store_.reset( |
301 new GCMStoreImpl(gcm_store_path_, | 301 new GCMStoreImpl(gcm_store_path_, |
302 file_thread_.task_runner(), | 302 file_thread_.task_runner(), |
303 make_scoped_ptr<Encryptor>(new FakeEncryptor))); | 303 make_scoped_ptr<Encryptor>(new FakeEncryptor))); |
304 mcs_client_.reset(new MCSClient("probe", | 304 mcs_client_.reset(new MCSClient("probe", |
305 &clock_, | 305 &clock_, |
306 connection_factory_.get(), | 306 connection_factory_.get(), |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 session_params.http_server_properties = | 396 session_params.http_server_properties = |
397 http_server_properties_->GetWeakPtr(); | 397 http_server_properties_->GetWeakPtr(); |
398 session_params.network_delegate = NULL; // TODO(zea): implement? | 398 session_params.network_delegate = NULL; // TODO(zea): implement? |
399 session_params.host_mapping_rules = host_mapping_rules_.get(); | 399 session_params.host_mapping_rules = host_mapping_rules_.get(); |
400 session_params.ignore_certificate_errors = true; | 400 session_params.ignore_certificate_errors = true; |
401 session_params.testing_fixed_http_port = 0; | 401 session_params.testing_fixed_http_port = 0; |
402 session_params.testing_fixed_https_port = 0; | 402 session_params.testing_fixed_https_port = 0; |
403 session_params.net_log = &net_log_; | 403 session_params.net_log = &net_log_; |
404 session_params.proxy_service = proxy_service_.get(); | 404 session_params.proxy_service = proxy_service_.get(); |
405 | 405 |
406 network_session_.reset(new net::HttpNetworkSession(session_params)); | 406 network_session_ = new net::HttpNetworkSession(session_params); |
407 } | 407 } |
408 | 408 |
409 void MCSProbe::ErrorCallback() { | 409 void MCSProbe::ErrorCallback() { |
410 LOG(INFO) << "MCS error happened"; | 410 LOG(INFO) << "MCS error happened"; |
411 } | 411 } |
412 | 412 |
413 void MCSProbe::CheckIn() { | 413 void MCSProbe::CheckIn() { |
414 LOG(INFO) << "Check-in request initiated."; | 414 LOG(INFO) << "Check-in request initiated."; |
415 checkin_proto::ChromeBuildProto chrome_build_proto; | 415 checkin_proto::ChromeBuildProto chrome_build_proto; |
416 chrome_build_proto.set_platform( | 416 chrome_build_proto.set_platform( |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 | 490 |
491 return 0; | 491 return 0; |
492 } | 492 } |
493 | 493 |
494 } // namespace | 494 } // namespace |
495 } // namespace gcm | 495 } // namespace gcm |
496 | 496 |
497 int main(int argc, char* argv[]) { | 497 int main(int argc, char* argv[]) { |
498 return gcm::MCSProbeMain(argc, argv); | 498 return gcm::MCSProbeMain(argc, argv); |
499 } | 499 } |
OLD | NEW |