| Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc
|
| diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc
|
| index 6bf0dfb65e02a81bb9c5c27d1d7c3d182f6fd93f..1e395ff8a27829274c58ea540f5d39e8eb6d0e34 100644
|
| --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc
|
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc
|
| @@ -858,132 +858,6 @@ TEST_F(DataReductionProxyConfigTest, IsDataReductionProxyWithMutableConfig) {
|
| }
|
| }
|
|
|
| -TEST_F(DataReductionProxyConfigTest, LoFiOn) {
|
| - const struct {
|
| - bool lofi_switch_enabled;
|
| - bool lofi_enabled_field_trial_group;
|
| - bool network_prohibitively_slow;
|
| - bool expect_lofi_header;
|
| - int bucket_to_check_for_auto_lofi_uma;
|
| - int expect_bucket_count;
|
| -
|
| - } tests[] = {
|
| - {
|
| - // Lo-Fi off.
|
| - false,
|
| - false,
|
| - false,
|
| - false,
|
| - 0,
|
| - 0, // not in enabled field trial, UMA is not recorded
|
| - },
|
| - {
|
| - // In enabled field trial group but network quality is not bad.
|
| - false,
|
| - true,
|
| - false,
|
| - false,
|
| - 0,
|
| - 1, // Lo-Fi request header is not used (state change: empty to empty)
|
| - },
|
| - {
|
| - // Not in enabled field trial group and network quality is bad.
|
| - false,
|
| - false,
|
| - true,
|
| - false,
|
| - 0,
|
| - 0, // not in enabled field trial, UMA is not recorded
|
| - },
|
| - {
|
| - // In enabled field trial group and network quality is bad.
|
| - false,
|
| - true,
|
| - true,
|
| - true,
|
| - 1,
|
| - 1, // Lo-Fi request header is now used (state change: empty to low)
|
| - },
|
| - {
|
| - // Lo-Fi enabled through command line switch.
|
| - true,
|
| - false,
|
| - false,
|
| - true,
|
| - 0,
|
| - 0, // not in enabled field trial, UMA is not recorded
|
| - },
|
| - };
|
| - for (size_t i = 0; i < arraysize(tests); ++i) {
|
| - config()->ResetLoFiStatusForTest();
|
| - if (tests[i].lofi_switch_enabled) {
|
| - base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
| - switches::kDataReductionProxyLoFi,
|
| - switches::kDataReductionProxyLoFiValueAlwaysOn);
|
| - }
|
| -
|
| - EXPECT_CALL(*config(), IsIncludedInLoFiEnabledFieldTrial())
|
| - .WillRepeatedly(
|
| - testing::Return(tests[i].lofi_enabled_field_trial_group));
|
| -
|
| - EXPECT_CALL(*config(), IsNetworkQualityProhibitivelySlow(_))
|
| - .WillRepeatedly(testing::Return(tests[i].network_prohibitively_slow));
|
| -
|
| - base::HistogramTester histogram_tester;
|
| - config()->UpdateLoFiStatusOnMainFrameRequest(false, nullptr);
|
| - if (tests[i].expect_bucket_count != 0) {
|
| - histogram_tester.ExpectBucketCount(
|
| - "DataReductionProxy.AutoLoFiRequestHeaderState.Unknown",
|
| - tests[i].bucket_to_check_for_auto_lofi_uma,
|
| - tests[i].expect_bucket_count);
|
| - }
|
| -
|
| - EXPECT_EQ(tests[i].expect_lofi_header,
|
| - config()->ShouldUseLoFiHeaderForRequests())
|
| - << i;
|
| - }
|
| -}
|
| -
|
| -TEST_F(DataReductionProxyConfigTest, LoFiStatusTransition) {
|
| - const struct {
|
| - bool lofi_switch_enabled;
|
| - } tests[] = {
|
| - {
|
| - false,
|
| - },
|
| - {
|
| - true,
|
| - },
|
| - };
|
| -
|
| - for (size_t i = 0; i < arraysize(tests); ++i) {
|
| - config()->ResetLoFiStatusForTest();
|
| - if (tests[i].lofi_switch_enabled) {
|
| - base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
| - switches::kDataReductionProxyLoFi,
|
| - switches::kDataReductionProxyLoFiValueAlwaysOn);
|
| - } else {
|
| - EXPECT_CALL(*config(), IsIncludedInLoFiEnabledFieldTrial())
|
| - .WillRepeatedly(testing::Return(true));
|
| -
|
| - EXPECT_CALL(*config(), IsNetworkQualityProhibitivelySlow(_))
|
| - .WillRepeatedly(testing::Return(true));
|
| - }
|
| -
|
| - // First, set the status to enabled.
|
| - config()->UpdateLoFiStatusOnMainFrameRequest(false, nullptr);
|
| - EXPECT_EQ(true, config()->ShouldUseLoFiHeaderForRequests()) << i;
|
| -
|
| - // Full page reload with Lo-Fi disabled (main frame request).
|
| - config()->UpdateLoFiStatusOnMainFrameRequest(true, nullptr);
|
| - EXPECT_FALSE(config()->ShouldUseLoFiHeaderForRequests()) << i;
|
| -
|
| - // New page load (main frame request).
|
| - config()->UpdateLoFiStatusOnMainFrameRequest(false, nullptr);
|
| - EXPECT_EQ(true, config()->ShouldUseLoFiHeaderForRequests()) << i;
|
| - }
|
| -}
|
| -
|
| // Overrides net::NetworkQualityEstimator for testing.
|
| class TestNetworkQualityEstimator : public net::NetworkQualityEstimator {
|
| public:
|
|
|