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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc

Issue 1463583003: Move adding Lo-Fi directives from DRPRequestOptions to ContentLoFiDecider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing tbansal comments Created 5 years, 1 month 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: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
index b27e414b096519613531a34f59d7ca8b5b50c57e..3232d5512a44852c0af6116d84afff81f5fe75ee 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
@@ -83,6 +83,27 @@ class TestLoFiDecider : public LoFiDecider {
should_request_lofi_resource_ = should_request_lofi_resource;
}
+ bool MaybeAddLoFiDirectiveToHeaders(
+ const net::URLRequest& request,
+ net::HttpRequestHeaders* headers) const override {
+ if (should_request_lofi_resource_) {
+ const char kChromeProxyHeader[] = "Chrome-Proxy";
+ std::string header_value;
+
+ if (headers->HasHeader(kChromeProxyHeader)) {
+ headers->GetHeader(kChromeProxyHeader, &header_value);
+ headers->RemoveHeader(kChromeProxyHeader);
+ header_value += ", ";
+ }
+
+ header_value += "q=low";
+ headers->SetHeader(kChromeProxyHeader, header_value);
+ return true;
+ }
+
+ return false;
+ }
+
private:
bool should_request_lofi_resource_;
};

Powered by Google App Engine
This is Rietveld 408576698