Chromium Code Reviews| 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..24daca97c62d0c4136eb53dab5d77d5a5c2465de 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 |
| @@ -314,21 +314,11 @@ TEST_F(DataReductionProxyRequestOptionsTest, LoFiOnThroughCommandLineSwitch) { |
| TEST_F(DataReductionProxyRequestOptionsTest, AutoLoFi) { |
| const struct { |
| bool auto_lofi_enabled_group; |
| + bool auto_lofi_control_group; |
| bool network_prohibitively_slow; |
| - |
| } tests[] = { |
| - { |
| - false, false, |
| - }, |
| - { |
| - false, true, |
| - }, |
| - { |
| - true, false, |
| - }, |
| - { |
| - true, true, |
| - }, |
| + {false, false, false}, {false, false, true}, {true, false, false}, |
| + {true, false, true}, {false, true, false}, {false, true, true}, |
| }; |
| for (size_t i = 0; i < arraysize(tests); ++i) { |
| @@ -337,6 +327,8 @@ TEST_F(DataReductionProxyRequestOptionsTest, AutoLoFi) { |
| // trial and network is prohibitively slow. |
| bool expect_lofi_header = |
| tests[i].auto_lofi_enabled_group && tests[i].network_prohibitively_slow; |
| + bool expect_lofi_experiment_header = |
| + tests[i].auto_lofi_control_group && tests[i].network_prohibitively_slow; |
| std::string expected_header; |
| if (!expect_lofi_header) { |
| @@ -350,8 +342,15 @@ TEST_F(DataReductionProxyRequestOptionsTest, AutoLoFi) { |
| std::string(), "low", std::vector<std::string>(), |
| &expected_header); |
| } |
| + |
| + if (expect_lofi_experiment_header) { |
| + expected_header = expected_header.append(", exp="); |
| + expected_header = expected_header.append(kLoFiExperimentID); |
| + } |
| test_context_->config()->SetIncludedInLoFiEnabledFieldTrial( |
| tests[i].auto_lofi_enabled_group); |
| + test_context_->config()->SetIncludedInLoFiControlFieldTrial( |
| + tests[i].auto_lofi_control_group); |
| test_context_->config()->SetNetworkProhibitivelySlow( |
| tests[i].network_prohibitively_slow); |
| @@ -453,19 +452,40 @@ TEST_F(DataReductionProxyRequestOptionsTest, SecureSession) { |
| } |
| TEST_F(DataReductionProxyRequestOptionsTest, ParseExperiments) { |
| - base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| - data_reduction_proxy::switches::kDataReductionProxyExperiment, |
| - "staging,\"foo,bar\""); |
| - std::vector<std::string> expected_experiments; |
| - expected_experiments.push_back("staging"); |
| - expected_experiments.push_back("\"foo,bar\""); |
| - std::string expected_header; |
| - SetHeaderExpectations(kExpectedSession, kExpectedCredentials, std::string(), |
| - kClientStr, std::string(), std::string(), std::string(), |
| - expected_experiments, &expected_header); |
| + const struct { |
| + bool lofi_experiment; |
|
megjablon
2015/10/01 18:54:44
lofi_active_control ?
tbansal1
2015/10/02 16:50:43
obsolete.
|
| + } tests[] = { |
| + {false}, {true}, |
| + }; |
| - CreateRequestOptions(kBogusVersion); |
| - VerifyExpectedHeader(params()->DefaultOrigin(), expected_header); |
| + for (size_t i = 0; i < arraysize(tests); ++i) { |
| + test_context_->config()->ResetLoFiStatusForTest(); |
| + test_context_->config()->SetIncludedInLoFiControlFieldTrial( |
| + tests[i].lofi_experiment); |
| + test_context_->config()->SetNetworkProhibitivelySlow( |
| + tests[i].lofi_experiment); |
| + |
| + // Force update Lo-Fi status. |
| + test_context_->config()->UpdateLoFiStatusOnMainFrameRequest(false, nullptr); |
| + |
| + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| + data_reduction_proxy::switches::kDataReductionProxyExperiment, |
| + "staging,\"foo,bar\""); |
| + std::vector<std::string> expected_experiments; |
| + expected_experiments.push_back("staging"); |
| + expected_experiments.push_back("\"foo,bar\""); |
| + if (tests[i].lofi_experiment) |
| + expected_experiments.push_back(kLoFiExperimentID); |
| + |
| + std::string expected_header; |
| + SetHeaderExpectations(kExpectedSession, kExpectedCredentials, std::string(), |
| + kClientStr, std::string(), std::string(), |
| + std::string(), expected_experiments, |
| + &expected_header); |
| + |
| + CreateRequestOptions(kBogusVersion); |
| + VerifyExpectedHeader(params()->DefaultOrigin(), expected_header); |
| + } |
| } |
| TEST_F(DataReductionProxyRequestOptionsTest, ParseLocalSessionKey) { |