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

Unified Diff: net/url_request/url_request_unittest.cc

Issue 2365353004: Add Content-Type header to net::ReportSender reports (Closed)
Patch Set: update some unit test subclasses 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
Index: net/url_request/url_request_unittest.cc
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index 328d53b81091a6faab351c398c38a2129ca8acc9..7de87a63d8554b18b66ab276ea95c55cb86f55a0 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -680,15 +680,21 @@ 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 {}
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_;
};
class TestExperimentalFeaturesNetworkDelegate : public TestNetworkDelegate {
@@ -6022,6 +6028,7 @@ TEST_F(URLRequestTestHTTP, ProcessPKPAndSendReport) {
// Check that a report was sent.
EXPECT_EQ(report_uri, mock_report_sender.latest_report_uri());
ASSERT_FALSE(mock_report_sender.latest_report().empty());
+ EXPECT_EQ("application/json", mock_report_sender.latest_content_type());
std::unique_ptr<base::Value> value(
base::JSONReader::Read(mock_report_sender.latest_report()));
ASSERT_TRUE(value);
@@ -6085,6 +6092,7 @@ TEST_F(URLRequestTestHTTP, ProcessPKPReportOnly) {
// Check that a report was sent.
EXPECT_EQ(report_uri, mock_report_sender.latest_report_uri());
ASSERT_FALSE(mock_report_sender.latest_report().empty());
+ EXPECT_EQ("application/json", mock_report_sender.latest_content_type());
std::unique_ptr<base::Value> value(
base::JSONReader::Read(mock_report_sender.latest_report()));
ASSERT_TRUE(value);
@@ -9237,6 +9245,7 @@ TEST_F(HTTPSOCSPTest, ExpectStapleReportSentOnMissing) {
// Confirm a report was sent.
EXPECT_FALSE(mock_report_sender.latest_report().empty());
+ EXPECT_EQ("application/json", mock_report_sender.latest_content_type());
EXPECT_EQ(GURL(kExpectStapleReportURI),
mock_report_sender.latest_report_uri());
}
« net/http/transport_security_state.h ('K') | « net/url_request/report_sender_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698