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

Unified Diff: net/http/http_response_info_unittest.cc

Issue 2294373002: Certificate Transparency: Remove the obsolete invalid sct status. (Closed)
Patch Set: Making common headers available to nacl code Created 4 years, 3 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_info.cc ('k') | net/net.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_response_info_unittest.cc
diff --git a/net/http/http_response_info_unittest.cc b/net/http/http_response_info_unittest.cc
index 75ae43532c4d71aeead410bbd4d3589a886d8afb..c1f28f7cabe25797ec7832b2697ff962fe82aee3 100644
--- a/net/http/http_response_info_unittest.cc
+++ b/net/http/http_response_info_unittest.cc
@@ -5,7 +5,10 @@
#include "net/http/http_response_info.h"
#include "base/pickle.h"
+#include "net/cert/signed_certificate_timestamp.h"
+#include "net/cert/signed_certificate_timestamp_and_status.h"
#include "net/http/http_response_headers.h"
+#include "net/test/ct_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
@@ -90,6 +93,36 @@ TEST_F(HttpResponseInfoTest, AsyncRevalidationRequiredNotPersisted) {
EXPECT_FALSE(restored_response_info.async_revalidation_required);
}
+TEST_F(HttpResponseInfoTest, FailsInitFromPickleWithInvalidSCTStatus) {
+ // A valid certificate is needed for ssl_info.is_valid() to be true
+ // so that the SCTs would be serialized.
+ const std::string der_test_cert(net::ct::GetDerEncodedX509Cert());
+ response_info_.ssl_info.cert = net::X509Certificate::CreateFromBytes(
+ der_test_cert.data(), der_test_cert.length());
+
+ scoped_refptr<ct::SignedCertificateTimestamp> sct;
+ ct::GetX509CertSCT(&sct);
Jeffrey Yasskin 2016/09/15 19:10:14 FYI, this fails to initialize the 'origin' field,
+
+ response_info_.ssl_info.signed_certificate_timestamps.push_back(
+ SignedCertificateTimestampAndStatus(
+ sct, ct::SCTVerifyStatus::SCT_STATUS_LOG_UNKNOWN));
+
+ base::Pickle pickle;
+ response_info_.Persist(&pickle, false, false);
+ bool truncated = false;
+ net::HttpResponseInfo restored_response_info;
+ EXPECT_TRUE(restored_response_info.InitFromPickle(pickle, &truncated));
+
+ response_info_.ssl_info.signed_certificate_timestamps.push_back(
+ SignedCertificateTimestampAndStatus(sct,
+ static_cast<ct::SCTVerifyStatus>(2)));
+ base::Pickle pickle_invalid;
+ response_info_.Persist(&pickle_invalid, false, false);
+ net::HttpResponseInfo restored_invalid_response;
+ EXPECT_FALSE(
+ restored_invalid_response.InitFromPickle(pickle_invalid, &truncated));
+}
+
} // namespace
} // namespace net
« no previous file with comments | « net/http/http_response_info.cc ('k') | net/net.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698