summaryrefslogtreecommitdiffstats
path: root/net/http/http_response_headers_unittest.cc
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-14 22:05:54 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-14 22:05:54 +0000
commit7eab0d22638954a4539a408c1b44082cb78f7a7d (patch)
tree82c3a82573d5a329c8ac76123e61880f6073c063 /net/http/http_response_headers_unittest.cc
parent1405220aad5d0885a3f583e95d9a96e76455b1c7 (diff)
downloadchromium_src-7eab0d22638954a4539a408c1b44082cb78f7a7d.zip
chromium_src-7eab0d22638954a4539a408c1b44082cb78f7a7d.tar.gz
chromium_src-7eab0d22638954a4539a408c1b44082cb78f7a7d.tar.bz2
Http Cache: More unit tests for byte range support.
BUG=b/2071330 TEST=unittests Review URL: http://codereview.chromium.org/267101 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29035 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_response_headers_unittest.cc')
-rw-r--r--net/http/http_response_headers_unittest.cc78
1 files changed, 45 insertions, 33 deletions
diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc
index 9f0cfde..e18dc1f 100644
--- a/net/http/http_response_headers_unittest.cc
+++ b/net/http/http_response_headers_unittest.cc
@@ -253,7 +253,7 @@ TEST(HttpResponseHeadersTest, NormalizeHeadersOfWhitepace) {
"HTTP/1.0 200 OK\n",
200,
- HttpVersion(0,0), // Parse error
+ HttpVersion(0,0), // Parse error
HttpVersion(1,0)
};
TestCommon(test);
@@ -1157,6 +1157,13 @@ TEST(HttpResponseHeaders, GetContentRange) {
{ "HTTP/1.1 206 Partial Content\n"
"Content-Range: \t bytes \t 0 - 50 / 5 1",
false,
+ 0,
+ 50,
+ -1
+ },
+ { "HTTP/1.1 206 Partial Content\n"
+ "Content-Range: \t bytes \t 0 - 5 0 / 51",
+ false,
-1,
-1,
-1
@@ -1164,34 +1171,34 @@ TEST(HttpResponseHeaders, GetContentRange) {
{ "HTTP/1.1 206 Partial Content\n"
"Content-Range: bytes 50-0/51",
false,
- -1,
- -1,
+ 50,
+ 0,
-1
},
{ "HTTP/1.1 416 Requested range not satisfiable\n"
- "Content-Range: bytes */*",
- true,
+ "Content-Range: bytes * /*",
+ false,
-1,
-1,
-1
},
{ "HTTP/1.1 416 Requested range not satisfiable\n"
"Content-Range: bytes * / * ",
- true,
+ false,
-1,
-1,
-1
},
{ "HTTP/1.1 206 Partial Content\n"
"Content-Range: bytes 0-50/*",
- true,
+ false,
0,
50,
-1
},
{ "HTTP/1.1 206 Partial Content\n"
"Content-Range: bytes 0-50 / * ",
- true,
+ false,
0,
50,
-1
@@ -1206,15 +1213,29 @@ TEST(HttpResponseHeaders, GetContentRange) {
{ "HTTP/1.1 206 Partial Content\n"
"Content-Range: bytes 0-10000000000/10000000000",
false,
- -1,
- -1,
- -1
+ 0,
+ 10000000000ll,
+ 10000000000ll
+ },
+ // 64 bits wraparound.
+ { "HTTP/1.1 206 Partial Content\n"
+ "Content-Range: bytes 0 - 9223372036854775807 / 100",
+ false,
+ 0,
+ kint64max,
+ 100
+ },
+ // 64 bits wraparound.
+ { "HTTP/1.1 206 Partial Content\n"
+ "Content-Range: bytes 0 - 100 / -9223372036854775808",
+ false,
+ 0,
+ 100,
+ kint64min
},
- // The following header is invalid for response code of 206, this should be
- // verified by the user.
{ "HTTP/1.1 206 Partial Content\n"
"Content-Range: bytes */50",
- true,
+ false,
-1,
-1,
50
@@ -1222,16 +1243,16 @@ TEST(HttpResponseHeaders, GetContentRange) {
{ "HTTP/1.1 206 Partial Content\n"
"Content-Range: bytes 0-50/10",
false,
- -1,
- -1,
- -1
+ 0,
+ 50,
+ 10
},
{ "HTTP/1.1 206 Partial Content\n"
"Content-Range: bytes 0-50/-10",
false,
- -1,
- -1,
- -1
+ 0,
+ 50,
+ -10
},
{ "HTTP/1.1 206 Partial Content\n"
"Content-Range: bytes 0-0/1",
@@ -1269,15 +1290,8 @@ TEST(HttpResponseHeaders, GetContentRange) {
-1
},
{ "HTTP/1.1 206 Partial Content\n"
- "Content-Range: bytes 0-40000000000000000000/40000000000000000001",
- false,
- -1,
- -1,
- -1
- },
- { "HTTP/1.1 206 Partial Content\n"
"Content-Range: bytes 0-1233/*",
- true,
+ false,
0,
1233,
-1
@@ -1303,11 +1317,9 @@ TEST(HttpResponseHeaders, GetContentRange) {
&last_byte_position,
&instance_size);
EXPECT_EQ(tests[i].expected_return_value, return_value);
- if (return_value) {
- EXPECT_EQ(tests[i].expected_first_byte_position, first_byte_position);
- EXPECT_EQ(tests[i].expected_last_byte_position, last_byte_position);
- EXPECT_EQ(tests[i].expected_instance_size, instance_size);
- }
+ EXPECT_EQ(tests[i].expected_first_byte_position, first_byte_position);
+ EXPECT_EQ(tests[i].expected_last_byte_position, last_byte_position);
+ EXPECT_EQ(tests[i].expected_instance_size, instance_size);
}
}