Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(905)

Unified Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc

Issue 1137583004: Add field trial to only use the secure Data Reduction Proxy on a successful secure proxy check. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR comment Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc
index aa5074125c123d1d839026bb3012dfde7aa97413..77c9e4eece2e910dd975779017b7c84ea3d2fb21 100644
--- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc
+++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc
@@ -7,6 +7,7 @@
#include <map>
#include "base/command_line.h"
+#include "base/metrics/field_trial.h"
#include "base/values.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h"
@@ -767,6 +768,57 @@ TEST_F(DataReductionProxyParamsTest, AndroidOnePromoFieldTrial) {
"google/hammerhead/hammerhead:5.0/LRX210/1570415:user/release-keys"));
}
+TEST_F(DataReductionProxyParamsTest, SecureProxyCheckDefault) {
+ struct {
+ bool command_line_set;
+ bool experiment_enabled;
+ bool in_trial_group;
+ bool expected_use_by_default;
+ } test_cases[]{
+ {
+ false, false, false, true,
+ },
+ {
+ true, false, false, false,
+ },
+ {
+ true, true, false, false,
+ },
+ {
+ true, true, true, false,
+ },
+ {
+ false, true, true, false,
+ },
+ {
+ false, true, false, true,
+ },
+ };
+
+ int test_index = 0;
+ for (const auto& test_case : test_cases) {
+ // Reset all flags.
+ base::CommandLine::ForCurrentProcess()->InitFromArgv(0, NULL);
+
+ base::FieldTrialList trial_list(nullptr);
+ if (test_case.command_line_set) {
+ base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
+ switches::kDataReductionProxyStartSecureDisabled, "");
+ }
+
+ if (test_case.experiment_enabled) {
+ base::FieldTrialList::CreateFieldTrial(
+ "DataReductionProxySecureProxyAfterCheck",
+ test_case.in_trial_group ? "Enabled" : "Disabled");
+ }
+
+ EXPECT_EQ(test_case.expected_use_by_default,
+ DataReductionProxyParams::ShouldUseSecureProxyByDefault())
+ << test_index;
+ test_index++;
+ }
+}
+
TEST_F(DataReductionProxyParamsTest, PopulateConfigResponse) {
DataReductionProxyParams params(
DataReductionProxyParams::kAllowed |
« no previous file with comments | « components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698