Commit a47c03d6 authored by alexeypa@chromium.org's avatar alexeypa@chromium.org

Log Gaia response codes and Gaia-related networking activity to ease diagnostics of Gaia issues.


Review URL: http://codereview.chromium.org/10069020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132493 0039d316-1c4b-4281-b951-d872f2087c98
parent fdebd1bc
...@@ -135,6 +135,7 @@ void GaiaOAuthClient::Core::HandleResponse( ...@@ -135,6 +135,7 @@ void GaiaOAuthClient::Core::HandleResponse(
// RC_BAD_REQUEST means the arguments are invalid. No point retrying. We are // RC_BAD_REQUEST means the arguments are invalid. No point retrying. We are
// done here. // done here.
if (source->GetResponseCode() == net::HTTP_BAD_REQUEST) { if (source->GetResponseCode() == net::HTTP_BAD_REQUEST) {
LOG(ERROR) << "Gaia response: response code=net::HTTP_BAD_REQUEST.";
delegate_->OnOAuthError(); delegate_->OnOAuthError();
return; return;
} }
...@@ -153,6 +154,11 @@ void GaiaOAuthClient::Core::HandleResponse( ...@@ -153,6 +154,11 @@ void GaiaOAuthClient::Core::HandleResponse(
response_dict->GetString(kRefreshTokenValue, &refresh_token); response_dict->GetString(kRefreshTokenValue, &refresh_token);
response_dict->GetInteger(kExpiresInValue, &expires_in_seconds); response_dict->GetInteger(kExpiresInValue, &expires_in_seconds);
} }
VLOG(1) << "Gaia response: acess_token='" << access_token
<< "', refresh_token='" << refresh_token
<< "', expires in " << expires_in_seconds << " second(s)";
} else {
LOG(ERROR) << "Gaia response: response code=" << source->GetResponseCode();
} }
if (access_token.empty()) { if (access_token.empty()) {
// If we don't have an access token yet and the the error was not // If we don't have an access token yet and the the error was not
......
...@@ -22,12 +22,14 @@ namespace remoting { ...@@ -22,12 +22,14 @@ namespace remoting {
URLRequestContext::URLRequestContext( URLRequestContext::URLRequestContext(
net::ProxyConfigService* proxy_config_service) net::ProxyConfigService* proxy_config_service)
: ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) {
net_log_.reset(new VlogNetLog());
storage_.set_host_resolver( storage_.set_host_resolver(
net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism,
net::HostResolver::kDefaultRetryAttempts, net::HostResolver::kDefaultRetryAttempts,
NULL)); net_log_.get()));
storage_.set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver( storage_.set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver(
proxy_config_service, 0u, NULL)); proxy_config_service, 0u, net_log_.get()));
storage_.set_cert_verifier(net::CertVerifier::CreateDefault()); storage_.set_cert_verifier(net::CertVerifier::CreateDefault());
storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults); storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults);
storage_.set_http_auth_handler_factory( storage_.set_http_auth_handler_factory(
...@@ -41,6 +43,7 @@ URLRequestContext::URLRequestContext( ...@@ -41,6 +43,7 @@ URLRequestContext::URLRequestContext(
session_params.ssl_config_service = ssl_config_service(); session_params.ssl_config_service = ssl_config_service();
session_params.http_auth_handler_factory = http_auth_handler_factory(); session_params.http_auth_handler_factory = http_auth_handler_factory();
session_params.http_server_properties = http_server_properties(); session_params.http_server_properties = http_server_properties();
session_params.net_log = net_log_.get();
scoped_refptr<net::HttpNetworkSession> network_session( scoped_refptr<net::HttpNetworkSession> network_session(
new net::HttpNetworkSession(session_params)); new net::HttpNetworkSession(session_params));
storage_.set_http_transaction_factory( storage_.set_http_transaction_factory(
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_context_storage.h" #include "net/url_request/url_request_context_storage.h"
#include "remoting/host/vlog_net_log.h"
namespace base { namespace base {
class MessageLoopProxy; class MessageLoopProxy;
...@@ -32,6 +33,7 @@ class URLRequestContext : public net::URLRequestContext { ...@@ -32,6 +33,7 @@ class URLRequestContext : public net::URLRequestContext {
virtual ~URLRequestContext(); virtual ~URLRequestContext();
net::URLRequestContextStorage storage_; net::URLRequestContextStorage storage_;
scoped_ptr<VlogNetLog> net_log_;
DISALLOW_COPY_AND_ASSIGN(URLRequestContext); DISALLOW_COPY_AND_ASSIGN(URLRequestContext);
}; };
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "remoting/host/vlog_net_log.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
#include "base/threading/thread_restrictions.h"
#include "base/values.h"
namespace remoting {
VlogNetLog::VlogNetLog() : id_(0) {
}
VlogNetLog::~VlogNetLog() {
}
void VlogNetLog::AddEntry(
EventType type,
const Source& source,
EventPhase phase,
const scoped_refptr<EventParameters>& params) {
if (VLOG_IS_ON(4)) {
scoped_ptr<Value> value(
net::NetLog::EntryToDictionaryValue(
type, base::TimeTicks::Now(), source, phase, params, false));
std::string json;
base::JSONWriter::Write(value.get(), &json);
VLOG(4) << json;
}
}
uint32 VlogNetLog::NextID() {
return id_++;
}
net::NetLog::LogLevel VlogNetLog::GetLogLevel() const {
return LOG_ALL_BUT_BYTES;
}
void VlogNetLog::AddThreadSafeObserver(ThreadSafeObserver* observer,
net::NetLog::LogLevel log_level) {
NOTIMPLEMENTED();
}
void VlogNetLog::SetObserverLogLevel(ThreadSafeObserver* observer,
net::NetLog::LogLevel log_level) {
NOTIMPLEMENTED();
}
void VlogNetLog::RemoveThreadSafeObserver(ThreadSafeObserver* observer) {
NOTIMPLEMENTED();
}
} // namespace remoting
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_HOST_VLOG_NET_LOG_H_
#define REMOTING_HOST_VLOG_NET_LOG_H_
#include "base/memory/scoped_handle.h"
#include "net/base/net_log.h"
namespace remoting {
// Redirectes all networking events (i.e. events logged through net::NetLog) to
// VLOG(4). Note that an explicit reference to a net::NetLog object has to be
// passed to networking classes to receive the events. There is no global
// network events logger exists.
class VlogNetLog : public net::NetLog {
public:
VlogNetLog();
virtual ~VlogNetLog();
// NetLog overrides:
virtual void AddEntry(
EventType type,
const Source& source,
EventPhase phase,
const scoped_refptr<NetLog::EventParameters>& params) OVERRIDE;
virtual uint32 NextID() OVERRIDE;
virtual LogLevel GetLogLevel() const OVERRIDE;
virtual void AddThreadSafeObserver(ThreadSafeObserver* observer,
LogLevel log_level) OVERRIDE;
virtual void SetObserverLogLevel(ThreadSafeObserver* observer,
LogLevel log_level) OVERRIDE;
virtual void RemoveThreadSafeObserver(ThreadSafeObserver* observer) OVERRIDE;
private:
uint32 id_;
DISALLOW_COPY_AND_ASSIGN(VlogNetLog);
};
} // namespace remoting
#endif // REMOTING_HOST_VLOG_NET_LOG_H_
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <sddl.h> #include <sddl.h>
#include <limits> #include <limits>
#include "base/base_switches.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/command_line.h" #include "base/command_line.h"
...@@ -56,7 +57,8 @@ const char kChromotingIpcSwitchName[] = "chromoting-ipc"; ...@@ -56,7 +57,8 @@ const char kChromotingIpcSwitchName[] = "chromoting-ipc";
// The command line parameters that should be copied from the service's command // The command line parameters that should be copied from the service's command
// line to the host process. // line to the host process.
const char* kCopiedSwitchNames[] = { "auth-config", "host-config" }; const char* kCopiedSwitchNames[] = {
"auth-config", "host-config", switches::kV, switches::kVModule };
// The security descriptor of the Chromoting IPC channel. It gives full access // The security descriptor of the Chromoting IPC channel. It gives full access
// to LocalSystem and denies access by anyone else. // to LocalSystem and denies access by anyone else.
......
...@@ -297,6 +297,7 @@ ...@@ -297,6 +297,7 @@
'variables': { 'enable_wexit_time_destructors': 1, }, 'variables': { 'enable_wexit_time_destructors': 1, },
'dependencies': [ 'dependencies': [
'../base/base.gyp:base', '../base/base.gyp:base',
'../base/base.gyp:base_static',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../ipc/ipc.gyp:ipc', '../ipc/ipc.gyp:ipc',
'remoting_version_resources', 'remoting_version_resources',
...@@ -893,6 +894,8 @@ ...@@ -893,6 +894,8 @@
'host/user_authenticator_linux.cc', 'host/user_authenticator_linux.cc',
'host/user_authenticator_mac.cc', 'host/user_authenticator_mac.cc',
'host/user_authenticator_win.cc', 'host/user_authenticator_win.cc',
'host/vlog_net_log.cc',
'host/vlog_net_log.h',
], ],
'conditions': [ 'conditions': [
['toolkit_uses_gtk == 1', { ['toolkit_uses_gtk == 1', {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment