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

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

Issue 1162903008: Add field trial handling to enable the Data Reduction Proxy config service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bengr CR comment Created 5 years, 6 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 467e3be75367393c38ea87b67b5f882fa2adfe58..1de54cfef96ba195798b1b5267aeb9d386dd8856 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
@@ -5,6 +5,7 @@
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
#include <map>
+#include <string>
#include <vector>
#include "base/command_line.h"
@@ -16,6 +17,10 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace {
+const char kConfigServiceFieldTrial[] = "DataReductionProxyConfigService";
+}
+
namespace data_reduction_proxy {
class DataReductionProxyParamsTest : public testing::Test {
public:
@@ -576,6 +581,53 @@ TEST_F(DataReductionProxyParamsTest, AndroidOnePromoFieldTrial) {
"google/hammerhead/hammerhead:5.0/LRX210/1570415:user/release-keys"));
}
+TEST_F(DataReductionProxyParamsTest, IsClientConfigEnabled) {
+ const struct {
+ std::string test_case;
+ bool command_line_set;
+ std::string trial_group_value;
+ bool expected;
+ } tests[] = {
+ {
+ "Nothing set", false, "", false,
+ },
+ {
+ "Command line set", true, "", true,
+ },
+ {
+ "Enabled in experiment", false, "Enabled", true,
+ },
+ {
+ "Alternate enabled in experiment", false, "EnabledOther", true,
+ },
+ {
+ "Disabled in experiment", false, "Disabled", false,
+ },
+ {
+ "Command line set, enabled in experiment", true, "Enabled", true,
+ },
+ {
+ "Command line set, disabled in experiment", true, "Disabled", true,
+ },
+ };
+
+ for (const auto& test : tests) {
+ // Reset all flags.
+ base::CommandLine::ForCurrentProcess()->InitFromArgv(0, NULL);
+ if (test.command_line_set) {
+ base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
+ switches::kEnableDataReductionProxyConfigClient, "");
+ }
+ base::FieldTrialList field_trial_list(nullptr);
+ if (!test.trial_group_value.empty()) {
+ base::FieldTrialList::CreateFieldTrial(kConfigServiceFieldTrial,
+ test.trial_group_value);
+ }
+ EXPECT_EQ(test.expected, DataReductionProxyParams::IsConfigClientEnabled())
+ << test.test_case;
+ }
+}
+
TEST_F(DataReductionProxyParamsTest, SecureProxyCheckDefault) {
struct {
bool command_line_set;
« 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