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

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

Issue 1310743003: Consistently use LoFi for an entire page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fixes Created 5 years, 4 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: components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc
index 511f8d993e53832865d5c97d8a1d40ca636dd02e..4f864cea8d3ce0bed70bdf45a651ddd1fcb0f1ab 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc
@@ -154,11 +154,10 @@ class DataReductionProxyRequestOptionsTest : public testing::Test {
request_options_->Init();
}
- void CreateRequest(int load_flags) {
+ void CreateRequest() {
net::URLRequestContext* context =
test_context_->request_context_getter()->GetURLRequestContext();
request_ = context->CreateRequest(GURL(), net::DEFAULT_PRIORITY, nullptr);
- request_->SetLoadFlags(load_flags);
}
TestDataReductionProxyParams* params() {
@@ -291,8 +290,11 @@ TEST_F(DataReductionProxyRequestOptionsTest, LoFiOnThroughCommandLineSwitch) {
SetHeaderExpectations(kExpectedSession, kExpectedCredentials, std::string(),
kClientStr, std::string(), std::string(), std::string(),
std::vector<std::string>(), &expected_header);
-
- test_context_->config()->UpdateLoFiStatusOnMainFrameRequest(false, nullptr);
+ CreateRequest();
+ request_->set_lofi_state(
+ test_context_->config()->ShouldTurnOnLoFiOnMainFrameRequest(nullptr)
+ ? net::LOFI_ON
+ : net::LOFI_OFF);
CreateRequestOptions(kBogusVersion);
VerifyExpectedHeader(params()->DefaultOrigin(), expected_header);
@@ -306,7 +308,10 @@ TEST_F(DataReductionProxyRequestOptionsTest, LoFiOnThroughCommandLineSwitch) {
kClientStr, std::string(), std::string(), "low",
std::vector<std::string>(), &expected_header);
- test_context_->config()->UpdateLoFiStatusOnMainFrameRequest(false, nullptr);
+ request_->set_lofi_state(
+ test_context_->config()->ShouldTurnOnLoFiOnMainFrameRequest(nullptr)
+ ? net::LOFI_ON
+ : net::LOFI_OFF);
CreateRequestOptions(kBogusVersion);
VerifyExpectedHeader(params()->DefaultOrigin(), expected_header);
}
@@ -355,8 +360,12 @@ TEST_F(DataReductionProxyRequestOptionsTest, AutoLoFi) {
test_context_->config()->SetNetworkProhibitivelySlow(
tests[i].network_prohibitively_slow);
+ CreateRequest();
// Force update Lo-Fi status.
- test_context_->config()->UpdateLoFiStatusOnMainFrameRequest(false, nullptr);
+ request_->set_lofi_state(
+ test_context_->config()->ShouldTurnOnLoFiOnMainFrameRequest(nullptr)
+ ? net::LOFI_ON
+ : net::LOFI_OFF);
CreateRequestOptions(kBogusVersion);
VerifyExpectedHeader(params()->DefaultOrigin(), expected_header);
@@ -433,8 +442,12 @@ TEST_F(DataReductionProxyRequestOptionsTest, SlowConnectionsFlag) {
test_context_->config()->SetNetworkProhibitivelySlow(
tests[i].network_prohibitively_slow);
+ CreateRequest();
// Force update Lo-Fi status.
- test_context_->config()->UpdateLoFiStatusOnMainFrameRequest(false, nullptr);
+ request_->set_lofi_state(
+ test_context_->config()->ShouldTurnOnLoFiOnMainFrameRequest(nullptr)
+ ? net::LOFI_ON
+ : net::LOFI_OFF);
CreateRequestOptions(kBogusVersion);
VerifyExpectedHeader(params()->DefaultOrigin(), expected_header);

Powered by Google App Engine
This is Rietveld 408576698