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

Unified Diff: net/url_request/report_sender_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/report_sender_unittest.cc
diff --git a/net/url_request/report_sender_unittest.cc b/net/url_request/report_sender_unittest.cc
index 2143fbac8762c318b4f9e482dc66c9b2e70a0e5c..daafab8ded5f4e9dea6c899a682da25bd9f2033f 100644
--- a/net/url_request/report_sender_unittest.cc
+++ b/net/url_request/report_sender_unittest.cc
@@ -87,6 +87,10 @@ class TestReportSenderNetworkDelegate : public NetworkDelegateImpl {
expect_cookies_ = expect_cookies;
}
+ void set_expected_content_type(const std::string& expected_content_type) {
+ expected_content_type_ = expected_content_type;
+ }
+
// NetworkDelegateImpl implementation.
int OnBeforeURLRequest(URLRequest* request,
const CompletionCallback& callback,
@@ -103,6 +107,15 @@ class TestReportSenderNetworkDelegate : public NetworkDelegateImpl {
EXPECT_TRUE(request->load_flags() & LOAD_DO_NOT_SAVE_COOKIES);
}
+ if (!expected_content_type_.empty()) {
+ HttpRequestHeaders headers;
+ request->GetFullRequestHeaders(&headers);
+ std::string content_type;
+ EXPECT_TRUE(
+ headers.GetHeader(HttpRequestHeaders::kContentType, &content_type));
+ EXPECT_EQ(expected_content_type_, content_type);
+ }
+
CheckUploadData(*request, &expect_reports_);
// Unconditionally return OK, since the sender ignores the results
@@ -123,6 +136,7 @@ class TestReportSenderNetworkDelegate : public NetworkDelegateImpl {
GURL expect_url_;
std::set<std::string> expect_reports_;
bool expect_cookies_;
+ std::string expected_content_type_;
DISALLOW_COPY_AND_ASSIGN(TestReportSenderNetworkDelegate);
};

Powered by Google App Engine
This is Rietveld 408576698