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

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

Issue 2922663002: Data Reduction Proxy: Remove duplicate functions (Closed)
Patch Set: megjablon comments Created 3 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_test_utils.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 0c9833288070be733feb41920aec9484fdd10bf4..54e586d93206f3f635a106ab7ee8586999257b2d 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
@@ -26,10 +26,8 @@ namespace data_reduction_proxy {
class DataReductionProxyParamsTest : public testing::Test {
public:
void CheckParams(const TestDataReductionProxyParams& params,
- bool expected_init_result,
- bool expected_promo_allowed) {
+ bool expected_init_result) {
EXPECT_EQ(expected_init_result, params.init_result());
- EXPECT_EQ(expected_promo_allowed, params.promo_allowed());
}
void CheckValues(const TestDataReductionProxyParams& params,
const std::string& expected_origin,
@@ -55,10 +53,8 @@ class DataReductionProxyParamsTest : public testing::Test {
};
TEST_F(DataReductionProxyParamsTest, EverythingDefined) {
- TestDataReductionProxyParams params(
- DataReductionProxyParams::kPromoAllowed,
- TestDataReductionProxyParams::HAS_EVERYTHING);
- CheckParams(params, true, true);
+ TestDataReductionProxyParams params;
+ CheckParams(params, true);
std::vector<DataReductionProxyServer> expected_proxies;
// Both the origin and fallback proxy must have type CORE.
@@ -87,10 +83,8 @@ TEST_F(DataReductionProxyParamsTest, Flags) {
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kDataReductionProxySecureProxyCheckURL,
TestDataReductionProxyParams::FlagSecureProxyCheckURL());
- TestDataReductionProxyParams params(
- DataReductionProxyParams::kPromoAllowed,
- TestDataReductionProxyParams::HAS_EVERYTHING);
- CheckParams(params, true, true);
+ TestDataReductionProxyParams params;
+ CheckParams(params, true);
CheckValues(params, TestDataReductionProxyParams::FlagOrigin(),
TestDataReductionProxyParams::FlagFallbackOrigin(),
TestDataReductionProxyParams::FlagSecureProxyCheckURL());
@@ -103,7 +97,7 @@ TEST_F(DataReductionProxyParamsTest, CarrierTestFlag) {
base::CommandLine::ForCurrentProcess()->InitFromArgv(0, nullptr);
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kEnableDataReductionProxyCarrierTest, kCarrierTestOrigin);
- DataReductionProxyParams params(0);
+ DataReductionProxyParams params;
std::vector<DataReductionProxyServer> proxies_for_http;
proxies_for_http.push_back(DataReductionProxyServer(
net::ProxyServer::FromURI(kCarrierTestOrigin,
@@ -116,34 +110,10 @@ TEST_F(DataReductionProxyParamsTest, CarrierTestFlag) {
EXPECT_EQ(params.proxies_for_http(), proxies_for_http);
}
-TEST_F(DataReductionProxyParamsTest, InvalidConfigurations) {
- const struct {
- bool promo_allowed;
- unsigned int missing_definitions;
- bool expected_result;
- } tests[] = {
- {true, TestDataReductionProxyParams::HAS_NOTHING, true},
- {true, TestDataReductionProxyParams::HAS_ORIGIN, false},
- {true, TestDataReductionProxyParams::HAS_FALLBACK_ORIGIN, false},
- {true, TestDataReductionProxyParams::HAS_SECURE_PROXY_CHECK_URL, false},
- };
-
- for (size_t i = 0; i < arraysize(tests); ++i) {
- int flags = 0;
- if (tests[i].promo_allowed)
- flags |= DataReductionProxyParams::kPromoAllowed;
- TestDataReductionProxyParams params(
- flags,
- TestDataReductionProxyParams::HAS_EVERYTHING &
- ~(tests[i].missing_definitions));
- EXPECT_EQ(tests[i].expected_result, params.init_result()) << i;
- }
-}
-
TEST_F(DataReductionProxyParamsTest, AndroidOnePromoFieldTrial) {
- EXPECT_TRUE(params::IsIncludedInAndroidOnePromoFieldTrial(
+ EXPECT_TRUE(params::IsIncludedInAndroidOnePromoFieldTrialForTesting(
"google/sprout/sprout:4.4.4/KPW53/1379542:user/release-keys"));
- EXPECT_FALSE(params::IsIncludedInAndroidOnePromoFieldTrial(
+ EXPECT_FALSE(params::IsIncludedInAndroidOnePromoFieldTrialForTesting(
"google/hammerhead/hammerhead:5.0/LRX210/1570415:user/release-keys"));
}
@@ -560,7 +530,7 @@ TEST(DataReductionProxyParamsStandaloneTest, OverrideProxiesForHttp) {
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kDataReductionProxyHttpProxies,
"http://override-first.net;http://override-second.net");
- DataReductionProxyParams params(0);
+ DataReductionProxyParams params;
// Overriding proxies must have type UNSPECIFIED_TYPE.
std::vector<DataReductionProxyServer> expected_override_proxies_for_http;
« no previous file with comments | « components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698