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

Side by Side Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc

Issue 2869863002: Enable QUIC for non core data saver proxies (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" 5 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 if (!test.warmup_url.empty()) { 449 if (!test.warmup_url.empty()) {
450 EXPECT_EQ(GURL(test.warmup_url), params::GetWarmupURL()); 450 EXPECT_EQ(GURL(test.warmup_url), params::GetWarmupURL());
451 } else { 451 } else {
452 EXPECT_EQ(GURL("http://check.googlezip.net/generate_204"), 452 EXPECT_EQ(GURL("http://check.googlezip.net/generate_204"),
453 params::GetWarmupURL()); 453 params::GetWarmupURL());
454 } 454 }
455 EXPECT_EQ(test.expect_warmup_url_enabled, params::FetchWarmupURLEnabled()); 455 EXPECT_EQ(test.expect_warmup_url_enabled, params::FetchWarmupURLEnabled());
456 } 456 }
457 } 457 }
458 458
459 // Tests if the QUIC field trial |enable_quic_non_core_proxies| is set
460 // correctly.
461 TEST_F(DataReductionProxyParamsTest, QuicEnableNonCoreProxies) {
462 const struct {
463 std::string trial_group_name;
464 bool expected_enabled;
465 std::string enable_non_core_proxies;
466 bool expected_enable_non_core_proxies;
467 } tests[] = {
468 {"Enabled", true, "true", true},
469 {"Enabled_Control", true, "true", true},
megjablon 2017/05/09 18:16:22 What is the difference between "Enabled_Control" v
tbansal1 2017/05/09 23:57:41 I just removed them to avoid confusion since that
470 {"Enabled_Control", true, "false", false},
471 {"Enabled_Control", true, std::string(), false},
472 {"Control", false, "true", true},
473 {"Disabled", false, "false", false},
474 };
475
476 for (const auto& test : tests) {
477 variations::testing::ClearAllVariationParams();
478 std::map<std::string, std::string> variation_params;
479 variation_params["enable_quic_non_core_proxies"] =
480 test.enable_non_core_proxies;
481
482 ASSERT_TRUE(variations::AssociateVariationParams(
483 params::GetQuicFieldTrialName(), test.trial_group_name,
484 variation_params));
485
486 base::FieldTrialList field_trial_list(nullptr);
487 base::FieldTrialList::CreateFieldTrial(params::GetQuicFieldTrialName(),
488 test.trial_group_name);
489
490 EXPECT_EQ(test.expected_enabled, params::IsIncludedInQuicFieldTrial());
491 if (params::IsIncludedInQuicFieldTrial()) {
492 EXPECT_EQ(test.expected_enable_non_core_proxies,
493 params::IsQuicForNonCoreProxiesEnabled());
494 }
495 }
496 }
497
459 TEST_F(DataReductionProxyParamsTest, HoldbackEnabledFieldTrial) { 498 TEST_F(DataReductionProxyParamsTest, HoldbackEnabledFieldTrial) {
460 const struct { 499 const struct {
461 std::string trial_group_name; 500 std::string trial_group_name;
462 bool expected_enabled; 501 bool expected_enabled;
463 } tests[] = { 502 } tests[] = {
464 {"Enabled", true}, 503 {"Enabled", true},
465 {"Enabled_Control", true}, 504 {"Enabled_Control", true},
466 {"Disabled", false}, 505 {"Disabled", false},
467 {"enabled", false}, 506 {"enabled", false},
468 }; 507 };
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 ProxyServer::UNSPECIFIED_TYPE)); 578 ProxyServer::UNSPECIFIED_TYPE));
540 expected_override_proxies_for_http.push_back(DataReductionProxyServer( 579 expected_override_proxies_for_http.push_back(DataReductionProxyServer(
541 net::ProxyServer::FromURI("http://override-second.net", 580 net::ProxyServer::FromURI("http://override-second.net",
542 net::ProxyServer::SCHEME_HTTP), 581 net::ProxyServer::SCHEME_HTTP),
543 ProxyServer::UNSPECIFIED_TYPE)); 582 ProxyServer::UNSPECIFIED_TYPE));
544 583
545 EXPECT_EQ(expected_override_proxies_for_http, params.proxies_for_http()); 584 EXPECT_EQ(expected_override_proxies_for_http, params.proxies_for_http());
546 } 585 }
547 586
548 } // namespace data_reduction_proxy 587 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698