Index: net/base/transport_security_state_unittest.cc |
=================================================================== |
--- net/base/transport_security_state_unittest.cc (revision 141792) |
+++ net/base/transport_security_state_unittest.cc (working copy) |
@@ -830,19 +830,16 @@ |
static bool AddHash(const std::string& type_and_base64, |
FingerprintVector* out) { |
- std::string hash_str; |
- if (type_and_base64.find("sha1/") == 0 && |
- base::Base64Decode(type_and_base64.substr(5, type_and_base64.size() - 5), |
- &hash_str) && |
- hash_str.size() == base::kSHA1Length) { |
- SHA1Fingerprint hash; |
- memcpy(hash.data, hash_str.data(), sizeof(hash.data)); |
- out->push_back(hash); |
- return true; |
- } |
- return false; |
+ Fingerprint hash; |
+ |
+ if (!TransportSecurityState::ParsePin(type_and_base64, &hash)) |
+ return false; |
+ |
+ out->push_back(hash); |
+ return true; |
} |
+ |
TEST_F(TransportSecurityStateTest, PinValidationWithRejectedCerts) { |
// kGoodPath is plus.google.com via Google Internet Authority. |
static const char* kGoodPath[] = { |
@@ -862,7 +859,7 @@ |
NULL, |
}; |
- std::vector<net::SHA1Fingerprint> good_hashes, bad_hashes; |
+ std::vector<net::Fingerprint> good_hashes, bad_hashes; |
for (size_t i = 0; kGoodPath[i]; i++) { |
EXPECT_TRUE(AddHash(kGoodPath[i], &good_hashes)); |
@@ -898,7 +895,7 @@ |
NULL, |
}; |
- std::vector<net::SHA1Fingerprint> good_hashes, bad_hashes; |
+ std::vector<net::Fingerprint> good_hashes, bad_hashes; |
for (size_t i = 0; kGoodPath[i]; i++) { |
EXPECT_TRUE(AddHash(kGoodPath[i], &good_hashes)); |