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

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: Rebased 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(params.quic_delay_tcp_race); 175 EXPECT_FALSE(params.quic_delay_tcp_race);
176 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy()); 176 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy());
177 } 177 }
178 178
179 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) { 179 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) {
180 base::FieldTrialList field_trial_list(new base::MockEntropyProvider()); 180 const struct {
181 base::FieldTrialList::CreateFieldTrial( 181 std::string field_trial_group_name;
182 data_reduction_proxy::params::GetQuicFieldTrialName(), "Enabled"); 182 bool expect_enable_quic;
183 } tests[] = {
184 {
185 std::string(), false,
186 },
187 {
188 "NotEnabled", false,
189 },
190 {
191 "Control", false,
192 },
193 {
194 "Disabled", false,
195 },
196 {
197 "EnabledControl", true,
198 },
199 {
200 "Enabled", true,
201 },
202 };
183 203
184 ConfigureQuicGlobals(); 204 for (size_t i = 0; i < arraysize(tests); ++i) {
185 net::HttpNetworkSession::Params params; 205 base::FieldTrialList field_trial_list(new base::MockEntropyProvider());
186 InitializeNetworkSessionParams(&params); 206 base::FieldTrialList::CreateFieldTrial(
187 EXPECT_FALSE(params.enable_quic); 207 data_reduction_proxy::params::GetQuicFieldTrialName(),
188 EXPECT_TRUE(params.enable_quic_for_proxies); 208 tests[i].field_trial_group_name);
189 EXPECT_TRUE(IOThread::ShouldEnableQuicForDataReductionProxy()); 209
190 EXPECT_EQ(1024 * 1024, params.quic_socket_receive_buffer_size); 210 ConfigureQuicGlobals();
211 net::HttpNetworkSession::Params params;
212 InitializeNetworkSessionParams(&params);
213 EXPECT_FALSE(params.enable_quic) << i;
214 EXPECT_EQ(tests[i].expect_enable_quic, params.enable_quic_for_proxies) << i;
215 EXPECT_EQ(tests[i].expect_enable_quic,
216 IOThread::ShouldEnableQuicForDataReductionProxy())
217 << i;
218 }
191 } 219 }
192 220
193 TEST_F(IOThreadTest, EnableQuicFromCommandLine) { 221 TEST_F(IOThreadTest, EnableQuicFromCommandLine) {
194 command_line_.AppendSwitch("enable-quic"); 222 command_line_.AppendSwitch("enable-quic");
195 223
196 ConfigureQuicGlobals(); 224 ConfigureQuicGlobals();
197 net::HttpNetworkSession::Params params; 225 net::HttpNetworkSession::Params params;
198 InitializeNetworkSessionParams(&params); 226 InitializeNetworkSessionParams(&params);
199 EXPECT_TRUE(params.enable_quic); 227 EXPECT_TRUE(params.enable_quic);
200 EXPECT_TRUE(params.enable_quic_for_proxies); 228 EXPECT_TRUE(params.enable_quic_for_proxies);
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 command_line_.AppendSwitch(switches::kEnableQuic); 504 command_line_.AppendSwitch(switches::kEnableQuic);
477 is_quic_allowed_by_policy_ = false; 505 is_quic_allowed_by_policy_ = false;
478 ConfigureQuicGlobals(); 506 ConfigureQuicGlobals();
479 507
480 net::HttpNetworkSession::Params params; 508 net::HttpNetworkSession::Params params;
481 InitializeNetworkSessionParams(&params); 509 InitializeNetworkSessionParams(&params);
482 EXPECT_FALSE(params.enable_quic); 510 EXPECT_FALSE(params.enable_quic);
483 } 511 }
484 512
485 } // namespace test 513 } // 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