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

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: megjablon comments 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", true, "false", false},
470 {"Enabled", true, std::string(), false},
471 {"Control", false, "true", true},
megjablon 2017/05/10 23:11:24 Shouldn't this case not happen since IsIncludedInQ
tbansal1 2017/05/11 01:29:28 Right. When QUIC is not enabled, behavior of IsQui
472 {"Disabled", false, "false", false},
473 };
474
475 for (const auto& test : tests) {
476 variations::testing::ClearAllVariationParams();
477 std::map<std::string, std::string> variation_params;
478 variation_params["enable_quic_non_core_proxies"] =
479 test.enable_non_core_proxies;
480
481 ASSERT_TRUE(variations::AssociateVariationParams(
482 params::GetQuicFieldTrialName(), test.trial_group_name,
483 variation_params));
484
485 base::FieldTrialList field_trial_list(nullptr);
486 base::FieldTrialList::CreateFieldTrial(params::GetQuicFieldTrialName(),
487 test.trial_group_name);
488
489 EXPECT_EQ(test.expected_enabled, params::IsIncludedInQuicFieldTrial());
490 if (params::IsIncludedInQuicFieldTrial()) {
491 EXPECT_EQ(test.expected_enable_non_core_proxies,
492 params::IsQuicForNonCoreProxiesEnabled());
493 }
494 }
495 }
496
459 TEST_F(DataReductionProxyParamsTest, HoldbackEnabledFieldTrial) { 497 TEST_F(DataReductionProxyParamsTest, HoldbackEnabledFieldTrial) {
460 const struct { 498 const struct {
461 std::string trial_group_name; 499 std::string trial_group_name;
462 bool expected_enabled; 500 bool expected_enabled;
463 } tests[] = { 501 } tests[] = {
464 {"Enabled", true}, 502 {"Enabled", true},
465 {"Enabled_Control", true}, 503 {"Enabled_Control", true},
466 {"Disabled", false}, 504 {"Disabled", false},
467 {"enabled", false}, 505 {"enabled", false},
468 }; 506 };
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 ProxyServer::UNSPECIFIED_TYPE)); 577 ProxyServer::UNSPECIFIED_TYPE));
540 expected_override_proxies_for_http.push_back(DataReductionProxyServer( 578 expected_override_proxies_for_http.push_back(DataReductionProxyServer(
541 net::ProxyServer::FromURI("http://override-second.net", 579 net::ProxyServer::FromURI("http://override-second.net",
542 net::ProxyServer::SCHEME_HTTP), 580 net::ProxyServer::SCHEME_HTTP),
543 ProxyServer::UNSPECIFIED_TYPE)); 581 ProxyServer::UNSPECIFIED_TYPE));
544 582
545 EXPECT_EQ(expected_override_proxies_for_http, params.proxies_for_http()); 583 EXPECT_EQ(expected_override_proxies_for_http, params.proxies_for_http());
546 } 584 }
547 585
548 } // namespace data_reduction_proxy 586 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698