From ab6a5c4dd0c4a16b202567afa28f70c7ebd37ec9 Mon Sep 17 00:00:00 2001 From: "eroman@chromium.org" Date: Fri, 13 Nov 2009 00:25:29 +0000 Subject: Add LoadLog instrumentation to HttpNetworkTransaction, to tell how much time was spent reading/writing headers and reading/writing body. Review URL: http://codereview.chromium.org/384098 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31861 0039d316-1c4b-4281-b951-d872f2087c98 --- net/url_request/url_request_unittest.cc | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'net/url_request/url_request_unittest.cc') diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index a8b47d2..0877768 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -203,14 +203,24 @@ TEST_F(URLRequestTestHTTP, GetTest_NoCache) { EXPECT_FALSE(d.received_data_before_response()); EXPECT_NE(0, d.bytes_received()); - // The first and last entries of the LoadLog should be for - // TYPE_URL_REQUEST_START. - net::ExpectLogContains(r.load_log(), 0, - net::LoadLog::TYPE_URL_REQUEST_START, - net::LoadLog::PHASE_BEGIN); - net::ExpectLogContains(r.load_log(), r.load_log()->events().size() - 1, - net::LoadLog::TYPE_URL_REQUEST_START, - net::LoadLog::PHASE_END); + // The first part of the log will be for URL_REQUEST_START. + // After that, there should be an HTTP_TRANSACTION_READ_BODY + EXPECT_TRUE( + net::LogContains(*r.load_log(), 0, + net::LoadLog::TYPE_URL_REQUEST_START, + net::LoadLog::PHASE_BEGIN)); + EXPECT_TRUE( + net::LogContains(*r.load_log(), -3, + net::LoadLog::TYPE_URL_REQUEST_START, + net::LoadLog::PHASE_END)); + EXPECT_TRUE( + net::LogContains(*r.load_log(), -2, + net::LoadLog::TYPE_HTTP_TRANSACTION_READ_BODY, + net::LoadLog::PHASE_BEGIN)); + EXPECT_TRUE( + net::LogContains(*r.load_log(), -1, + net::LoadLog::TYPE_HTTP_TRANSACTION_READ_BODY, + net::LoadLog::PHASE_END)); } } -- cgit v1.1