Commit 29c660e3 authored by Min Qin's avatar Min Qin Committed by Chromium LUCI CQ

fix an issue that multiple query tile experiment tag doesn work

Currently if there are multiple QT flags set through chrome://flags,
only one of them will work
This CL fixes the issue

BUG=1158567

Change-Id: If21f90bf51c6a471534a517cd372f2bea7629e98
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2590590Reviewed-by: default avatarShakti Sahu <shaktisahu@chromium.org>
Commit-Queue: Min Qin <qinmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836956}
parent 65dc067b
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/metrics/field_trial_params.h" #include "base/metrics/field_trial_params.h"
#include "base/strings/string_util.h"
#include "components/query_tiles/switches.h" #include "components/query_tiles/switches.h"
namespace query_tiles { namespace query_tiles {
...@@ -94,11 +95,11 @@ constexpr int kDefaultMaxTrendingTileImpressions = 2; ...@@ -94,11 +95,11 @@ constexpr int kDefaultMaxTrendingTileImpressions = 2;
namespace { namespace {
// For testing. Json string for single tier experiment tag. // For testing. Json string for single tier experiment tag.
const char kQueryTilesSingleTierExperimentTag[] = "{\"maxLevels\": \"1\"}"; const char kQueryTilesSingleTierExperimentTag[] = "\"maxLevels\": \"1\"";
// Json Experiment tag for enabling trending queries. // Json Experiment tag for enabling trending queries.
const char kQueryTilesEnableTrendingExperimentTag[] = const char kQueryTilesEnableTrendingExperimentTag[] =
"{\"enableTrending\": \"true\"}"; "\"enableTrending\": \"true\"";
const GURL BuildGetQueryTileURL(const GURL& base_url, const char* path) { const GURL BuildGetQueryTileURL(const GURL& base_url, const char* path) {
GURL::Replacements replacements; GURL::Replacements replacements;
...@@ -128,14 +129,19 @@ bool TileConfig::GetIsUnMeteredNetworkRequired() { ...@@ -128,14 +129,19 @@ bool TileConfig::GetIsUnMeteredNetworkRequired() {
// static // static
std::string TileConfig::GetExperimentTag() { std::string TileConfig::GetExperimentTag() {
std::vector<std::string> experiment_tag;
if (base::CommandLine::ForCurrentProcess()->HasSwitch( if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kQueryTilesSingleTier)) { switches::kQueryTilesSingleTier)) {
return kQueryTilesSingleTierExperimentTag; experiment_tag.emplace_back(kQueryTilesSingleTierExperimentTag);
} }
if (base::CommandLine::ForCurrentProcess()->HasSwitch( if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kQueryTilesEnableTrending)) { switches::kQueryTilesEnableTrending)) {
return kQueryTilesEnableTrendingExperimentTag; experiment_tag.emplace_back(kQueryTilesEnableTrendingExperimentTag);
}
if (!experiment_tag.empty()) {
return "{" + base::JoinString(experiment_tag, ",") + "}";
} }
return base::GetFieldTrialParamValueByFeature(features::kQueryTiles, return base::GetFieldTrialParamValueByFeature(features::kQueryTiles,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment