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

Unified Diff: components/update_client/url_request_post_interceptor.cc

Issue 2827233005: Remove URLRequestJob::GetResponseCode implementations outside of net/. (Closed)
Patch Set: Response to comments Created 3 years, 8 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 | « no previous file | extensions/browser/extension_protocols.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/update_client/url_request_post_interceptor.cc
diff --git a/components/update_client/url_request_post_interceptor.cc b/components/update_client/url_request_post_interceptor.cc
index 3850160612036dd51a96f82183d98c70af866b63..9753cb9fa99905baa4555614abfd0aac3ff1e95b 100644
--- a/components/update_client/url_request_post_interceptor.cc
+++ b/components/update_client/url_request_post_interceptor.cc
@@ -8,10 +8,13 @@
#include "base/files/file_util.h"
#include "base/macros.h"
+#include "base/memory/ref_counted.h"
#include "base/strings/stringprintf.h"
#include "components/update_client/test_configurator.h"
#include "net/base/upload_bytes_element_reader.h"
#include "net/base/upload_data_stream.h"
+#include "net/http/http_response_headers.h"
+#include "net/http/http_util.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_filter.h"
#include "net/url_request/url_request_interceptor.h"
@@ -32,7 +35,12 @@ class URLRequestMockJob : public net::URLRequestSimpleJob {
response_body_(response_body) {}
protected:
- int GetResponseCode() const override { return response_code_; }
+ void GetResponseInfo(net::HttpResponseInfo* info) override {
+ const std::string headers =
+ base::StringPrintf("HTTP/1.1 %i OK\r\n\r\n", response_code_);
+ info->headers = base::MakeShared<net::HttpResponseHeaders>(
+ net::HttpUtil::AssembleRawHeaders(headers.c_str(), headers.length()));
+ }
int GetData(std::string* mime_type,
std::string* charset,
« no previous file with comments | « no previous file | extensions/browser/extension_protocols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698