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

Side by Side Diff: net/http/http_response_headers_unittest.cc

Issue 527883002: Modified to resolve TODO in parseversion in http_response_headers.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modified code as per review comments Created 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <limits> 6 #include <limits>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 "hTtP/0.9 200 OK\n", 187 "hTtP/0.9 200 OK\n",
188 188
189 "HTTP/0.9 200 OK\n", 189 "HTTP/0.9 200 OK\n",
190 190
191 200, 191 200,
192 net::HttpVersion(0,9), 192 net::HttpVersion(0,9),
193 net::HttpVersion(0,9) 193 net::HttpVersion(0,9)
194 }, 194 },
195 { 195 {
196 // Test for Leading zeros in http version
197
198 "HTTP/01.1 200 OK\n",
199
200 "HTTP/1.1 200 OK\n",
201
202 200,
203 net::HttpVersion(1, 1),
204 net::HttpVersion(1, 1)
205 },
206 {
207 // Test for Leading zeros in http version
208
209 "HTTP/0001.1 200 OK\n",
210
211 "HTTP/1.1 200 OK\n",
212
213 200,
214 net::HttpVersion(1, 1),
215 net::HttpVersion(1, 1)
216 },
217 {
218 // Test for Leading zeros in http version
219
220 "HTTP/10.1 200 OK\n",
221
222 "HTTP/10.1 200 OK\n",
223
224 200,
225 net::HttpVersion(10, 1),
226 net::HttpVersion(10, 1)
227 },
228 {
229 // Test for Leading zeros in http version
230
231 "HTTP/1.01 200 OK\n",
232
233 "HTTP/1.1 200 OK\n",
234
235 200,
236 net::HttpVersion(1, 1),
237 net::HttpVersion(1, 1)
238 },
239 {
240 // Test for multiple digits in http version
241
242 "HTTP/21.1 200 OK\n",
243
244 "HTTP/21.1 200 OK\n",
245
246 200,
247
248 net::HttpVersion(21, 1),
249 net::HttpVersion(21, 1)
250 },
251 {
252 // Test for multiple digits in http version
253
254 "HTTP/1.21 200 OK\n",
255
256 "HTTP/1.21 200 OK\n",
257
258 200,
259 net::HttpVersion(1, 21),
260 net::HttpVersion(1, 21)
261 },
262 {
263 // Test for multiple digits in http version
264
265 "HTTP/21.21 200 OK\n",
266
267 "HTTP/21.21 200 OK\n",
268
269 200,
270 net::HttpVersion(21, 21),
271 net::HttpVersion(21, 21)
272 },
273 {
274 // Test for multiple digits in http version
275
276 "HTTP/221.21 200 OK\n",
277
278 "HTTP/221.21 200 OK\n",
279
280 200,
281 net::HttpVersion(221, 21),
282 net::HttpVersion(221, 21)
283 },
284 {
196 // Add missing OK. 285 // Add missing OK.
197 286
198 "HTTP/1.1 201\n" 287 "HTTP/1.1 201\n"
199 "Content-TYPE: text/html; charset=utf-8\n", 288 "Content-TYPE: text/html; charset=utf-8\n",
200 289
201 "HTTP/1.1 201 OK\n" 290 "HTTP/1.1 201 OK\n"
202 "Content-TYPE: text/html; charset=utf-8\n", 291 "Content-TYPE: text/html; charset=utf-8\n",
203 292
204 201, 293 201,
205 net::HttpVersion(1,1), 294 net::HttpVersion(1,1),
(...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after
2247 } 2336 }
2248 2337
2249 TEST_F(HttpResponseHeadersCacheControlTest, 2338 TEST_F(HttpResponseHeadersCacheControlTest,
2250 FirstStaleWhileRevalidateValueUsed) { 2339 FirstStaleWhileRevalidateValueUsed) {
2251 InitializeHeadersWithCacheControl( 2340 InitializeHeadersWithCacheControl(
2252 "stale-while-revalidate=1,stale-while-revalidate=7200"); 2341 "stale-while-revalidate=1,stale-while-revalidate=7200");
2253 EXPECT_EQ(TimeDelta::FromSeconds(1), GetStaleWhileRevalidateValue()); 2342 EXPECT_EQ(TimeDelta::FromSeconds(1), GetStaleWhileRevalidateValue());
2254 } 2343 }
2255 2344
2256 } // end namespace 2345 } // end namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698