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

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

Issue 1354283002: Use QUIC for DRP if field trial group starts with Enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 EXPECT_FALSE(params.quic_enable_non_blocking_io); 169 EXPECT_FALSE(params.quic_enable_non_blocking_io);
170 EXPECT_FALSE(params.quic_disable_disk_cache); 170 EXPECT_FALSE(params.quic_disable_disk_cache);
171 EXPECT_FALSE(params.quic_prefer_aes); 171 EXPECT_FALSE(params.quic_prefer_aes);
172 EXPECT_FALSE(params.use_alternative_services); 172 EXPECT_FALSE(params.use_alternative_services);
173 EXPECT_EQ(4, params.quic_max_number_of_lossy_connections); 173 EXPECT_EQ(4, params.quic_max_number_of_lossy_connections);
174 EXPECT_EQ(0.5f, params.quic_packet_loss_threshold); 174 EXPECT_EQ(0.5f, params.quic_packet_loss_threshold);
175 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy()); 175 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy());
176 } 176 }
177 177
178 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) { 178 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) {
179 base::FieldTrialList field_trial_list(new base::MockEntropyProvider()); 179 const struct {
180 base::FieldTrialList::CreateFieldTrial( 180 std::string field_trial_group_name;
181 data_reduction_proxy::params::GetQuicFieldTrialName(), "Enabled"); 181 bool expect_enable_quic;
182 } tests[] = {
183 {
184 std::string(), false,
sclittle 2015/09/19 00:45:21 nit: Could these be done in 1 line each, e.g. {st
tbansal1 2015/09/21 16:55:52 git cl format does not like it, and changes it bac
185 },
186 {
187 "Enabled", true,
188 },
189 {
190 "EnabledControl", true,
191 },
192 {
193 "NotEnabled", false,
194 },
195 };
182 196
183 ConfigureQuicGlobals(); 197 for (size_t i = 0; i < arraysize(tests); ++i) {
184 net::HttpNetworkSession::Params params; 198 base::FieldTrialList field_trial_list(new base::MockEntropyProvider());
185 InitializeNetworkSessionParams(&params); 199 base::FieldTrialList::CreateFieldTrial(
186 EXPECT_FALSE(params.enable_quic); 200 data_reduction_proxy::params::GetQuicFieldTrialName(),
187 EXPECT_TRUE(params.enable_quic_for_proxies); 201 tests[i].field_trial_group_name);
188 EXPECT_TRUE(IOThread::ShouldEnableQuicForDataReductionProxy()); 202
189 EXPECT_EQ(1024 * 1024, params.quic_socket_receive_buffer_size); 203 ConfigureQuicGlobals();
204 net::HttpNetworkSession::Params params;
205 InitializeNetworkSessionParams(&params);
206 EXPECT_EQ(1024 * 1024, params.quic_socket_receive_buffer_size) << i;
207 EXPECT_FALSE(params.enable_quic) << i;
208 EXPECT_EQ(tests[i].expect_enable_quic, params.enable_quic_for_proxies) << i;
209 EXPECT_EQ(tests[i].expect_enable_quic,
210 IOThread::ShouldEnableQuicForDataReductionProxy())
211 << i;
212 }
190 } 213 }
191 214
192 TEST_F(IOThreadTest, EnableQuicFromCommandLine) { 215 TEST_F(IOThreadTest, EnableQuicFromCommandLine) {
193 command_line_.AppendSwitch("enable-quic"); 216 command_line_.AppendSwitch("enable-quic");
194 217
195 ConfigureQuicGlobals(); 218 ConfigureQuicGlobals();
196 net::HttpNetworkSession::Params params; 219 net::HttpNetworkSession::Params params;
197 InitializeNetworkSessionParams(&params); 220 InitializeNetworkSessionParams(&params);
198 EXPECT_TRUE(params.enable_quic); 221 EXPECT_TRUE(params.enable_quic);
199 EXPECT_TRUE(params.enable_quic_for_proxies); 222 EXPECT_TRUE(params.enable_quic_for_proxies);
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 command_line_.AppendSwitch(switches::kEnableQuic); 489 command_line_.AppendSwitch(switches::kEnableQuic);
467 is_quic_allowed_by_policy_ = false; 490 is_quic_allowed_by_policy_ = false;
468 ConfigureQuicGlobals(); 491 ConfigureQuicGlobals();
469 492
470 net::HttpNetworkSession::Params params; 493 net::HttpNetworkSession::Params params;
471 InitializeNetworkSessionParams(&params); 494 InitializeNetworkSessionParams(&params);
472 EXPECT_FALSE(params.enable_quic); 495 EXPECT_FALSE(params.enable_quic);
473 } 496 }
474 497
475 } // namespace test 498 } // 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