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

Unified Diff: net/http/http_util_unittest.cc

Issue 1481143002: Added HttpUtils::HasValidators and HttpResponse::HasValidators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed first batch of bengr@'s comments Created 5 years 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
« net/http/http_util.h ('K') | « net/http/http_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_util_unittest.cc
diff --git a/net/http/http_util_unittest.cc b/net/http/http_util_unittest.cc
index a5c984db66b1f5e46798036e8c1ac3758fab9f81..6579f93e9eb7ebcd34a345659e040fb77111d01e 100644
--- a/net/http/http_util_unittest.cc
+++ b/net/http/http_util_unittest.cc
@@ -1178,4 +1178,45 @@ TEST(HttpUtilTest, NameValuePairsIteratorMissingEndQuote) {
&parser, false, true, std::string(), std::string()));
}
+TEST(HttpUtilTest, HasValidatorsHttp09) {
+ std::string etags[] = {"", "\"strong\"", "W/\"weak\""};
+ std::string last_modified_values[] = {"", "Tue, 15 Nov 1994 12:45:26 GMT",
+ "invalid"};
+
+ for (const std::string& etag : etags) {
+ for (const std::string& last_modified : last_modified_values) {
+ EXPECT_FALSE(
+ HttpUtil::HasValidators(HttpVersion(0, 9), etag, last_modified));
+ }
+ }
+}
+
+TEST(HttpUtilTest, HasValidatorsHttp10) {
+ std::string etags[] = {"", "\"strong\"", "W/\"weak\""};
+ std::string last_modified_values[] = {"", "Tue, 15 Nov 1994 12:45:26 GMT",
+ "invalid"};
+
+ for (const std::string& etag : etags) {
+ for (const std::string& last_modified : last_modified_values) {
+ EXPECT_EQ(
+ last_modified != "" && last_modified != "invalid",
+ HttpUtil::HasValidators(HttpVersion(1, 0), etag, last_modified));
+ }
+ }
+}
+
+TEST(HttpUtilTest, HasValidatorsHttp11) {
+ std::string etags[] = {"", "\"strong\"", "W/\"weak\""};
+ std::string last_modified_values[] = {"", "Tue, 15 Nov 1994 12:45:26 GMT",
+ "invalid"};
+
+ for (const std::string& etag : etags) {
+ for (const std::string& last_modified : last_modified_values) {
+ EXPECT_EQ(
+ etag != "" || (last_modified != "" && last_modified != "invalid"),
+ HttpUtil::HasValidators(HttpVersion(1, 1), etag, last_modified));
+ }
+ }
+}
+
} // namespace net
« net/http/http_util.h ('K') | « net/http/http_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698