| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 120 } |
| 121 | 121 |
| 122 TEST_F(IOThreadTest, EnableQuicFromFieldTrialGroup) { | 122 TEST_F(IOThreadTest, EnableQuicFromFieldTrialGroup) { |
| 123 field_trial_group_ = "Enabled"; | 123 field_trial_group_ = "Enabled"; |
| 124 | 124 |
| 125 ConfigureQuicGlobals(); | 125 ConfigureQuicGlobals(); |
| 126 net::HttpNetworkSession::Params default_params; | 126 net::HttpNetworkSession::Params default_params; |
| 127 net::HttpNetworkSession::Params params; | 127 net::HttpNetworkSession::Params params; |
| 128 InitializeNetworkSessionParams(¶ms); | 128 InitializeNetworkSessionParams(¶ms); |
| 129 EXPECT_TRUE(params.enable_quic); | 129 EXPECT_TRUE(params.enable_quic); |
| 130 EXPECT_FALSE(params.enable_quic_pacing); | |
| 131 EXPECT_FALSE(params.enable_quic_time_based_loss_detection); | 130 EXPECT_FALSE(params.enable_quic_time_based_loss_detection); |
| 132 EXPECT_EQ(1350u, params.quic_max_packet_length); | 131 EXPECT_EQ(1350u, params.quic_max_packet_length); |
| 133 EXPECT_EQ(default_params.quic_supported_versions, | 132 EXPECT_EQ(default_params.quic_supported_versions, |
| 134 params.quic_supported_versions); | 133 params.quic_supported_versions); |
| 135 EXPECT_EQ(net::QuicTagVector(), params.quic_connection_options); | 134 EXPECT_EQ(net::QuicTagVector(), params.quic_connection_options); |
| 136 } | 135 } |
| 137 | 136 |
| 138 TEST_F(IOThreadTest, EnableQuicFromCommandLine) { | 137 TEST_F(IOThreadTest, EnableQuicFromCommandLine) { |
| 139 base::CommandLine::StringVector args; | 138 base::CommandLine::StringVector args; |
| 140 command_line_.AppendSwitch("enable-quic"); | 139 command_line_.AppendSwitch("enable-quic"); |
| 141 | 140 |
| 142 ConfigureQuicGlobals(); | 141 ConfigureQuicGlobals(); |
| 143 net::HttpNetworkSession::Params params; | 142 net::HttpNetworkSession::Params params; |
| 144 InitializeNetworkSessionParams(¶ms); | 143 InitializeNetworkSessionParams(¶ms); |
| 145 EXPECT_TRUE(params.enable_quic); | 144 EXPECT_TRUE(params.enable_quic); |
| 146 } | 145 } |
| 147 | 146 |
| 148 TEST_F(IOThreadTest, EnablePacingFromCommandLine) { | 147 TEST_F(IOThreadTest, EnablePacingFromCommandLine) { |
| 149 base::CommandLine::StringVector args; | 148 base::CommandLine::StringVector args; |
| 150 command_line_.AppendSwitch("enable-quic"); | 149 command_line_.AppendSwitch("enable-quic"); |
| 151 command_line_.AppendSwitch("enable-quic-pacing"); | 150 command_line_.AppendSwitch("enable-quic-pacing"); |
| 152 | 151 |
| 153 ConfigureQuicGlobals(); | 152 ConfigureQuicGlobals(); |
| 154 net::HttpNetworkSession::Params params; | 153 net::HttpNetworkSession::Params params; |
| 155 InitializeNetworkSessionParams(¶ms); | 154 InitializeNetworkSessionParams(¶ms); |
| 156 EXPECT_TRUE(params.enable_quic_pacing); | 155 net::QuicTagVector options; |
| 156 options.push_back(net::kPACE); |
| 157 EXPECT_EQ(options, params.quic_connection_options); |
| 157 } | 158 } |
| 158 | 159 |
| 159 TEST_F(IOThreadTest, EnablePacingFromFieldTrialGroup) { | 160 TEST_F(IOThreadTest, EnablePacingFromFieldTrialGroup) { |
| 160 field_trial_group_ = "EnabledWithPacing"; | 161 field_trial_group_ = "EnabledWithPacing"; |
| 161 | 162 |
| 162 ConfigureQuicGlobals(); | 163 ConfigureQuicGlobals(); |
| 163 net::HttpNetworkSession::Params params; | 164 net::HttpNetworkSession::Params params; |
| 164 InitializeNetworkSessionParams(¶ms); | 165 InitializeNetworkSessionParams(¶ms); |
| 165 EXPECT_TRUE(params.enable_quic_pacing); | 166 net::QuicTagVector options; |
| 167 options.push_back(net::kPACE); |
| 168 EXPECT_EQ(options, params.quic_connection_options); |
| 166 } | 169 } |
| 167 | 170 |
| 168 TEST_F(IOThreadTest, EnablePacingFromFieldTrialParams) { | 171 TEST_F(IOThreadTest, EnablePacingFromFieldTrialParams) { |
| 169 field_trial_group_ = "Enabled"; | 172 field_trial_group_ = "Enabled"; |
| 170 field_trial_params_["enable_pacing"] = "true"; | 173 field_trial_params_["enable_pacing"] = "true"; |
| 171 | 174 |
| 172 ConfigureQuicGlobals(); | 175 ConfigureQuicGlobals(); |
| 173 net::HttpNetworkSession::Params params; | 176 net::HttpNetworkSession::Params params; |
| 174 InitializeNetworkSessionParams(¶ms); | 177 InitializeNetworkSessionParams(¶ms); |
| 175 EXPECT_TRUE(params.enable_quic_pacing); | 178 net::QuicTagVector options; |
| 179 options.push_back(net::kPACE); |
| 180 EXPECT_EQ(options, params.quic_connection_options); |
| 176 } | 181 } |
| 177 | 182 |
| 178 TEST_F(IOThreadTest, EnableTimeBasedLossDetectionFromCommandLine) { | 183 TEST_F(IOThreadTest, EnableTimeBasedLossDetectionFromCommandLine) { |
| 179 base::CommandLine::StringVector args; | 184 base::CommandLine::StringVector args; |
| 180 command_line_.AppendSwitch("enable-quic"); | 185 command_line_.AppendSwitch("enable-quic"); |
| 181 command_line_.AppendSwitch("enable-quic-time-based-loss-detection"); | 186 command_line_.AppendSwitch("enable-quic-time-based-loss-detection"); |
| 182 | 187 |
| 183 ConfigureQuicGlobals(); | 188 ConfigureQuicGlobals(); |
| 184 net::HttpNetworkSession::Params params; | 189 net::HttpNetworkSession::Params params; |
| 185 InitializeNetworkSessionParams(¶ms); | 190 InitializeNetworkSessionParams(¶ms); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 298 |
| 294 net::QuicTagVector options; | 299 net::QuicTagVector options; |
| 295 options.push_back(net::kPACE); | 300 options.push_back(net::kPACE); |
| 296 options.push_back(net::kTIME); | 301 options.push_back(net::kTIME); |
| 297 options.push_back(net::kTBBR); | 302 options.push_back(net::kTBBR); |
| 298 options.push_back(net::kREJ); | 303 options.push_back(net::kREJ); |
| 299 EXPECT_EQ(options, params.quic_connection_options); | 304 EXPECT_EQ(options, params.quic_connection_options); |
| 300 } | 305 } |
| 301 | 306 |
| 302 } // namespace test | 307 } // namespace test |
| OLD | NEW |