| 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 "chrome/browser/io_thread.h" | 6 #include "chrome/browser/io_thread.h" |
| 7 #include "net/http/http_network_session.h" | 7 #include "net/http/http_network_session.h" |
| 8 #include "net/http/http_server_properties_impl.h" | 8 #include "net/http/http_server_properties_impl.h" |
| 9 #include "net/quic/quic_protocol.h" | 9 #include "net/quic/quic_protocol.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 net::kProtoSPDY31)); | 107 net::kProtoSPDY31)); |
| 108 globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); | 108 globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); |
| 109 EXPECT_TRUE(use_alternate_protocols); | 109 EXPECT_TRUE(use_alternate_protocols); |
| 110 } | 110 } |
| 111 | 111 |
| 112 TEST_F(IOThreadTest, DisableQuicByDefault) { | 112 TEST_F(IOThreadTest, DisableQuicByDefault) { |
| 113 ConfigureQuicGlobals(); | 113 ConfigureQuicGlobals(); |
| 114 net::HttpNetworkSession::Params params; | 114 net::HttpNetworkSession::Params params; |
| 115 InitializeNetworkSessionParams(¶ms); | 115 InitializeNetworkSessionParams(¶ms); |
| 116 EXPECT_FALSE(params.enable_quic); | 116 EXPECT_FALSE(params.enable_quic); |
| 117 EXPECT_FALSE(params.enable_quic_for_proxies); |
| 117 } | 118 } |
| 118 | 119 |
| 119 TEST_F(IOThreadTest, EnableQuicFromFieldTrialGroup) { | 120 TEST_F(IOThreadTest, EnableQuicFromFieldTrialGroup) { |
| 120 field_trial_group_ = "Enabled"; | 121 field_trial_group_ = "Enabled"; |
| 121 | 122 |
| 122 ConfigureQuicGlobals(); | 123 ConfigureQuicGlobals(); |
| 123 net::HttpNetworkSession::Params default_params; | 124 net::HttpNetworkSession::Params default_params; |
| 124 net::HttpNetworkSession::Params params; | 125 net::HttpNetworkSession::Params params; |
| 125 InitializeNetworkSessionParams(¶ms); | 126 InitializeNetworkSessionParams(¶ms); |
| 126 EXPECT_TRUE(params.enable_quic); | 127 EXPECT_TRUE(params.enable_quic); |
| 128 EXPECT_TRUE(params.enable_quic_for_proxies); |
| 127 EXPECT_EQ(1350u, params.quic_max_packet_length); | 129 EXPECT_EQ(1350u, params.quic_max_packet_length); |
| 128 EXPECT_EQ(1.0, params.alternate_protocol_probability_threshold); | 130 EXPECT_EQ(1.0, params.alternate_protocol_probability_threshold); |
| 129 EXPECT_EQ(default_params.quic_supported_versions, | 131 EXPECT_EQ(default_params.quic_supported_versions, |
| 130 params.quic_supported_versions); | 132 params.quic_supported_versions); |
| 131 EXPECT_EQ(net::QuicTagVector(), params.quic_connection_options); | 133 EXPECT_EQ(net::QuicTagVector(), params.quic_connection_options); |
| 132 EXPECT_FALSE(params.quic_always_require_handshake_confirmation); | 134 EXPECT_FALSE(params.quic_always_require_handshake_confirmation); |
| 133 EXPECT_FALSE(params.quic_disable_connection_pooling); | 135 EXPECT_FALSE(params.quic_disable_connection_pooling); |
| 134 EXPECT_EQ(0, params.quic_load_server_info_timeout_ms); | 136 EXPECT_EQ(0, params.quic_load_server_info_timeout_ms); |
| 135 EXPECT_EQ(0.0f, params.quic_load_server_info_timeout_srtt_multiplier); | 137 EXPECT_EQ(0.0f, params.quic_load_server_info_timeout_srtt_multiplier); |
| 136 EXPECT_FALSE(params.quic_enable_truncated_connection_ids); | 138 EXPECT_FALSE(params.quic_enable_truncated_connection_ids); |
| 137 } | 139 } |
| 138 | 140 |
| 139 TEST_F(IOThreadTest, EnableQuicFromCommandLine) { | 141 TEST_F(IOThreadTest, EnableQuicFromCommandLine) { |
| 140 command_line_.AppendSwitch("enable-quic"); | 142 command_line_.AppendSwitch("enable-quic"); |
| 141 | 143 |
| 142 ConfigureQuicGlobals(); | 144 ConfigureQuicGlobals(); |
| 143 net::HttpNetworkSession::Params params; | 145 net::HttpNetworkSession::Params params; |
| 144 InitializeNetworkSessionParams(¶ms); | 146 InitializeNetworkSessionParams(¶ms); |
| 145 EXPECT_TRUE(params.enable_quic); | 147 EXPECT_TRUE(params.enable_quic); |
| 148 EXPECT_TRUE(params.enable_quic_for_proxies); |
| 146 } | 149 } |
| 147 | 150 |
| 148 TEST_F(IOThreadTest, EnablePacingFromCommandLine) { | 151 TEST_F(IOThreadTest, EnablePacingFromCommandLine) { |
| 149 command_line_.AppendSwitch("enable-quic"); | 152 command_line_.AppendSwitch("enable-quic"); |
| 150 command_line_.AppendSwitch("enable-quic-pacing"); | 153 command_line_.AppendSwitch("enable-quic-pacing"); |
| 151 | 154 |
| 152 ConfigureQuicGlobals(); | 155 ConfigureQuicGlobals(); |
| 153 net::HttpNetworkSession::Params params; | 156 net::HttpNetworkSession::Params params; |
| 154 InitializeNetworkSessionParams(¶ms); | 157 InitializeNetworkSessionParams(¶ms); |
| 155 net::QuicTagVector options; | 158 net::QuicTagVector options; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 field_trial_group_ = "Enabled"; | 325 field_trial_group_ = "Enabled"; |
| 323 field_trial_params_["alternate_protocol_probability_threshold"] = ".5"; | 326 field_trial_params_["alternate_protocol_probability_threshold"] = ".5"; |
| 324 | 327 |
| 325 ConfigureQuicGlobals(); | 328 ConfigureQuicGlobals(); |
| 326 net::HttpNetworkSession::Params params; | 329 net::HttpNetworkSession::Params params; |
| 327 InitializeNetworkSessionParams(¶ms); | 330 InitializeNetworkSessionParams(¶ms); |
| 328 EXPECT_EQ(.5, params.alternate_protocol_probability_threshold); | 331 EXPECT_EQ(.5, params.alternate_protocol_probability_threshold); |
| 329 } | 332 } |
| 330 | 333 |
| 331 } // namespace test | 334 } // namespace test |
| OLD | NEW |