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

Unified Diff: net/http/http_cache_unittest.cc

Issue 199028: Update the request time of http cache entries on 304.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_cache.cc ('k') | net/http/http_transaction_unittest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache_unittest.cc
===================================================================
--- net/http/http_cache_unittest.cc (revision 25484)
+++ net/http/http_cache_unittest.cc (working copy)
@@ -458,6 +458,7 @@
const MockTransaction kFastNoStoreGET_Transaction = {
"http://www.google.com/nostore",
"GET",
+ base::Time(),
"",
net::LOAD_VALIDATE_CACHE,
"HTTP/1.1 200 OK",
@@ -562,6 +563,7 @@
const MockTransaction kRangeGET_TransactionOK = {
"http://www.google.com/range",
"GET",
+ base::Time(),
"Range: bytes = 40-49\r\n",
net::LOAD_NORMAL,
"HTTP/1.1 206 Partial Content",
@@ -2498,9 +2500,10 @@
// Other tests check that the response headers of the cached response
// get updated on 304. Here we specifically check that the
-// HttpResponseHeaders::response_time field also gets updated.
+// HttpResponseHeaders::request_time and HttpResponseHeaders::response_time
+// fields also gets updated.
// http://crbug.com/20594.
-TEST(HttpCache, UpdatesResponseTimeOn304) {
+TEST(HttpCache, UpdatesRequestResponseTimeOn304) {
MockHttpCache cache;
const char* kUrl = "http://foobar";
@@ -2543,14 +2546,19 @@
kNetResponse2.AssignTo(&mock_network_response);
- base::Time t = base::Time() + base::TimeDelta::FromHours(1234);
- mock_network_response.response_time = t;
+ base::Time request_time = base::Time() + base::TimeDelta::FromHours(1234);
+ base::Time response_time = base::Time() + base::TimeDelta::FromHours(1235);
+ mock_network_response.request_time = request_time;
+ mock_network_response.response_time = response_time;
+
net::HttpResponseInfo response;
RunTransactionTestWithResponseInfo(cache.http_cache(), request, &response);
- // The response time should have been updated.
- EXPECT_EQ(t.ToInternalValue(),
+ // The request and response times should have been updated.
+ EXPECT_EQ(request_time.ToInternalValue(),
+ response.request_time.ToInternalValue());
+ EXPECT_EQ(response_time.ToInternalValue(),
response.response_time.ToInternalValue());
std::string headers;
« no previous file with comments | « net/http/http_cache.cc ('k') | net/http/http_transaction_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698