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

Side by Side Diff: chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator_unittest.cc

Issue 286013002: Added alternative configuration for the data reduction proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK fix Created 6 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 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 "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h" 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/prefs/pref_registry_simple.h" 10 #include "base/prefs/pref_registry_simple.h"
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 42
43 scoped_ptr<DataReductionProxyChromeConfigurator> config_; 43 scoped_ptr<DataReductionProxyChromeConfigurator> config_;
44 TestingPrefServiceSimple pref_service_; 44 TestingPrefServiceSimple pref_service_;
45 }; 45 };
46 46
47 TEST_F(DataReductionProxyConfigTest, TestUnrestricted) { 47 TEST_F(DataReductionProxyConfigTest, TestUnrestricted) {
48 config_->Enable(false, 48 config_->Enable(false,
49 false, 49 false,
50 "https://www.foo.com:443/", 50 "https://www.foo.com:443/",
51 "http://www.bar.com:80/"); 51 "http://www.bar.com:80/",
52 "");
52 CheckProxyConfig( 53 CheckProxyConfig(
53 "fixed_servers", 54 "fixed_servers",
54 "http=https://www.foo.com:443,http://www.bar.com:80,direct://;", 55 "http=https://www.foo.com:443,http://www.bar.com:80,direct://;",
55 ""); 56 "");
56 } 57 }
58
59 TEST_F(DataReductionProxyConfigTest, TestUnrestrictedSSL) {
60 config_->Enable(false,
61 false,
62 "https://www.foo.com:443/",
63 "http://www.bar.com:80/",
64 "http://www.ssl.com:80/");
65 CheckProxyConfig(
66 "fixed_servers",
67 "http=https://www.foo.com:443,http://www.bar.com:80,direct://;"
68 "https=http://www.ssl.com:80,direct://;",
69 "");
70 }
71
57 TEST_F(DataReductionProxyConfigTest, TestUnrestrictedWithBypassRule) { 72 TEST_F(DataReductionProxyConfigTest, TestUnrestrictedWithBypassRule) {
58 config_->AddHostPatternToBypass("<local>"); 73 config_->AddHostPatternToBypass("<local>");
59 config_->AddHostPatternToBypass("*.goo.com"); 74 config_->AddHostPatternToBypass("*.goo.com");
60 config_->Enable(false, 75 config_->Enable(false,
61 false, 76 false,
62 "https://www.foo.com:443/", 77 "https://www.foo.com:443/",
63 "http://www.bar.com:80/"); 78 "http://www.bar.com:80/",
79 "");
64 CheckProxyConfig( 80 CheckProxyConfig(
65 "fixed_servers", 81 "fixed_servers",
66 "http=https://www.foo.com:443,http://www.bar.com:80,direct://;", 82 "http=https://www.foo.com:443,http://www.bar.com:80,direct://;",
67 "<local>, *.goo.com"); 83 "<local>, *.goo.com");
68 } 84 }
69 85
70 TEST_F(DataReductionProxyConfigTest, TestUnrestrictedWithoutFallback) { 86 TEST_F(DataReductionProxyConfigTest, TestUnrestrictedWithoutFallback) {
71 config_->Enable(false, 87 config_->Enable(false, false, "https://www.foo.com:443/", "", "");
72 false,
73 "https://www.foo.com:443/",
74 "");
75 CheckProxyConfig("fixed_servers", 88 CheckProxyConfig("fixed_servers",
76 "http=https://www.foo.com:443,direct://;", 89 "http=https://www.foo.com:443,direct://;",
77 ""); 90 "");
78 } 91 }
79 92
80 TEST_F(DataReductionProxyConfigTest, TestRestricted) { 93 TEST_F(DataReductionProxyConfigTest, TestRestricted) {
81 config_->Enable(true, 94 config_->Enable(true,
82 false, 95 false,
83 "https://www.foo.com:443/", 96 "https://www.foo.com:443/",
84 "http://www.bar.com:80/"); 97 "http://www.bar.com:80/",
98 "");
85 CheckProxyConfig("fixed_servers", 99 CheckProxyConfig("fixed_servers",
86 "http=http://www.bar.com:80,direct://;", 100 "http=http://www.bar.com:80,direct://;",
87 ""); 101 "");
88 } 102 }
89 103
90 TEST_F(DataReductionProxyConfigTest, TestFallbackRestricted) { 104 TEST_F(DataReductionProxyConfigTest, TestFallbackRestricted) {
91 config_->Enable(false, 105 config_->Enable(false,
92 true, 106 true,
93 "https://www.foo.com:443/", 107 "https://www.foo.com:443/",
94 "http://www.bar.com:80/"); 108 "http://www.bar.com:80/",
109 "");
95 CheckProxyConfig("fixed_servers", 110 CheckProxyConfig("fixed_servers",
96 "http=https://www.foo.com:443,direct://;", 111 "http=https://www.foo.com:443,direct://;",
97 ""); 112 "");
98 } 113 }
99 114
100 TEST_F(DataReductionProxyConfigTest, TestBothRestricted) { 115 TEST_F(DataReductionProxyConfigTest, TestBothRestricted) {
101 config_->Enable(true, 116 config_->Enable(true,
102 true, 117 true,
103 "https://www.foo.com:443/", 118 "https://www.foo.com:443/",
104 "http://www.bar.com:80/"); 119 "http://www.bar.com:80/",
120 "");
105 CheckProxyConfig("system", "", ""); 121 CheckProxyConfig("system", "", "");
106 } 122 }
107 123
108 TEST_F(DataReductionProxyConfigTest, TestDisable) { 124 TEST_F(DataReductionProxyConfigTest, TestDisable) {
109 config_->Disable(); 125 config_->Disable();
110 CheckProxyConfig("system", "", ""); 126 CheckProxyConfig("system", "", "");
111 } 127 }
112 128
113 129
114 TEST_F(DataReductionProxyConfigTest, TestBypassList) { 130 TEST_F(DataReductionProxyConfigTest, TestBypassList) {
(...skipping 14 matching lines...) Expand all
129 }; 145 };
130 146
131 ASSERT_EQ(config_->bypass_rules_.size(), 6u); 147 ASSERT_EQ(config_->bypass_rules_.size(), 6u);
132 int i = 0; 148 int i = 0;
133 for (std::vector<std::string>::iterator it = config_->bypass_rules_.begin(); 149 for (std::vector<std::string>::iterator it = config_->bypass_rules_.begin();
134 it != config_->bypass_rules_.end(); ++it) { 150 it != config_->bypass_rules_.end(); ++it) {
135 EXPECT_EQ(expected[i++], *it); 151 EXPECT_EQ(expected[i++], *it);
136 } 152 }
137 } 153 }
138 154
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698