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

Unified Diff: net/http/http_security_headers_unittest.cc

Issue 826423009: Treat HSTS and HPKP state independently. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test header parsing too Created 5 years, 11 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
Index: net/http/http_security_headers_unittest.cc
diff --git a/net/http/http_security_headers_unittest.cc b/net/http/http_security_headers_unittest.cc
index d09f6fd308d49ab6dc5c207f6b8d91b72aad52ad..2c468df55ebfe3a1693c26221d8e5f1d2ae32924 100644
--- a/net/http/http_security_headers_unittest.cc
+++ b/net/http/http_security_headers_unittest.cc
@@ -391,6 +391,7 @@ static void TestValidPKPHeaders(HashValueTag tag) {
// The good pin must be in the chain, the backup pin must not be
std::string good_pin = GetTestPin(2, tag);
+ std::string good_pin2 = GetTestPin(3, tag);
std::string backup_pin = GetTestPin(4, tag);
EXPECT_TRUE(ParseHPKPHeader(
@@ -468,8 +469,7 @@ static void TestValidPKPHeaders(HashValueTag tag) {
EXPECT_EQ(expect_max_age, max_age);
EXPECT_FALSE(include_subdomains);
- // Test that parsing the same header twice doesn't duplicate the recorded
- // hashes.
+ // Test that parsing a different header resets the hashes.
Ryan Sleevi 2015/01/13 21:56:40 Is there any test for when we have one pin header,
davidben 2015/01/13 23:30:47 Added one. (Although it wasn't a bug in the old ve
hashes.clear();
EXPECT_TRUE(ParseHPKPHeader(
" max-age=999; " +
@@ -477,9 +477,8 @@ static void TestValidPKPHeaders(HashValueTag tag) {
chain_hashes, &max_age, &include_subdomains, &hashes));
EXPECT_EQ(2u, hashes.size());
EXPECT_TRUE(ParseHPKPHeader(
- " max-age=999; " +
- backup_pin + ";" + good_pin + "; ",
- chain_hashes, &max_age, &include_subdomains, &hashes));
+ " max-age=999; " + backup_pin + ";" + good_pin2 + "; ", chain_hashes,
+ &max_age, &include_subdomains, &hashes));
EXPECT_EQ(2u, hashes.size());
}

Powered by Google App Engine
This is Rietveld 408576698