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

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

Issue 612023003: Make --log-net-log and NetLogLogger hide cookies by default, (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix new test Created 6 years, 2 months 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 context_.reset(new MyTestURLRequestContext()); 155 context_.reset(new MyTestURLRequestContext());
156 return context_.get(); 156 return context_.get();
157 } 157 }
158 158
159 private: 159 private:
160 virtual ~MyTestURLRequestContextGetter() {} 160 virtual ~MyTestURLRequestContextGetter() {}
161 161
162 scoped_ptr<MyTestURLRequestContext> context_; 162 scoped_ptr<MyTestURLRequestContext> context_;
163 }; 163 };
164 164
165 // A net log that logs all events by default.
166 class MyTestNetLog : public net::NetLog {
167 public:
168 MyTestNetLog() {
169 SetBaseLogLevel(LOG_ALL);
170 }
171 virtual ~MyTestNetLog() {}
172 };
173
174 // A cert verifier that access all certificates. 165 // A cert verifier that access all certificates.
175 class MyTestCertVerifier : public net::CertVerifier { 166 class MyTestCertVerifier : public net::CertVerifier {
176 public: 167 public:
177 MyTestCertVerifier() {} 168 MyTestCertVerifier() {}
178 virtual ~MyTestCertVerifier() {} 169 virtual ~MyTestCertVerifier() {}
179 170
180 virtual int Verify(net::X509Certificate* cert, 171 virtual int Verify(net::X509Certificate* cert,
181 const std::string& hostname, 172 const std::string& hostname,
182 int flags, 173 int flags,
183 net::CRLSet* crl_set, 174 net::CRLSet* crl_set,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 CommandLine command_line_; 213 CommandLine command_line_;
223 214
224 base::FilePath gcm_store_path_; 215 base::FilePath gcm_store_path_;
225 uint64 android_id_; 216 uint64 android_id_;
226 uint64 secret_; 217 uint64 secret_;
227 std::string server_host_; 218 std::string server_host_;
228 int server_port_; 219 int server_port_;
229 220
230 // Network state. 221 // Network state.
231 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 222 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
232 MyTestNetLog net_log_; 223 net::NetLog net_log_;
233 scoped_ptr<net::NetLogLogger> logger_; 224 scoped_ptr<net::NetLogLogger> logger_;
234 scoped_ptr<base::Value> net_constants_;
235 scoped_ptr<net::HostResolver> host_resolver_; 225 scoped_ptr<net::HostResolver> host_resolver_;
236 scoped_ptr<net::CertVerifier> cert_verifier_; 226 scoped_ptr<net::CertVerifier> cert_verifier_;
237 scoped_ptr<net::ChannelIDService> system_channel_id_service_; 227 scoped_ptr<net::ChannelIDService> system_channel_id_service_;
238 scoped_ptr<net::TransportSecurityState> transport_security_state_; 228 scoped_ptr<net::TransportSecurityState> transport_security_state_;
239 scoped_ptr<net::URLSecurityManager> url_security_manager_; 229 scoped_ptr<net::URLSecurityManager> url_security_manager_;
240 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory_; 230 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory_;
241 scoped_ptr<net::HttpServerPropertiesImpl> http_server_properties_; 231 scoped_ptr<net::HttpServerPropertiesImpl> http_server_properties_;
242 scoped_ptr<net::HostMappingRules> host_mapping_rules_; 232 scoped_ptr<net::HostMappingRules> host_mapping_rules_;
243 scoped_refptr<net::HttpNetworkSession> network_session_; 233 scoped_refptr<net::HttpNetworkSession> network_session_;
244 scoped_ptr<net::ProxyService> proxy_service_; 234 scoped_ptr<net::ProxyService> proxy_service_;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 void MCSProbe::InitializeNetworkState() { 347 void MCSProbe::InitializeNetworkState() {
358 FILE* log_file = NULL; 348 FILE* log_file = NULL;
359 if (command_line_.HasSwitch(kLogFileSwitch)) { 349 if (command_line_.HasSwitch(kLogFileSwitch)) {
360 base::FilePath log_path = command_line_.GetSwitchValuePath(kLogFileSwitch); 350 base::FilePath log_path = command_line_.GetSwitchValuePath(kLogFileSwitch);
361 #if defined(OS_WIN) 351 #if defined(OS_WIN)
362 log_file = _wfopen(log_path.value().c_str(), L"w"); 352 log_file = _wfopen(log_path.value().c_str(), L"w");
363 #elif defined(OS_POSIX) 353 #elif defined(OS_POSIX)
364 log_file = fopen(log_path.value().c_str(), "w"); 354 log_file = fopen(log_path.value().c_str(), "w");
365 #endif 355 #endif
366 } 356 }
367 net_constants_.reset(net::NetLogLogger::GetConstants());
368 if (log_file != NULL) { 357 if (log_file != NULL) {
369 logger_.reset(new net::NetLogLogger(log_file, *net_constants_)); 358 scoped_ptr<base::Value> net_constants(net::NetLogLogger::GetConstants());
359 logger_.reset(new net::NetLogLogger(log_file, *net_constants));
360 logger_->set_log_level(net::NetLog::LOG_ALL_BUT_BYTES);
370 logger_->StartObserving(&net_log_); 361 logger_->StartObserving(&net_log_);
371 } 362 }
372 363
373 host_resolver_ = net::HostResolver::CreateDefaultResolver(&net_log_); 364 host_resolver_ = net::HostResolver::CreateDefaultResolver(&net_log_);
374 365
375 if (command_line_.HasSwitch(kIgnoreCertSwitch)) { 366 if (command_line_.HasSwitch(kIgnoreCertSwitch)) {
376 cert_verifier_.reset(new MyTestCertVerifier()); 367 cert_verifier_.reset(new MyTestCertVerifier());
377 } else { 368 } else {
378 cert_verifier_.reset(net::CertVerifier::CreateDefault()); 369 cert_verifier_.reset(net::CertVerifier::CreateDefault());
379 } 370 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 492
502 return 0; 493 return 0;
503 } 494 }
504 495
505 } // namespace 496 } // namespace
506 } // namespace gcm 497 } // namespace gcm
507 498
508 int main(int argc, char* argv[]) { 499 int main(int argc, char* argv[]) {
509 return gcm::MCSProbeMain(argc, argv); 500 return gcm::MCSProbeMain(argc, argv);
510 } 501 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698