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

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

Issue 1414313002: Allow dynamic updating of authentication policies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error on Windows and component build link error Created 5 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
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>
(...skipping 20 matching lines...) Expand all
31 #include "google_apis/gcm/engine/checkin_request.h" 31 #include "google_apis/gcm/engine/checkin_request.h"
32 #include "google_apis/gcm/engine/connection_factory_impl.h" 32 #include "google_apis/gcm/engine/connection_factory_impl.h"
33 #include "google_apis/gcm/engine/gcm_store_impl.h" 33 #include "google_apis/gcm/engine/gcm_store_impl.h"
34 #include "google_apis/gcm/engine/gservices_settings.h" 34 #include "google_apis/gcm/engine/gservices_settings.h"
35 #include "google_apis/gcm/engine/mcs_client.h" 35 #include "google_apis/gcm/engine/mcs_client.h"
36 #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h" 36 #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h"
37 #include "net/base/host_mapping_rules.h" 37 #include "net/base/host_mapping_rules.h"
38 #include "net/cert/cert_verifier.h" 38 #include "net/cert/cert_verifier.h"
39 #include "net/dns/host_resolver.h" 39 #include "net/dns/host_resolver.h"
40 #include "net/http/http_auth_handler_factory.h" 40 #include "net/http/http_auth_handler_factory.h"
41 #include "net/http/http_auth_preferences.h"
42 #include "net/http/http_auth_scheme.h"
41 #include "net/http/http_network_session.h" 43 #include "net/http/http_network_session.h"
42 #include "net/http/http_server_properties_impl.h" 44 #include "net/http/http_server_properties_impl.h"
43 #include "net/http/transport_security_state.h" 45 #include "net/http/transport_security_state.h"
44 #include "net/log/write_to_file_net_log_observer.h" 46 #include "net/log/write_to_file_net_log_observer.h"
45 #include "net/socket/client_socket_factory.h" 47 #include "net/socket/client_socket_factory.h"
46 #include "net/socket/ssl_client_socket.h" 48 #include "net/socket/ssl_client_socket.h"
47 #include "net/ssl/channel_id_service.h" 49 #include "net/ssl/channel_id_service.h"
48 #include "net/ssl/default_channel_id_store.h" 50 #include "net/ssl/default_channel_id_store.h"
49 #include "net/url_request/url_request_test_util.h" 51 #include "net/url_request/url_request_test_util.h"
50 52
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 int flags, 178 int flags,
177 net::CRLSet* crl_set, 179 net::CRLSet* crl_set,
178 net::CertVerifyResult* verify_result, 180 net::CertVerifyResult* verify_result,
179 const net::CompletionCallback& callback, 181 const net::CompletionCallback& callback,
180 scoped_ptr<Request>* out_req, 182 scoped_ptr<Request>* out_req,
181 const net::BoundNetLog& net_log) override { 183 const net::BoundNetLog& net_log) override {
182 return net::OK; 184 return net::OK;
183 } 185 }
184 }; 186 };
185 187
188 class MCSProbeAuthPreferences : public net::HttpAuthPreferences {
189 std::vector<std::string> auth_schemes() const override {
190 return std::vector<std::string>(1, net::kBasicAuthScheme);
191 }
192 bool negotiate_disable_cname_lookup() const override { return false; }
193 bool negotiate_enable_port() const override { return false; }
194 bool CanUseDefaultCredentials(const GURL& auth_origin) const override {
195 return false;
196 }
197 bool CanDelegate(const GURL& auth_origin) const override { return false; }
198 };
199
186 class MCSProbe { 200 class MCSProbe {
187 public: 201 public:
188 MCSProbe( 202 MCSProbe(
189 const base::CommandLine& command_line, 203 const base::CommandLine& command_line,
190 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter); 204 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter);
191 ~MCSProbe(); 205 ~MCSProbe();
192 206
193 void Start(); 207 void Start();
194 208
195 uint64 android_id() const { return android_id_; } 209 uint64 android_id() const { return android_id_; }
(...skipping 22 matching lines...) Expand all
218 int server_port_; 232 int server_port_;
219 233
220 // Network state. 234 // Network state.
221 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 235 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
222 net::NetLog net_log_; 236 net::NetLog net_log_;
223 scoped_ptr<net::WriteToFileNetLogObserver> logger_; 237 scoped_ptr<net::WriteToFileNetLogObserver> logger_;
224 scoped_ptr<net::HostResolver> host_resolver_; 238 scoped_ptr<net::HostResolver> host_resolver_;
225 scoped_ptr<net::CertVerifier> cert_verifier_; 239 scoped_ptr<net::CertVerifier> cert_verifier_;
226 scoped_ptr<net::ChannelIDService> system_channel_id_service_; 240 scoped_ptr<net::ChannelIDService> system_channel_id_service_;
227 scoped_ptr<net::TransportSecurityState> transport_security_state_; 241 scoped_ptr<net::TransportSecurityState> transport_security_state_;
228 scoped_ptr<net::URLSecurityManager> url_security_manager_; 242 MCSProbeAuthPreferences http_auth_preferences;
229 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory_; 243 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory_;
230 scoped_ptr<net::HttpServerPropertiesImpl> http_server_properties_; 244 scoped_ptr<net::HttpServerPropertiesImpl> http_server_properties_;
231 scoped_ptr<net::HostMappingRules> host_mapping_rules_; 245 scoped_ptr<net::HostMappingRules> host_mapping_rules_;
232 scoped_ptr<net::HttpNetworkSession> network_session_; 246 scoped_ptr<net::HttpNetworkSession> network_session_;
233 scoped_ptr<net::ProxyService> proxy_service_; 247 scoped_ptr<net::ProxyService> proxy_service_;
234 248
235 FakeGCMStatsRecorder recorder_; 249 FakeGCMStatsRecorder recorder_;
236 scoped_ptr<GCMStore> gcm_store_; 250 scoped_ptr<GCMStore> gcm_store_;
237 scoped_ptr<MCSClient> mcs_client_; 251 scoped_ptr<MCSClient> mcs_client_;
238 scoped_ptr<CheckinRequest> checkin_request_; 252 scoped_ptr<CheckinRequest> checkin_request_;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 cert_verifier_.reset(new MyTestCertVerifier()); 383 cert_verifier_.reset(new MyTestCertVerifier());
370 } else { 384 } else {
371 cert_verifier_ = net::CertVerifier::CreateDefault(); 385 cert_verifier_ = net::CertVerifier::CreateDefault();
372 } 386 }
373 system_channel_id_service_.reset( 387 system_channel_id_service_.reset(
374 new net::ChannelIDService( 388 new net::ChannelIDService(
375 new net::DefaultChannelIDStore(NULL), 389 new net::DefaultChannelIDStore(NULL),
376 base::WorkerPool::GetTaskRunner(true))); 390 base::WorkerPool::GetTaskRunner(true)));
377 391
378 transport_security_state_.reset(new net::TransportSecurityState()); 392 transport_security_state_.reset(new net::TransportSecurityState());
379 url_security_manager_.reset(net::URLSecurityManager::Create(NULL, NULL)); 393 http_auth_handler_factory_ = net::HttpAuthHandlerRegistryFactory::Create(
380 http_auth_handler_factory_.reset(net::HttpAuthHandlerRegistryFactory::Create( 394 &http_auth_preferences, host_resolver_.get())
381 std::vector<std::string>(1, "basic"), url_security_manager_.get(), 395 .Pass();
382 host_resolver_.get(), std::string(), std::string(), false, false));
383 http_server_properties_.reset(new net::HttpServerPropertiesImpl()); 396 http_server_properties_.reset(new net::HttpServerPropertiesImpl());
384 host_mapping_rules_.reset(new net::HostMappingRules()); 397 host_mapping_rules_.reset(new net::HostMappingRules());
385 proxy_service_ = net::ProxyService::CreateDirectWithNetLog(&net_log_); 398 proxy_service_ = net::ProxyService::CreateDirectWithNetLog(&net_log_);
386 } 399 }
387 400
388 void MCSProbe::BuildNetworkSession() { 401 void MCSProbe::BuildNetworkSession() {
389 net::HttpNetworkSession::Params session_params; 402 net::HttpNetworkSession::Params session_params;
390 session_params.host_resolver = host_resolver_.get(); 403 session_params.host_resolver = host_resolver_.get();
391 session_params.cert_verifier = cert_verifier_.get(); 404 session_params.cert_verifier = cert_verifier_.get();
392 session_params.channel_id_service = system_channel_id_service_.get(); 405 session_params.channel_id_service = system_channel_id_service_.get();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 503
491 return 0; 504 return 0;
492 } 505 }
493 506
494 } // namespace 507 } // namespace
495 } // namespace gcm 508 } // namespace gcm
496 509
497 int main(int argc, char* argv[]) { 510 int main(int argc, char* argv[]) {
498 return gcm::MCSProbeMain(argc, argv); 511 return gcm::MCSProbeMain(argc, argv);
499 } 512 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698