diff options
author | tbansal <tbansal@chromium.org> | 2015-11-30 20:36:33 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-01 04:38:06 +0000 |
commit | 88ec61a239520d3e96265484d9bc41dfcff8fa11 (patch) | |
tree | 1ccb69c99bc94a4b12559ae235c165e87309c819 /components | |
parent | 85a123b034707c340c03e88a914bfa3cef0f9e18 (diff) | |
download | chromium_src-88ec61a239520d3e96265484d9bc41dfcff8fa11.zip chromium_src-88ec61a239520d3e96265484d9bc41dfcff8fa11.tar.gz chromium_src-88ec61a239520d3e96265484d9bc41dfcff8fa11.tar.bz2 |
Put Lo-Fi in Enabled field trial group if the group
name starts with Enabled.
BUG=563806
Review URL: https://codereview.chromium.org/1485673004
Cr-Commit-Position: refs/heads/master@{#362347}
Diffstat (limited to 'components')
-rw-r--r-- | components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc | 51 | ||||
-rw-r--r-- | components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc | 4 |
2 files changed, 42 insertions, 13 deletions
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 654f74c..5034106 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 @@ -787,7 +787,7 @@ TEST_F(DataReductionProxyConfigTest, IsDataReductionProxyWithMutableConfig) { TEST_F(DataReductionProxyConfigTest, LoFiOn) { const struct { bool lofi_switch_enabled; - bool lofi_enabled_field_trial_group; + const std::string lofi_field_trial_group_name; bool network_prohibitively_slow; bool expect_lofi_header; int bucket_to_check_for_auto_lofi_uma; @@ -796,48 +796,76 @@ TEST_F(DataReductionProxyConfigTest, LoFiOn) { { // The Lo-Fi switch is off and the user is not in the enabled field // trial group. Lo-Fi should not be used. - false, false, false, false, 0, + false, std::string(), false, false, 0, 0, // not in enabled field trial, UMA is not recorded }, { // The Lo-Fi switch is off and the user is not in enabled field trial // group and the network quality is bad. Lo-Fi should not be used. - false, false, true, false, 0, + false, std::string(), true, false, 0, 0, // not in enabled field trial, UMA is not recorded }, { // Lo-Fi is enabled through command line switch. LoFi should be used. - true, false, false, true, 0, + true, std::string(), false, true, 0, 0, // not in enabled field trial, UMA is not recorded }, { // The user is in the enabled field trial group but the network // quality is not bad. Lo-Fi should not be used. - false, true, false, false, + false, "Enabled", false, false, + 0, // Lo-Fi request header is not used (state change: empty to empty) + 1, + }, + { + // The user is in the enabled field trial group but the network + // quality is not bad. Lo-Fi should not be used. + false, "Enabled_Control", false, false, 0, // Lo-Fi request header is not used (state change: empty to empty) 1, }, { // The user is in the enabled field trial group and the network // quality is bad. Lo-Fi should be used. - false, true, true, true, + false, "Enabled", true, true, 1, // Lo-Fi request header is now used (state change: empty to low) 1, }, { // The user is in the enabled field trial group and the network + // quality is bad. Lo-Fi should be used. + false, "Enabled_Control", true, true, + 3, // Lo-Fi request header is now used (state change: low to low) + 1, + }, + { + // The user is in the enabled field trial group and the network // quality is bad. Lo-Fi should be used again. - false, true, true, true, + false, "Enabled", true, true, + 3, // Lo-Fi request header is now used (state change: low to low) + 1, + }, + { + // The user is in the enabled field trial group and the network + // quality is bad. Lo-Fi should be used again. + false, "Enabled_Control", true, true, 3, // Lo-Fi request header is now used (state change: low to low) 1, }, { // The user is in the enabled field trial group but the network // quality is not bad. Lo-Fi should not be used. - false, true, false, false, + false, "Enabled", false, false, 2, // Lo-Fi request header is not used (state change: low to empty) 1, }, + { + // The user is in the enabled field trial group but the network + // quality is not bad. Lo-Fi should not be used. + false, "Enabled_Control", false, false, + 0, // Lo-Fi request header is not used (state change: empty to empty) + 1, + }, }; for (size_t i = 0; i < arraysize(tests); ++i) { config()->ResetLoFiStatusForTest(); @@ -851,9 +879,10 @@ TEST_F(DataReductionProxyConfigTest, LoFiOn) { } base::FieldTrialList field_trial_list(nullptr); - if (tests[i].lofi_enabled_field_trial_group) { - base::FieldTrialList::CreateFieldTrial(params::GetLoFiFieldTrialName(), - "Enabled"); + if (!tests[i].lofi_field_trial_group_name.empty()) { + base::FieldTrialList::CreateFieldTrial( + params::GetLoFiFieldTrialName(), + tests[i].lofi_field_trial_group_name); } EXPECT_CALL(*config(), IsNetworkQualityProhibitivelySlow(_)) diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc index ddfa34c..48d92bf 100644 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc @@ -85,8 +85,8 @@ std::string GetLoFiFlagFieldTrialName() { } bool IsIncludedInLoFiEnabledFieldTrial() { - std::string name = FieldTrialList::FindFullName(GetLoFiFieldTrialName()); - return base::StartsWith(name, kEnabled, base::CompareCase::SENSITIVE); + return FieldTrialList::FindFullName(GetLoFiFieldTrialName()).find(kEnabled) == + 0; } bool IsIncludedInLoFiControlFieldTrial() { |