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

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: Created 5 years, 1 month 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
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 ead30dd1dd27d5450ef3936c86fade5d59c6a224..04e030b5082f35d6a78c83e0ab81304ee9946b50 100644
--- a/net/http/http_response_headers_unittest.cc
+++ b/net/http/http_response_headers_unittest.cc
@@ -1801,6 +1801,40 @@ INSTANTIATE_TEST_CASE_P(HttpResponseHeaders,
HasStrongValidatorsTest,
testing::ValuesIn(strong_validators_tests));
+TEST(HttpResponseHeadersTest, HasValidatorsNone) {
bengr 2015/12/03 17:42:21 Add tests that expect false when the HTTP version
jamartin (wrong) 2015/12/08 16:58:18 Those test are already in http_util_unittest.cc, w
+ 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");
bengr 2015/12/03 17:42:21 Add a test that expects false when last-modified h
jamartin (wrong) 2015/12/08 16:58:18 Please see my reply above.
+ 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());
+}
+
TEST(HttpResponseHeadersTest, GetStatusText) {
std::string headers("HTTP/1.1 404 Not Found");
HeadersToRaw(&headers);

Powered by Google App Engine
This is Rietveld 408576698