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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 EXPECT_THAT(globals_.next_protos, | 93 EXPECT_THAT(globals_.next_protos, |
94 ElementsAre(net::kProtoHTTP11, | 94 ElementsAre(net::kProtoHTTP11, |
95 net::kProtoQUIC1SPDY3, | 95 net::kProtoQUIC1SPDY3, |
96 net::kProtoSPDY3, | 96 net::kProtoSPDY3, |
97 net::kProtoSPDY31, | 97 net::kProtoSPDY31, |
98 net::kProtoSPDY4)); | 98 net::kProtoSPDY4)); |
99 globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); | 99 globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); |
100 EXPECT_TRUE(use_alternate_protocols); | 100 EXPECT_TRUE(use_alternate_protocols); |
101 } | 101 } |
102 | 102 |
| 103 TEST_F(IOThreadTest, SpdyFieldTrialSpdy4Experiment) { |
| 104 bool use_alternate_protocols = false; |
| 105 IOThreadPeer::ConfigureSpdyFromTrial("Spdy4Experiment", &globals_); |
| 106 EXPECT_THAT(globals_.next_protos, |
| 107 ElementsAre(net::kProtoHTTP11, |
| 108 net::kProtoQUIC1SPDY3, |
| 109 net::kProtoSPDY3, |
| 110 net::kProtoSPDY31, |
| 111 net::kProtoSPDY4)); |
| 112 globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); |
| 113 EXPECT_TRUE(use_alternate_protocols); |
| 114 } |
| 115 |
103 TEST_F(IOThreadTest, SpdyFieldTrialSpdy4Control) { | 116 TEST_F(IOThreadTest, SpdyFieldTrialSpdy4Control) { |
104 bool use_alternate_protocols = false; | 117 bool use_alternate_protocols = false; |
105 IOThreadPeer::ConfigureSpdyFromTrial("Spdy4Control", &globals_); | 118 IOThreadPeer::ConfigureSpdyFromTrial("Spdy4Control", &globals_); |
106 EXPECT_THAT(globals_.next_protos, | 119 EXPECT_THAT(globals_.next_protos, |
107 ElementsAre(net::kProtoHTTP11, | 120 ElementsAre(net::kProtoHTTP11, |
108 net::kProtoQUIC1SPDY3, | 121 net::kProtoQUIC1SPDY3, |
109 net::kProtoSPDY3, | 122 net::kProtoSPDY3, |
110 net::kProtoSPDY31)); | 123 net::kProtoSPDY31)); |
111 globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); | 124 globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); |
112 EXPECT_TRUE(use_alternate_protocols); | 125 EXPECT_TRUE(use_alternate_protocols); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 field_trial_group_ = "Enabled"; | 356 field_trial_group_ = "Enabled"; |
344 field_trial_params_["alternate_protocol_probability_threshold"] = ".5"; | 357 field_trial_params_["alternate_protocol_probability_threshold"] = ".5"; |
345 | 358 |
346 ConfigureQuicGlobals(); | 359 ConfigureQuicGlobals(); |
347 net::HttpNetworkSession::Params params; | 360 net::HttpNetworkSession::Params params; |
348 InitializeNetworkSessionParams(¶ms); | 361 InitializeNetworkSessionParams(¶ms); |
349 EXPECT_EQ(.5, params.alternate_protocol_probability_threshold); | 362 EXPECT_EQ(.5, params.alternate_protocol_probability_threshold); |
350 } | 363 } |
351 | 364 |
352 } // namespace test | 365 } // namespace test |
OLD | NEW |