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

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: Reorder functions 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 if (!test.warmup_url.empty()) { 442 if (!test.warmup_url.empty()) {
443 EXPECT_EQ(GURL(test.warmup_url), params::GetWarmupURL()); 443 EXPECT_EQ(GURL(test.warmup_url), params::GetWarmupURL());
444 } else { 444 } else {
445 EXPECT_EQ(GURL("http://check.googlezip.net/generate_204"), 445 EXPECT_EQ(GURL("http://check.googlezip.net/generate_204"),
446 params::GetWarmupURL()); 446 params::GetWarmupURL());
447 } 447 }
448 EXPECT_EQ(test.expect_warmup_url_enabled, params::FetchWarmupURLEnabled()); 448 EXPECT_EQ(test.expect_warmup_url_enabled, params::FetchWarmupURLEnabled());
449 } 449 }
450 } 450 }
451 451
452 // Tests if the QUIC field trial |enable_quic_non_core_proxies| is set
453 // correctly.
454 TEST_F(DataReductionProxyParamsTest, QuicEnableNonCoreProxies) {
455 const struct {
456 std::string trial_group_name;
457 bool expected_enabled;
458 std::string enable_non_core_proxies;
459 bool expected_enable_non_core_proxies;
460 } tests[] = {
461 {"Enabled", true, "true", true},
462 {"Enabled", true, "false", false},
463 {"Enabled", true, std::string(), false},
464 {"Control", false, "true", false},
465 {"Disabled", false, "true", false},
466 };
467
468 for (const auto& test : tests) {
469 variations::testing::ClearAllVariationParams();
470 std::map<std::string, std::string> variation_params;
471 variation_params["enable_quic_non_core_proxies"] =
472 test.enable_non_core_proxies;
473
474 ASSERT_TRUE(variations::AssociateVariationParams(
475 params::GetQuicFieldTrialName(), test.trial_group_name,
476 variation_params));
477
478 base::FieldTrialList field_trial_list(nullptr);
479 base::FieldTrialList::CreateFieldTrial(params::GetQuicFieldTrialName(),
480 test.trial_group_name);
481
482 EXPECT_EQ(test.expected_enabled, params::IsIncludedInQuicFieldTrial());
483 if (params::IsIncludedInQuicFieldTrial()) {
484 EXPECT_EQ(test.expected_enable_non_core_proxies,
485 params::IsQuicEnabledForNonCoreProxies());
486 }
487 }
488 }
489
452 TEST_F(DataReductionProxyParamsTest, HoldbackEnabledFieldTrial) { 490 TEST_F(DataReductionProxyParamsTest, HoldbackEnabledFieldTrial) {
453 const struct { 491 const struct {
454 std::string trial_group_name; 492 std::string trial_group_name;
455 bool expected_enabled; 493 bool expected_enabled;
456 } tests[] = { 494 } tests[] = {
457 {"Enabled", true}, 495 {"Enabled", true},
458 {"Enabled_Control", true}, 496 {"Enabled_Control", true},
459 {"Disabled", false}, 497 {"Disabled", false},
460 {"enabled", false}, 498 {"enabled", false},
461 }; 499 };
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 ProxyServer::UNSPECIFIED_TYPE)); 570 ProxyServer::UNSPECIFIED_TYPE));
533 expected_override_proxies_for_http.push_back(DataReductionProxyServer( 571 expected_override_proxies_for_http.push_back(DataReductionProxyServer(
534 net::ProxyServer::FromURI("http://override-second.net", 572 net::ProxyServer::FromURI("http://override-second.net",
535 net::ProxyServer::SCHEME_HTTP), 573 net::ProxyServer::SCHEME_HTTP),
536 ProxyServer::UNSPECIFIED_TYPE)); 574 ProxyServer::UNSPECIFIED_TYPE));
537 575
538 EXPECT_EQ(expected_override_proxies_for_http, params.proxies_for_http()); 576 EXPECT_EQ(expected_override_proxies_for_http, params.proxies_for_http());
539 } 577 }
540 578
541 } // namespace data_reduction_proxy 579 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698