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

Side by Side Diff: components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc

Issue 549153003: Dev finch trial of the data reduction proxy overrides both the primary and the fallback hosts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments. Created 6 years, 3 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/browser/data_reduction_proxy_protocol. h" 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // simulate requests and responses. 88 // simulate requests and responses.
89 class DataReductionProxyProtocolTest : public testing::Test { 89 class DataReductionProxyProtocolTest : public testing::Test {
90 public: 90 public:
91 DataReductionProxyProtocolTest() : http_user_agent_settings_("", "") { 91 DataReductionProxyProtocolTest() : http_user_agent_settings_("", "") {
92 proxy_params_.reset( 92 proxy_params_.reset(
93 new TestDataReductionProxyParams( 93 new TestDataReductionProxyParams(
94 DataReductionProxyParams::kAllowed | 94 DataReductionProxyParams::kAllowed |
95 DataReductionProxyParams::kFallbackAllowed | 95 DataReductionProxyParams::kFallbackAllowed |
96 DataReductionProxyParams::kPromoAllowed, 96 DataReductionProxyParams::kPromoAllowed,
97 TestDataReductionProxyParams::HAS_EVERYTHING & 97 TestDataReductionProxyParams::HAS_EVERYTHING &
98 ~TestDataReductionProxyParams::HAS_DEV_ORIGIN)); 98 ~TestDataReductionProxyParams::HAS_DEV_ORIGIN &
99 ~TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN));
99 } 100 }
100 101
101 // Sets up the |TestURLRequestContext| with the provided |ProxyService| and 102 // Sets up the |TestURLRequestContext| with the provided |ProxyService| and
102 // |bypass_type| to store bypass reasons. 103 // |bypass_type| to store bypass reasons.
103 void ConfigureTestDependencies(ProxyService* proxy_service, 104 void ConfigureTestDependencies(ProxyService* proxy_service,
104 DataReductionProxyBypassType* bypass_type) { 105 DataReductionProxyBypassType* bypass_type) {
105 // Create a context with delayed initialization. 106 // Create a context with delayed initialization.
106 context_.reset(new TestURLRequestContext(true)); 107 context_.reset(new TestURLRequestContext(true));
107 108
108 proxy_service_.reset(proxy_service); 109 proxy_service_.reset(proxy_service);
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 785
785 TEST_F(DataReductionProxyProtocolTest, OnResolveProxyHandler) { 786 TEST_F(DataReductionProxyProtocolTest, OnResolveProxyHandler) {
786 int load_flags = net::LOAD_NORMAL; 787 int load_flags = net::LOAD_NORMAL;
787 GURL url("http://www.google.com/"); 788 GURL url("http://www.google.com/");
788 789
789 TestDataReductionProxyParams test_params( 790 TestDataReductionProxyParams test_params(
790 DataReductionProxyParams::kAllowed | 791 DataReductionProxyParams::kAllowed |
791 DataReductionProxyParams::kFallbackAllowed | 792 DataReductionProxyParams::kFallbackAllowed |
792 DataReductionProxyParams::kPromoAllowed, 793 DataReductionProxyParams::kPromoAllowed,
793 TestDataReductionProxyParams::HAS_EVERYTHING & 794 TestDataReductionProxyParams::HAS_EVERYTHING &
794 ~TestDataReductionProxyParams::HAS_DEV_ORIGIN); 795 ~TestDataReductionProxyParams::HAS_DEV_ORIGIN &
796 ~TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN);
795 797
796 // Data reduction proxy info 798 // Data reduction proxy info
797 net::ProxyInfo data_reduction_proxy_info; 799 net::ProxyInfo data_reduction_proxy_info;
798 std::string data_reduction_proxy; 800 std::string data_reduction_proxy;
799 base::TrimString(test_params.DefaultOrigin(), "/", &data_reduction_proxy); 801 base::TrimString(test_params.DefaultOrigin(), "/", &data_reduction_proxy);
800 data_reduction_proxy_info.UseNamedProxy(data_reduction_proxy); 802 data_reduction_proxy_info.UseNamedProxy(data_reduction_proxy);
801 EXPECT_FALSE(data_reduction_proxy_info.is_empty()); 803 EXPECT_FALSE(data_reduction_proxy_info.is_empty());
802 804
803 // Data reduction proxy config 805 // Data reduction proxy config
804 net::ProxyConfig data_reduction_proxy_config; 806 net::ProxyConfig data_reduction_proxy_config;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 &other_proxy_info); 914 &other_proxy_info);
913 EXPECT_FALSE(other_proxy_info.is_direct()); 915 EXPECT_FALSE(other_proxy_info.is_direct());
914 916
915 OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config, 917 OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
916 empty_proxy_retry_info, &test_params, 918 empty_proxy_retry_info, &test_params,
917 &data_reduction_proxy_info); 919 &data_reduction_proxy_info);
918 EXPECT_TRUE(data_reduction_proxy_info.is_direct()); 920 EXPECT_TRUE(data_reduction_proxy_info.is_direct());
919 } 921 }
920 922
921 } // namespace data_reduction_proxy 923 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698