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

Side by Side Diff: chrome/browser/io_thread_unittest.cc

Issue 1360903002: Use QUIC for DataReductionProxy if user belongs to field trial group that starts with "Enabled". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2490
Patch Set: Created 5 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
« no previous file with comments | « no previous file | components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/metrics/field_trial.h" 6 #include "base/metrics/field_trial.h"
7 #include "base/test/mock_entropy_provider.h" 7 #include "base/test/mock_entropy_provider.h"
8 #include "chrome/browser/io_thread.h" 8 #include "chrome/browser/io_thread.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" 10 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 EXPECT_FALSE(params.quic_enable_non_blocking_io); 177 EXPECT_FALSE(params.quic_enable_non_blocking_io);
178 EXPECT_FALSE(params.quic_disable_disk_cache); 178 EXPECT_FALSE(params.quic_disable_disk_cache);
179 EXPECT_FALSE(params.quic_prefer_aes); 179 EXPECT_FALSE(params.quic_prefer_aes);
180 EXPECT_FALSE(params.use_alternative_services); 180 EXPECT_FALSE(params.use_alternative_services);
181 EXPECT_EQ(0, params.quic_max_number_of_lossy_connections); 181 EXPECT_EQ(0, params.quic_max_number_of_lossy_connections);
182 EXPECT_EQ(1.0f, params.quic_packet_loss_threshold); 182 EXPECT_EQ(1.0f, params.quic_packet_loss_threshold);
183 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy()); 183 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy());
184 } 184 }
185 185
186 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) { 186 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) {
187 base::FieldTrialList field_trial_list(new base::MockEntropyProvider()); 187 const struct {
188 base::FieldTrialList::CreateFieldTrial( 188 std::string field_trial_group_name;
189 data_reduction_proxy::params::GetQuicFieldTrialName(), "Enabled"); 189 bool expect_enable_quic;
190 } tests[] = {
191 {
192 std::string(), false,
193 },
194 {
195 "NotEnabled", false,
196 },
197 {
198 "Control", false,
199 },
200 {
201 "Disabled", false,
202 },
203 {
204 "EnabledControl", true,
205 },
206 {
207 "Enabled", true,
208 },
209 };
190 210
191 ConfigureQuicGlobals(); 211 for (size_t i = 0; i < arraysize(tests); ++i) {
192 net::HttpNetworkSession::Params params; 212 base::FieldTrialList field_trial_list(new base::MockEntropyProvider());
193 InitializeNetworkSessionParams(&params); 213 base::FieldTrialList::CreateFieldTrial(
194 EXPECT_FALSE(params.enable_quic); 214 data_reduction_proxy::params::GetQuicFieldTrialName(),
195 EXPECT_TRUE(params.enable_quic_for_proxies); 215 tests[i].field_trial_group_name);
196 EXPECT_TRUE(IOThread::ShouldEnableQuicForDataReductionProxy()); 216
197 EXPECT_EQ(1024 * 1024, params.quic_socket_receive_buffer_size); 217 ConfigureQuicGlobals();
218 net::HttpNetworkSession::Params params;
219 InitializeNetworkSessionParams(&params);
220 EXPECT_FALSE(params.enable_quic) << i;
221 EXPECT_EQ(tests[i].expect_enable_quic, params.enable_quic_for_proxies) << i;
222 EXPECT_EQ(tests[i].expect_enable_quic,
223 IOThread::ShouldEnableQuicForDataReductionProxy())
224 << i;
225 }
198 } 226 }
199 227
200 TEST_F(IOThreadTest, EnableQuicFromCommandLine) { 228 TEST_F(IOThreadTest, EnableQuicFromCommandLine) {
201 command_line_.AppendSwitch("enable-quic"); 229 command_line_.AppendSwitch("enable-quic");
202 230
203 ConfigureQuicGlobals(); 231 ConfigureQuicGlobals();
204 net::HttpNetworkSession::Params params; 232 net::HttpNetworkSession::Params params;
205 InitializeNetworkSessionParams(&params); 233 InitializeNetworkSessionParams(&params);
206 EXPECT_TRUE(params.enable_quic); 234 EXPECT_TRUE(params.enable_quic);
207 EXPECT_TRUE(params.enable_quic_for_proxies); 235 EXPECT_TRUE(params.enable_quic_for_proxies);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 command_line_.AppendSwitch(switches::kEnableQuic); 481 command_line_.AppendSwitch(switches::kEnableQuic);
454 is_quic_allowed_by_policy_ = false; 482 is_quic_allowed_by_policy_ = false;
455 ConfigureQuicGlobals(); 483 ConfigureQuicGlobals();
456 484
457 net::HttpNetworkSession::Params params; 485 net::HttpNetworkSession::Params params;
458 InitializeNetworkSessionParams(&params); 486 InitializeNetworkSessionParams(&params);
459 EXPECT_FALSE(params.enable_quic); 487 EXPECT_FALSE(params.enable_quic);
460 } 488 }
461 489
462 } // namespace test 490 } // namespace test
OLDNEW
« no previous file with comments | « no previous file | components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698