Index: net/http/transport_security_state_unittest.cc |
diff --git a/net/http/transport_security_state_unittest.cc b/net/http/transport_security_state_unittest.cc |
index 2026aa5b7038c673a03a27655ad2f825f5bb134b..18cfeafee105af5d4233c6b974fe30f0a14f3530 100644 |
--- a/net/http/transport_security_state_unittest.cc |
+++ b/net/http/transport_security_state_unittest.cc |
@@ -95,6 +95,10 @@ class MockCertificateReportSender |
latest_report_ = report; |
} |
+ void SetContentTypeHeader(const std::string& content_type) override { |
+ latest_content_type_ = content_type; |
+ } |
+ |
void SetErrorCallback( |
const base::Callback<void(const GURL&, int)>& error_callback) override {} |
@@ -105,10 +109,12 @@ class MockCertificateReportSender |
const GURL& latest_report_uri() { return latest_report_uri_; } |
const std::string& latest_report() { return latest_report_; } |
+ const std::string& latest_content_type() { return latest_content_type_; } |
private: |
GURL latest_report_uri_; |
std::string latest_report_; |
+ std::string latest_content_type_; |
}; |
// A mock ReportSenderInterface that simulates a net error on every report sent. |
@@ -126,6 +132,8 @@ class MockFailingCertificateReportSender |
error_callback_.Run(report_uri, net_error_); |
} |
+ void SetContentTypeHeader(const std::string& content_type) override {} |
+ |
void SetErrorCallback( |
const base::Callback<void(const GURL&, int)>& error_callback) override { |
error_callback_ = error_callback; |
@@ -333,6 +341,7 @@ void CheckExpectStapleReport(TransportSecurityState* state, |
const std::string& ocsp_response, |
const std::string& response_status, |
const std::string& cert_status) { |
+ EXPECT_EQ("application/json", reporter->latest_content_type()); |
// Expect-Staple is preload list based, so we use the baked-in test hostname |
// from the list ("preloaded-expect-staple.badssl.com"). |
HostPortPair host_port(kExpectStapleStaticHostname, 443); |
@@ -1442,6 +1451,7 @@ TEST_F(TransportSecurityStateTest, HPKPReporting) { |
// Now a report should have been sent. Check that it contains the |
// right information. |
EXPECT_EQ(report_uri, mock_report_sender.latest_report_uri()); |
+ EXPECT_EQ("application/json", mock_report_sender.latest_content_type()); |
std::string report = mock_report_sender.latest_report(); |
ASSERT_FALSE(report.empty()); |
ASSERT_NO_FATAL_FAILURE(CheckHPKPReport(report, host_port_pair, true, kHost, |
@@ -1457,6 +1467,7 @@ TEST_F(TransportSecurityStateTest, HPKPReporting) { |
// Now a report should have been sent for the subdomain. Check that it |
// contains the right information. |
EXPECT_EQ(report_uri, mock_report_sender.latest_report_uri()); |
+ EXPECT_EQ("application/json", mock_report_sender.latest_content_type()); |
report = mock_report_sender.latest_report(); |
ASSERT_FALSE(report.empty()); |
ASSERT_NO_FATAL_FAILURE(CheckHPKPReport(report, subdomain_host_port_pair, |