Commit f54db458 authored by Robert Ogden's avatar Robert Ogden Committed by Commit Bot

HTTPS Previews: Use the DRP experiment instead of a Finch-provided one

This experiment doesn't actually seem very useful in Finch. It's better
to reuse the DRP experiment which is accessible in chrome://flags.

Bug: 934376
Change-Id: I27a5bdfa4f57fa761eaae62106113e7fc5529ba1
Reviewed-on: https://chromium-review.googlesource.com/c/1481995Reviewed-by: default avatarRyan Sturm <ryansturm@chromium.org>
Commit-Queue: Robert Ogden <robertogden@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634682}
parent f4138ea6
......@@ -11,6 +11,7 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/command_line.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/optional.h"
......@@ -36,6 +37,7 @@
#include "components/content_settings/core/common/cookie_settings_base.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h"
#include "components/previews/core/previews_experiments.h"
#include "components/previews/core/previews_lite_page_redirect.h"
#include "content/public/browser/browser_context.h"
......@@ -319,7 +321,8 @@ GURL PreviewsLitePageNavigationThrottle::GetPreviewsURLForURL(
const GURL& original_url) {
DCHECK(original_url.is_valid());
std::string experiment_id =
previews::params::LitePageRedirectPreviewExperiment();
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
data_reduction_proxy::switches::kDataReductionProxyExperiment);
std::string experiment_query;
if (!experiment_id.empty()) {
experiment_query =
......
......@@ -6,6 +6,7 @@
#include <memory>
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h"
......@@ -13,6 +14,7 @@
#include "base/test/scoped_task_environment.h"
#include "chrome/browser/previews/previews_lite_page_decider.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h"
#include "components/previews/core/previews_features.h"
#include "content/public/browser/navigation_handle.h"
#include "net/http/http_util.h"
......@@ -97,11 +99,14 @@ TEST(PreviewsLitePageNavigationThrottleTest, TestGetPreviewsURL) {
};
for (const TestCase& test_case : kTestCases) {
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
data_reduction_proxy::switches::kDataReductionProxyExperiment,
test_case.experiment);
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeatureWithParameters(
previews::features::kLitePageServerPreviews,
{{"previews_host", test_case.previews_host},
{"lite_page_preview_experiment", test_case.experiment}});
{{"previews_host", test_case.previews_host}});
EXPECT_EQ(PreviewsLitePageNavigationThrottle::GetPreviewsURLForURL(
GURL(test_case.original_url)),
......
......@@ -219,11 +219,6 @@ GURL GetLitePagePreviewsDomainURL() {
return GURL("https://litepages.googlezip.net/");
}
std::string LitePageRedirectPreviewExperiment() {
return GetFieldTrialParamValueByFeature(features::kLitePageServerPreviews,
"lite_page_preview_experiment");
}
bool IsInLitePageRedirectControl() {
return base::GetFieldTrialParamByFeatureAsBool(
features::kLitePageServerPreviews, "control_group", false);
......
......@@ -123,9 +123,6 @@ size_t LitePageRedirectPreviewMaxNavigationRestarts();
// The maximum number of seconds to loadshed the Previews server for.
int PreviewServerLoadshedMaxSeconds();
// The experimental config to send to the previews server.
std::string LitePageRedirectPreviewExperiment();
// Returns true if we should only report metrics and not trigger when the Lite
// Page Redirect preview is enabled.
bool IsInLitePageRedirectControl();
......
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