Chromium Code Reviews| 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)); |
|
twifkak
2016/02/22 23:44:44
add `<< "with etag = " << etag << " and last_modif
jamartin
2016/02/23 14:03:35
I've applied your second suggestion, which obsolet
|
| + } |
| + } |
|
twifkak
2016/02/22 23:44:44
There are 3*3=9 etag/last-modified pairs.
Suggest
jamartin
2016/02/23 14:03:35
Done.
There is one advantage of the loop approach
twifkak
2016/02/24 21:07:38
LGTM. Some rambling thoughts: Agreed, that the log
|
| +} |
| + |
| +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 |