summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-14 21:52:36 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-14 21:52:36 +0000
commit26128342336043f70169489df27729ea97301972 (patch)
tree3c5cf414de217bbf8d6eac0f4e1ea1a45499663c /chrome/browser/net
parent44603d54d54c8065abab89285404541f7288890e (diff)
downloadchromium_src-26128342336043f70169489df27729ea97301972.zip
chromium_src-26128342336043f70169489df27729ea97301972.tar.gz
chromium_src-26128342336043f70169489df27729ea97301972.tar.bz2
Add the URLRequest's method and load flags to the NetLog.
BUG=37421 Review URL: http://codereview.chromium.org/2108003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47321 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/passive_log_collector.cc3
-rw-r--r--chrome/browser/net/passive_log_collector_unittest.cc23
2 files changed, 15 insertions, 11 deletions
diff --git a/chrome/browser/net/passive_log_collector.cc b/chrome/browser/net/passive_log_collector.cc
index 6bee50f..1192965 100644
--- a/chrome/browser/net/passive_log_collector.cc
+++ b/chrome/browser/net/passive_log_collector.cc
@@ -9,6 +9,7 @@
#include "base/string_util.h"
#include "base/format_macros.h"
#include "chrome/browser/chrome_thread.h"
+#include "net/url_request/url_request_netlog_params.h"
namespace {
@@ -149,6 +150,8 @@ std::string PassiveLogCollector::RequestInfo::GetURL() const {
if (entry.phase == net::NetLog::PHASE_BEGIN && entry.params) {
switch (entry.type) {
case net::NetLog::TYPE_URL_REQUEST_START:
+ return static_cast<URLRequestStartEventParameters*>(
+ entry.params.get())->url().possibly_invalid_spec();
case net::NetLog::TYPE_SOCKET_STREAM_CONNECT:
return static_cast<net::NetLogStringParameter*>(
entry.params.get())->value();
diff --git a/chrome/browser/net/passive_log_collector_unittest.cc b/chrome/browser/net/passive_log_collector_unittest.cc
index 2839ded..e7e2f2e 100644
--- a/chrome/browser/net/passive_log_collector_unittest.cc
+++ b/chrome/browser/net/passive_log_collector_unittest.cc
@@ -7,6 +7,7 @@
#include "base/compiler_specific.h"
#include "base/format_macros.h"
#include "base/string_util.h"
+#include "net/url_request/url_request_netlog_params.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -25,7 +26,7 @@ PassiveLogCollector::Entry MakeStartLogEntryWithURL(int source_id,
base::TimeTicks(),
NetLog::Source(kSourceType, source_id),
NetLog::PHASE_BEGIN,
- new net::NetLogStringParameter("url", url));
+ new URLRequestStartEventParameters(GURL(url), "GET", 0));
}
PassiveLogCollector::Entry MakeStartLogEntry(int source_id) {
@@ -49,8 +50,8 @@ void AddStartURLRequestEntries(PassiveLogCollector* collector, uint32 id) {
NetLog::PHASE_BEGIN, NULL);
collector->OnAddEntry(NetLog::TYPE_URL_REQUEST_START, base::TimeTicks(),
NetLog::Source(NetLog::SOURCE_URL_REQUEST, id),
- NetLog::PHASE_BEGIN, new net::NetLogStringParameter(
- "url", StringPrintf("http://req%d", id)));
+ NetLog::PHASE_BEGIN, new URLRequestStartEventParameters(
+ GURL(StringPrintf("http://req%d", id)), "GET", 0));
}
void AddEndURLRequestEntries(PassiveLogCollector* collector, uint32 id) {
@@ -82,11 +83,11 @@ TEST(RequestTrackerTest, BasicBounded) {
RequestInfoList live_reqs = tracker.GetLiveRequests();
ASSERT_EQ(5u, live_reqs.size());
- EXPECT_EQ("http://req1", live_reqs[0].GetURL());
- EXPECT_EQ("http://req2", live_reqs[1].GetURL());
- EXPECT_EQ("http://req3", live_reqs[2].GetURL());
- EXPECT_EQ("http://req4", live_reqs[3].GetURL());
- EXPECT_EQ("http://req5", live_reqs[4].GetURL());
+ EXPECT_EQ("http://req1/", live_reqs[0].GetURL());
+ EXPECT_EQ("http://req2/", live_reqs[1].GetURL());
+ EXPECT_EQ("http://req3/", live_reqs[2].GetURL());
+ EXPECT_EQ("http://req4/", live_reqs[3].GetURL());
+ EXPECT_EQ("http://req5/", live_reqs[4].GetURL());
tracker.OnAddEntry(MakeEndLogEntry(1));
tracker.OnAddEntry(MakeEndLogEntry(5));
@@ -97,8 +98,8 @@ TEST(RequestTrackerTest, BasicBounded) {
live_reqs = tracker.GetLiveRequests();
ASSERT_EQ(2u, live_reqs.size());
- EXPECT_EQ("http://req2", live_reqs[0].GetURL());
- EXPECT_EQ("http://req4", live_reqs[1].GetURL());
+ EXPECT_EQ("http://req2/", live_reqs[0].GetURL());
+ EXPECT_EQ("http://req4/", live_reqs[1].GetURL());
}
TEST(RequestTrackerTest, GraveyardBounded) {
@@ -120,7 +121,7 @@ TEST(RequestTrackerTest, GraveyardBounded) {
for (size_t i = 0; i < RequestTracker::kMaxGraveyardSize; ++i) {
size_t req_number = i + RequestTracker::kMaxGraveyardSize;
- std::string url = StringPrintf("http://req%" PRIuS, req_number);
+ std::string url = StringPrintf("http://req%" PRIuS "/", req_number);
EXPECT_EQ(url, recent_reqs[i].GetURL());
}
}