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

Unified Diff: net/http/http_response_headers_unittest.cc

Issue 1481143002: Added HttpUtils::HasValidators and HttpResponse::HasValidators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clarified the documentation Created 4 years, 10 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_util.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 cb0d200b2e76220a71e3379082a92a7c47e63244..70a5d09562a4a13d31f0c7bfebb92e64513ec74b 100644
--- a/net/http/http_response_headers_unittest.cc
+++ b/net/http/http_response_headers_unittest.cc
@@ -1634,6 +1634,40 @@ INSTANTIATE_TEST_CASE_P(HttpResponseHeaders,
HasStrongValidatorsTest,
testing::ValuesIn(strong_validators_tests));
+TEST(HttpResponseHeadersTest, HasValidatorsNone) {
+ std::string headers("HTTP/1.1 200 OK");
+ HeadersToRaw(&headers);
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
+ EXPECT_FALSE(parsed->HasValidators());
+}
+
+TEST(HttpResponseHeadersTest, HasValidatorsEtag) {
+ std::string headers(
+ "HTTP/1.1 200 OK\n"
+ "etag: \"anything\"");
+ HeadersToRaw(&headers);
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
+ EXPECT_TRUE(parsed->HasValidators());
+}
+
+TEST(HttpResponseHeadersTest, HasValidatorsLastModified) {
+ std::string headers(
+ "HTTP/1.1 200 OK\n"
+ "Last-Modified: Wed, 28 Nov 2007 00:40:10 GMT");
+ HeadersToRaw(&headers);
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
+ EXPECT_TRUE(parsed->HasValidators());
+}
+
+TEST(HttpResponseHeadersTest, HasValidatorsWeakEtag) {
+ std::string headers(
+ "HTTP/1.1 200 OK\n"
+ "etag: W/\"anything\"");
+ HeadersToRaw(&headers);
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
+ EXPECT_TRUE(parsed->HasValidators());
+}
+
struct AddHeaderTestData {
const char* orig_headers;
const char* new_header;
« no previous file with comments | « net/http/http_response_headers.cc ('k') | net/http/http_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698