OLD | NEW |
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 field_trial_params_["enable_http2"] = "true"; | 136 field_trial_params_["enable_http2"] = "true"; |
137 field_trial_group_ = "ParametrizedHTTP2Only"; | 137 field_trial_group_ = "ParametrizedHTTP2Only"; |
138 ConfigureSpdyGlobals(); | 138 ConfigureSpdyGlobals(); |
139 EXPECT_THAT(globals_.next_protos, | 139 EXPECT_THAT(globals_.next_protos, |
140 ElementsAre(net::kProtoHTTP11, net::kProtoSPDY4)); | 140 ElementsAre(net::kProtoHTTP11, net::kProtoSPDY4)); |
141 bool use_alternate_protocols = false; | 141 bool use_alternate_protocols = false; |
142 globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); | 142 globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); |
143 EXPECT_TRUE(use_alternate_protocols); | 143 EXPECT_TRUE(use_alternate_protocols); |
144 } | 144 } |
145 | 145 |
146 TEST_F(IOThreadTest, SpdyCommandLineEnable) { | |
147 command_line_.AppendSwitch("enable-spdy4"); | |
148 // Command line should overwrite field trial group. | |
149 field_trial_group_ = "SpdyDisabled"; | |
150 ConfigureSpdyGlobals(); | |
151 EXPECT_THAT(globals_.next_protos, | |
152 ElementsAre(net::kProtoHTTP11, net::kProtoSPDY31, | |
153 net::kProtoSPDY4_14, net::kProtoSPDY4)); | |
154 bool use_alternate_protocols = false; | |
155 globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); | |
156 EXPECT_TRUE(use_alternate_protocols); | |
157 } | |
158 | |
159 TEST_F(IOThreadTest, SpdyCommandLineDisable) { | |
160 command_line_.AppendSwitch("enable-npn-http"); | |
161 // Command line should overwrite field trial group. | |
162 field_trial_group_ = "Spdy4Enabled"; | |
163 ConfigureSpdyGlobals(); | |
164 EXPECT_THAT(globals_.next_protos, ElementsAre(net::kProtoHTTP11)); | |
165 bool use_alternate_protocols = true; | |
166 globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); | |
167 EXPECT_FALSE(use_alternate_protocols); | |
168 } | |
169 | |
170 TEST_F(IOThreadTest, SpdyCommandLineUseSpdyOff) { | 146 TEST_F(IOThreadTest, SpdyCommandLineUseSpdyOff) { |
171 command_line_.AppendSwitchASCII("use-spdy", "off"); | 147 command_line_.AppendSwitchASCII("use-spdy", "off"); |
172 // Command line should overwrite field trial group. | 148 // Command line should overwrite field trial group. |
173 field_trial_group_ = "Spdy4Enabled"; | 149 field_trial_group_ = "Spdy4Enabled"; |
174 ConfigureSpdyGlobals(); | 150 ConfigureSpdyGlobals(); |
175 EXPECT_EQ(0u, globals_.next_protos.size()); | 151 EXPECT_EQ(0u, globals_.next_protos.size()); |
176 } | 152 } |
177 | 153 |
178 TEST_F(IOThreadTest, SpdyCommandLineUseSpdyDisableAltProtocols) { | 154 TEST_F(IOThreadTest, SpdyCommandLineUseSpdyDisableAltProtocols) { |
179 command_line_.AppendSwitchASCII("use-spdy", "no-alt-protocols"); | 155 command_line_.AppendSwitchASCII("use-spdy", "no-alt-protocols"); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 command_line_.AppendSwitch(switches::kEnableQuic); | 461 command_line_.AppendSwitch(switches::kEnableQuic); |
486 is_quic_allowed_by_policy_ = false; | 462 is_quic_allowed_by_policy_ = false; |
487 ConfigureQuicGlobals(); | 463 ConfigureQuicGlobals(); |
488 | 464 |
489 net::HttpNetworkSession::Params params; | 465 net::HttpNetworkSession::Params params; |
490 InitializeNetworkSessionParams(¶ms); | 466 InitializeNetworkSessionParams(¶ms); |
491 EXPECT_FALSE(params.enable_quic); | 467 EXPECT_FALSE(params.enable_quic); |
492 } | 468 } |
493 | 469 |
494 } // namespace test | 470 } // namespace test |
OLD | NEW |