OLD | NEW |
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 <iostream> | 6 #include <iostream> |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // This is how HTTP/0.9 responses get constructed from | 178 // This is how HTTP/0.9 responses get constructed from |
179 // HttpNetworkTransaction. | 179 // HttpNetworkTransaction. |
180 | 180 |
181 "hTtP/0.9 200 OK\n", | 181 "hTtP/0.9 200 OK\n", |
182 | 182 |
183 "HTTP/0.9 200 OK\n", | 183 "HTTP/0.9 200 OK\n", |
184 | 184 |
185 200, | 185 200, |
186 HttpVersion(0, 9), | 186 HttpVersion(0, 9), |
187 HttpVersion(0, 9)}, | 187 HttpVersion(0, 9)}, |
| 188 {// Test for two or more digits in http version |
| 189 |
| 190 "HTTP/01.1 200 OK\n", |
| 191 |
| 192 "HTTP/1.1 200 OK\n", |
| 193 |
| 194 200, |
| 195 net::HttpVersion(1, 1), |
| 196 net::HttpVersion(1, 1)}, |
| 197 {// Test for two or more digits in http version |
| 198 |
| 199 "HTTP/10.1 200 OK\n", |
| 200 |
| 201 "HTTP/1.1 200 OK\n", |
| 202 |
| 203 200, |
| 204 net::HttpVersion(10, 1), |
| 205 net::HttpVersion(1, 1)}, |
| 206 {// Test for two or more digits in http version |
| 207 |
| 208 "HTTP/1.01 200 OK\n", |
| 209 |
| 210 "HTTP/1.1 200 OK\n", |
| 211 |
| 212 200, |
| 213 net::HttpVersion(1, 1), |
| 214 net::HttpVersion(1, 1)}, |
| 215 {// Test for two or more digits in http version |
| 216 |
| 217 "HTTP/1.10 200 OK\n", |
| 218 |
| 219 "HTTP/1.1 200 OK\n", |
| 220 |
| 221 200, |
| 222 net::HttpVersion(1, 10), |
| 223 net::HttpVersion(1, 1)}, |
| 224 {// Test for octal vs decimal digits in http version |
| 225 |
| 226 "HTTP/9.9 200 OK\n", |
| 227 |
| 228 "HTTP/1.1 200 OK\n", |
| 229 |
| 230 200, |
| 231 net::HttpVersion(9, 9), |
| 232 net::HttpVersion(1, 1)}, |
| 233 {// Test for two or more digits in http version |
| 234 |
| 235 "HTTP/21.21 200 OK\n", |
| 236 |
| 237 "HTTP/1.1 200 OK\n", |
| 238 |
| 239 200, |
| 240 net::HttpVersion(21, 21), |
| 241 net::HttpVersion(1, 1)}, |
| 242 {// Test for signed digits in http version |
| 243 |
| 244 "HTTP/-21.21 200 OK\n", |
| 245 |
| 246 "HTTP/1.0 200 OK\n", |
| 247 |
| 248 200, |
| 249 net::HttpVersion(0, 0), |
| 250 net::HttpVersion(1, 0)}, |
| 251 {// Test for signed digits in http version |
| 252 |
| 253 "HTTP/+21.21 200 OK\n", |
| 254 |
| 255 "HTTP/1.0 200 OK\n", |
| 256 |
| 257 200, |
| 258 net::HttpVersion(0, 0), |
| 259 net::HttpVersion(1, 0)}, |
| 260 {// Test for overflow condition in http version |
| 261 |
| 262 "HTTP/4294967295.1 200 OK\n", |
| 263 |
| 264 "HTTP/1.0 200 OK\n", |
| 265 |
| 266 200, |
| 267 net::HttpVersion(0, 0), |
| 268 net::HttpVersion(1, 0)}, |
| 269 {// Test for boundary condition in http version |
| 270 |
| 271 "HTTP/65535.1 200 OK\n", |
| 272 |
| 273 "HTTP/1.1 200 OK\n", |
| 274 |
| 275 200, |
| 276 net::HttpVersion(65535, 1), |
| 277 net::HttpVersion(1, 1)}, |
| 278 {// Test for overflow (2^32) in http version |
| 279 |
| 280 "HTTP/4.4294967296 200 OK\n", |
| 281 |
| 282 "HTTP/1.0 200 OK\n", |
| 283 |
| 284 200, |
| 285 net::HttpVersion(0, 0), |
| 286 net::HttpVersion(1, 0)}, |
| 287 {// Test for overflow (2^64) in http version |
| 288 |
| 289 "HTTP/18446744073709551616 200 OK\n", |
| 290 |
| 291 "HTTP/1.0 200 OK\n", |
| 292 |
| 293 200, |
| 294 net::HttpVersion(0, 0), |
| 295 net::HttpVersion(1, 0)}, |
| 296 {// Test for alphanumeric in http version |
| 297 |
| 298 "HTTP/12aaasa.1 200 OK\n", |
| 299 |
| 300 "HTTP/1.0 200 OK\n", |
| 301 |
| 302 200, |
| 303 net::HttpVersion(0, 0), |
| 304 net::HttpVersion(1, 0)}, |
188 {// Add missing OK. | 305 {// Add missing OK. |
189 | 306 |
190 "HTTP/1.1 201\n" | 307 "HTTP/1.1 201\n" |
191 "Content-TYPE: text/html; charset=utf-8\n", | 308 "Content-TYPE: text/html; charset=utf-8\n", |
192 | 309 |
193 "HTTP/1.1 201 OK\n" | 310 "HTTP/1.1 201 OK\n" |
194 "Content-TYPE: text/html; charset=utf-8\n", | 311 "Content-TYPE: text/html; charset=utf-8\n", |
195 | 312 |
196 201, | 313 201, |
197 HttpVersion(1, 1), | 314 HttpVersion(1, 1), |
(...skipping 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2327 TEST_F(HttpResponseHeadersCacheControlTest, | 2444 TEST_F(HttpResponseHeadersCacheControlTest, |
2328 FirstStaleWhileRevalidateValueUsed) { | 2445 FirstStaleWhileRevalidateValueUsed) { |
2329 InitializeHeadersWithCacheControl( | 2446 InitializeHeadersWithCacheControl( |
2330 "stale-while-revalidate=1,stale-while-revalidate=7200"); | 2447 "stale-while-revalidate=1,stale-while-revalidate=7200"); |
2331 EXPECT_EQ(TimeDelta::FromSeconds(1), GetStaleWhileRevalidateValue()); | 2448 EXPECT_EQ(TimeDelta::FromSeconds(1), GetStaleWhileRevalidateValue()); |
2332 } | 2449 } |
2333 | 2450 |
2334 } // namespace | 2451 } // namespace |
2335 | 2452 |
2336 } // namespace net | 2453 } // namespace net |
OLD | NEW |