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

Side by Side Diff: net/http/http_transaction_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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_transaction_unittest.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_transaction_unittest.h" 5 #include "net/http/http_transaction_unittest.h"
6 6
7 #include "base/hash_tables.h" 7 #include "base/hash_tables.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
11 #include "net/base/load_flags.h" 11 #include "net/base/load_flags.h"
12 #include "net/disk_cache/disk_cache.h" 12 #include "net/disk_cache/disk_cache.h"
13 #include "net/http/http_cache.h" 13 #include "net/http/http_cache.h"
14 #include "net/http/http_request_info.h" 14 #include "net/http/http_request_info.h"
15 #include "net/http/http_response_info.h" 15 #include "net/http/http_response_info.h"
16 #include "net/http/http_transaction.h" 16 #include "net/http/http_transaction.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 //----------------------------------------------------------------------------- 19 //-----------------------------------------------------------------------------
20 // mock transaction data 20 // mock transaction data
21 21
22 const MockTransaction kSimpleGET_Transaction = { 22 const MockTransaction kSimpleGET_Transaction = {
23 "http://www.google.com/", 23 "http://www.google.com/",
24 "GET", 24 "GET",
25 base::Time(),
25 "", 26 "",
26 net::LOAD_NORMAL, 27 net::LOAD_NORMAL,
27 "HTTP/1.1 200 OK", 28 "HTTP/1.1 200 OK",
28 "Cache-Control: max-age=10000\n", 29 "Cache-Control: max-age=10000\n",
29 base::Time(), 30 base::Time(),
30 "<html><body>Google Blah Blah</body></html>", 31 "<html><body>Google Blah Blah</body></html>",
31 TEST_MODE_NORMAL, 32 TEST_MODE_NORMAL,
32 NULL, 33 NULL,
33 0 34 0
34 }; 35 };
35 36
36 const MockTransaction kSimplePOST_Transaction = { 37 const MockTransaction kSimplePOST_Transaction = {
37 "http://bugdatabase.com/edit", 38 "http://bugdatabase.com/edit",
38 "POST", 39 "POST",
40 base::Time(),
39 "", 41 "",
40 net::LOAD_NORMAL, 42 net::LOAD_NORMAL,
41 "HTTP/1.1 200 OK", 43 "HTTP/1.1 200 OK",
42 "", 44 "",
43 base::Time(), 45 base::Time(),
44 "<html><body>Google Blah Blah</body></html>", 46 "<html><body>Google Blah Blah</body></html>",
45 TEST_MODE_NORMAL, 47 TEST_MODE_NORMAL,
46 NULL, 48 NULL,
47 0 49 0
48 }; 50 };
49 51
50 const MockTransaction kTypicalGET_Transaction = { 52 const MockTransaction kTypicalGET_Transaction = {
51 "http://www.example.com/~foo/bar.html", 53 "http://www.example.com/~foo/bar.html",
52 "GET", 54 "GET",
55 base::Time(),
53 "", 56 "",
54 net::LOAD_NORMAL, 57 net::LOAD_NORMAL,
55 "HTTP/1.1 200 OK", 58 "HTTP/1.1 200 OK",
56 "Date: Wed, 28 Nov 2007 09:40:09 GMT\n" 59 "Date: Wed, 28 Nov 2007 09:40:09 GMT\n"
57 "Last-Modified: Wed, 28 Nov 2007 00:40:09 GMT\n", 60 "Last-Modified: Wed, 28 Nov 2007 00:40:09 GMT\n",
58 base::Time(), 61 base::Time(),
59 "<html><body>Google Blah Blah</body></html>", 62 "<html><body>Google Blah Blah</body></html>",
60 TEST_MODE_NORMAL, 63 TEST_MODE_NORMAL,
61 NULL, 64 NULL,
62 0 65 0
63 }; 66 };
64 67
65 const MockTransaction kETagGET_Transaction = { 68 const MockTransaction kETagGET_Transaction = {
66 "http://www.google.com/foopy", 69 "http://www.google.com/foopy",
67 "GET", 70 "GET",
71 base::Time(),
68 "", 72 "",
69 net::LOAD_NORMAL, 73 net::LOAD_NORMAL,
70 "HTTP/1.1 200 OK", 74 "HTTP/1.1 200 OK",
71 "Cache-Control: max-age=10000\n" 75 "Cache-Control: max-age=10000\n"
72 "Etag: foopy\n", 76 "Etag: foopy\n",
73 base::Time(), 77 base::Time(),
74 "<html><body>Google Blah Blah</body></html>", 78 "<html><body>Google Blah Blah</body></html>",
75 TEST_MODE_NORMAL, 79 TEST_MODE_NORMAL,
76 NULL, 80 NULL,
77 0 81 0
78 }; 82 };
79 83
80 const MockTransaction kRangeGET_Transaction = { 84 const MockTransaction kRangeGET_Transaction = {
81 "http://www.google.com/", 85 "http://www.google.com/",
82 "GET", 86 "GET",
87 base::Time(),
83 "Range: 0-100\r\n", 88 "Range: 0-100\r\n",
84 net::LOAD_NORMAL, 89 net::LOAD_NORMAL,
85 "HTTP/1.1 200 OK", 90 "HTTP/1.1 200 OK",
86 "Cache-Control: max-age=10000\n", 91 "Cache-Control: max-age=10000\n",
87 base::Time(), 92 base::Time(),
88 "<html><body>Google Blah Blah</body></html>", 93 "<html><body>Google Blah Blah</body></html>",
89 TEST_MODE_NORMAL, 94 TEST_MODE_NORMAL,
90 NULL, 95 NULL,
91 0 96 0
92 }; 97 };
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 if (rv > 0) { 154 if (rv > 0) {
150 content.append(buf->data(), rv); 155 content.append(buf->data(), rv);
151 } else if (rv < 0) { 156 } else if (rv < 0) {
152 return rv; 157 return rv;
153 } 158 }
154 } while (rv > 0); 159 } while (rv > 0);
155 160
156 result->swap(content); 161 result->swap(content);
157 return net::OK; 162 return net::OK;
158 } 163 }
OLDNEW
« no previous file with comments | « net/http/http_transaction_unittest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698