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

Unified 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 to include overflow logic and other 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_response_headers.cc ('k') | net/http/http_version.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_response_headers_unittest.cc
diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc
index 098ce73e99aa48a85c42311b3876228ac37567f3..b11a3becaecfee7fd9e5d3c97417b3a1cbfe7318 100644
--- a/net/http/http_response_headers_unittest.cc
+++ b/net/http/http_response_headers_unittest.cc
@@ -193,6 +193,238 @@ TestData response_headers_tests[] = {
net::HttpVersion(0,9)
},
{
+ // Test for Leading zeros in http version
+
+ "HTTP/01.1 200 OK\n",
+
+ "HTTP/1.1 200 OK\n",
+
+ 200,
+ net::HttpVersion(1, 1),
+ net::HttpVersion(1, 1)
+ },
+ {
+ // Test for Leading zeros in http version
+
+ "HTTP/0001.1 200 OK\n",
+
+ "HTTP/1.1 200 OK\n",
+
+ 200,
+ net::HttpVersion(1, 1),
+ net::HttpVersion(1, 1)
+ },
+ {
+ // Test for Leading zeros in http version
+
+ "HTTP/10.1 200 OK\n",
+
+ "HTTP/10.1 200 OK\n",
+
+ 200,
+ net::HttpVersion(10, 1),
+ net::HttpVersion(10, 1)
+ },
+ {
+ // Test for Leading zeros in http version
+
+ "HTTP/1.01 200 OK\n",
+
+ "HTTP/1.1 200 OK\n",
+
+ 200,
+ net::HttpVersion(1, 1),
+ net::HttpVersion(1, 1)
+ },
+ {
+ // Test for multiple digits in http version
+
+ "HTTP/21.1 200 OK\n",
+
+ "HTTP/21.1 200 OK\n",
+
+ 200,
+
+ net::HttpVersion(21, 1),
+ net::HttpVersion(21, 1)
+ },
+ {
+ // Test for multiple digits in http version
+
+ "HTTP/1.21 200 OK\n",
+
+ "HTTP/1.21 200 OK\n",
+
+ 200,
+ net::HttpVersion(1, 21),
+ net::HttpVersion(1, 21)
+ },
+ {
+ // Test for multiple digits in http version
+
+ "HTTP/21.21 200 OK\n",
+
+ "HTTP/21.21 200 OK\n",
+
+ 200,
+ net::HttpVersion(21, 21),
+ net::HttpVersion(21, 21)
+ },
+ {
+ // Test for multiple digits in http version
+
+ "HTTP/221.21 200 OK\n",
+
+ "HTTP/221.21 200 OK\n",
+
+ 200,
+ net::HttpVersion(221, 21),
+ net::HttpVersion(221, 21)
+ },
+ {
+ // Test for http version overflow
+
+ "HTTP/231342424423424.21 200 OK\n",
+
+ "HTTP/1.0 200 OK\n",
+
+ 200,
+ net::HttpVersion(0, 0),
+ net::HttpVersion(1, 0)
+ },
+ {
+ // Test for http version underflow
+
+ "HTTP/23.-21 200 OK\n",
+
+ "HTTP/1.0 200 OK\n",
+
+ 200,
+ net::HttpVersion(0, 0),
+ net::HttpVersion(1, 0)
+ },
+ {
+ // Test for non-numeric chars in http version
+
+ "HTTP/341a.23 200 OK\n",
+
+ "HTTP/1.0 200 OK\n",
+
+ 200,
+ net::HttpVersion(0, 0),
+ net::HttpVersion(1, 0)
+ },
+ {
+ // Test for non-numeric chars in http version
+
+ "HTTP/341.23a 200 OK\n",
+
+ "HTTP/1.0 200 OK\n",
+
+ 200,
+ net::HttpVersion(0, 0),
+ net::HttpVersion(1, 0)
+ },
+ {
+ // Test for non-numeric chars in http version
+
+ "HTTP/341a.23a 200 OK\n",
+
+ "HTTP/1.0 200 OK\n",
+
+ 200,
+ net::HttpVersion(0, 0),
+ net::HttpVersion(1, 0)
+ },
+ {
+ // Test for non-numeric chars in http version
+
+ "HTTP/a341.23 200 OK\n",
+
+ "HTTP/1.0 200 OK\n",
+
+ 200,
+ net::HttpVersion(0, 0),
+ net::HttpVersion(1, 0)
+ },
+ {
+ // Test for non-numeric chars in http version
+
+ "HTTP/341.a23 200 OK\n",
+
+ "HTTP/1.0 200 OK\n",
+
+ 200,
+ net::HttpVersion(0, 0),
+ net::HttpVersion(1, 0)
+ },
+ {
+ // Test for non-numeric chars in http version
+
+ "HTTP/a341.a23 200 OK\n",
+
+ "HTTP/1.0 200 OK\n",
+
+ 200,
+ net::HttpVersion(0, 0),
+ net::HttpVersion(1, 0)
+ },
+ {
+ // Test for non-numeric chars in http version
+
+ "HTTP/34a1.2a3 200 OK\n",
+
+ "HTTP/1.0 200 OK\n",
+
+ 200,
+ net::HttpVersion(0, 0),
+ net::HttpVersion(1, 0)
+ },
+ {
+ // Test for empty major and minor value in http version
+
+ "HTTP/. 200 OK\n",
+
+ "HTTP/1.0 200 OK\n",
+
+ 200,
+ net::HttpVersion(0, 0),
+ net::HttpVersion(1, 0)
+ },
+ {
+ // Test for empty major value in http version
+
+ "HTTP/.23 200 OK\n",
+
+ "HTTP/1.0 200 OK\n",
+
+ 200,
+ net::HttpVersion(0, 0),
+ net::HttpVersion(1, 0)
+ },
+ {
+ // Test for empty minor value in http version
+
+ "HTTP/341. 200 OK\n",
+
+ "HTTP/1.0 200 OK\n",
+
+ 200,
+ net::HttpVersion(0, 0),
+ net::HttpVersion(1, 0)
+ },
+ {
+ // Test for empty http version
+
+ "HTTP/ 200 OK\n",
+
+ "HTTP/1.0 200 OK\n",
+
+ 200,
+ net::HttpVersion(0, 0),
+ net::HttpVersion(1, 0)
+ },
+ {
// Add missing OK.
"HTTP/1.1 201\n"
« no previous file with comments | « net/http/http_response_headers.cc ('k') | net/http/http_version.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698