summaryrefslogtreecommitdiffstats
path: root/net/proxy
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-22 00:38:25 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-22 00:38:25 +0000
commitd3c0fe8bb3b20f03eaa7535daeddc15e83e9cea6 (patch)
tree4acbf33c522f0f60854c826651191afba3fd3cd1 /net/proxy
parenta02c37666ea431312f25cc8f5b98a895c4db4fd7 (diff)
downloadchromium_src-d3c0fe8bb3b20f03eaa7535daeddc15e83e9cea6.zip
chromium_src-d3c0fe8bb3b20f03eaa7535daeddc15e83e9cea6.tar.gz
chromium_src-d3c0fe8bb3b20f03eaa7535daeddc15e83e9cea6.tar.bz2
Move some logging from LOG(INFO) to the LoadLog. These particular ones are for proxy initialization, and are enabled in passive mode since the data will be little.
Review URL: http://codereview.chromium.org/501162 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy')
-rw-r--r--net/proxy/init_proxy_resolver.cc34
-rw-r--r--net/proxy/init_proxy_resolver_unittest.cc35
2 files changed, 40 insertions, 29 deletions
diff --git a/net/proxy/init_proxy_resolver.cc b/net/proxy/init_proxy_resolver.cc
index bd8b444..236e094 100644
--- a/net/proxy/init_proxy_resolver.cc
+++ b/net/proxy/init_proxy_resolver.cc
@@ -5,7 +5,9 @@
#include "net/proxy/init_proxy_resolver.h"
#include "base/compiler_specific.h"
+#include "base/format_macros.h"
#include "base/logging.h"
+#include "base/string_util.h"
#include "net/base/load_log.h"
#include "net/base/net_errors.h"
#include "net/proxy/proxy_config.h"
@@ -127,10 +129,11 @@ int InitProxyResolver::DoFetchPacScript() {
const GURL& pac_url = current_pac_url();
- LOG(INFO) << "Starting fetch of PAC script " << pac_url;
+ LoadLog::AddString(load_log_, pac_url.spec());
if (!proxy_script_fetcher_) {
- LOG(ERROR) << "Can't download PAC script, because no fetcher specified";
+ LoadLog::AddStringLiteral(load_log_,
+ "Can't download PAC script, because no fetcher was specified");
return ERR_UNEXPECTED;
}
@@ -140,13 +143,15 @@ int InitProxyResolver::DoFetchPacScript() {
int InitProxyResolver::DoFetchPacScriptComplete(int result) {
DCHECK(resolver_->expects_pac_bytes());
+ LoadLog::AddString(load_log_,
+ StringPrintf(
+ "Completed fetch with result %s. Received %" PRIuS " bytes",
+ ErrorToString(result),
+ pac_bytes_.size()));
+
LoadLog::EndEvent(load_log_,
LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT);
- LOG(INFO) << "Completed PAC script fetch of " << current_pac_url()
- << " with result " << ErrorToString(result)
- << ". Fetched a total of " << pac_bytes_.size() << " bytes";
-
if (result != OK)
return TryToFallbackPacUrl(result);
@@ -168,14 +173,19 @@ int InitProxyResolver::DoSetPacScript() {
}
int InitProxyResolver::DoSetPacScriptComplete(int result) {
- LoadLog::EndEvent(load_log_,
- LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT);
-
if (result != OK) {
- LOG(INFO) << "Failed configuring PAC using " << current_pac_url()
- << " with error " << ErrorToString(result);
+ LoadLog::AddString(load_log_,
+ StringPrintf("Failed initializing the PAC script with error: %s",
+ ErrorToString(result)));
+ LoadLog::EndEvent(load_log_,
+ LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT);
return TryToFallbackPacUrl(result);
}
+
+ LoadLog::AddStringLiteral(load_log_, "Successfully initialized PAC script.");
+
+ LoadLog::EndEvent(load_log_,
+ LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT);
return result;
}
@@ -190,7 +200,7 @@ int InitProxyResolver::TryToFallbackPacUrl(int error) {
// Advance to next URL in our list.
++current_pac_url_index_;
- LOG(INFO) << "Falling back to next PAC URL...";
+ LoadLog::AddStringLiteral(load_log_, "Falling back to next PAC URL...");
next_state_ = GetStartState();
diff --git a/net/proxy/init_proxy_resolver_unittest.cc b/net/proxy/init_proxy_resolver_unittest.cc
index 45fcc39..16af01a 100644
--- a/net/proxy/init_proxy_resolver_unittest.cc
+++ b/net/proxy/init_proxy_resolver_unittest.cc
@@ -6,6 +6,7 @@
#include "net/base/net_errors.h"
#include "net/base/load_log.h"
+#include "net/base/load_log_util.h"
#include "net/base/load_log_unittest.h"
#include "net/base/test_completion_callback.h"
#include "net/proxy/init_proxy_resolver.h"
@@ -177,18 +178,18 @@ TEST(InitProxyResolverTest, CustomPacSucceeds) {
EXPECT_EQ(rule.bytes(), resolver.pac_bytes());
// Check the LoadLog was filled correctly.
- EXPECT_EQ(6u, log->entries().size());
+ EXPECT_EQ(9u, log->entries().size());
ExpectLogContains(log, 0, LoadLog::TYPE_INIT_PROXY_RESOLVER,
LoadLog::PHASE_BEGIN);
ExpectLogContains(log, 1, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 2, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
+ ExpectLogContains(log, 4, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
LoadLog::PHASE_END);
- ExpectLogContains(log, 3, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
+ ExpectLogContains(log, 5, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 4, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
+ ExpectLogContains(log, 7, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
LoadLog::PHASE_END);
- ExpectLogContains(log, 5, LoadLog::TYPE_INIT_PROXY_RESOLVER,
+ ExpectLogContains(log, 8, LoadLog::TYPE_INIT_PROXY_RESOLVER,
LoadLog::PHASE_END);
}
@@ -210,14 +211,14 @@ TEST(InitProxyResolverTest, CustomPacFails1) {
EXPECT_EQ("", resolver.pac_bytes());
// Check the LoadLog was filled correctly.
- EXPECT_EQ(4u, log->entries().size());
+ EXPECT_EQ(6u, log->entries().size());
ExpectLogContains(log, 0, LoadLog::TYPE_INIT_PROXY_RESOLVER,
LoadLog::PHASE_BEGIN);
ExpectLogContains(log, 1, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 2, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
+ ExpectLogContains(log, 4, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
LoadLog::PHASE_END);
- ExpectLogContains(log, 3, LoadLog::TYPE_INIT_PROXY_RESOLVER,
+ ExpectLogContains(log, 5, LoadLog::TYPE_INIT_PROXY_RESOLVER,
LoadLog::PHASE_END);
}
@@ -310,26 +311,26 @@ TEST(InitProxyResolverTest, AutodetectFailCustomSuccess2) {
// Check the LoadLog was filled correctly.
// (Note that the Fetch and Set states are repeated since both WPAD and custom
// PAC scripts are tried).
- EXPECT_EQ(10u, log->entries().size());
+ EXPECT_EQ(17u, log->entries().size());
ExpectLogContains(log, 0, LoadLog::TYPE_INIT_PROXY_RESOLVER,
LoadLog::PHASE_BEGIN);
ExpectLogContains(log, 1, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 2, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
+ ExpectLogContains(log, 4, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
LoadLog::PHASE_END);
- ExpectLogContains(log, 3, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
+ ExpectLogContains(log, 5, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 4, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
+ ExpectLogContains(log, 7, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
LoadLog::PHASE_END);
- ExpectLogContains(log, 5, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
+ ExpectLogContains(log, 9, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 6, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
+ ExpectLogContains(log, 12, LoadLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
LoadLog::PHASE_END);
- ExpectLogContains(log, 7, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
+ ExpectLogContains(log, 13, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
LoadLog::PHASE_BEGIN);
- ExpectLogContains(log, 8, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
+ ExpectLogContains(log, 15, LoadLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
LoadLog::PHASE_END);
- ExpectLogContains(log, 9, LoadLog::TYPE_INIT_PROXY_RESOLVER,
+ ExpectLogContains(log, 16, LoadLog::TYPE_INIT_PROXY_RESOLVER,
LoadLog::PHASE_END);
}