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

Side by Side Diff: chrome/browser/io_thread_unittest.cc

Issue 1268313004: s/use_alternate_protocols/use_alternative_services/g (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re: #15. Created 5 years, 4 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 | « chrome/browser/io_thread.cc ('k') | chrome/browser/resources/net_internals/spdy_view.html » ('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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 TEST_F(IOThreadTest, SpdyFieldTrialHoldbackEnabled) { 92 TEST_F(IOThreadTest, SpdyFieldTrialHoldbackEnabled) {
93 net::HttpStreamFactory::set_spdy_enabled(true); 93 net::HttpStreamFactory::set_spdy_enabled(true);
94 field_trial_group_ = "SpdyDisabled"; 94 field_trial_group_ = "SpdyDisabled";
95 ConfigureSpdyGlobals(); 95 ConfigureSpdyGlobals();
96 EXPECT_FALSE(net::HttpStreamFactory::spdy_enabled()); 96 EXPECT_FALSE(net::HttpStreamFactory::spdy_enabled());
97 } 97 }
98 98
99 TEST_F(IOThreadTest, SpdyFieldTrialSpdy31Enabled) { 99 TEST_F(IOThreadTest, SpdyFieldTrialSpdy31Enabled) {
100 bool use_alternate_protocols = false; 100 bool use_alternative_services = false;
101 field_trial_group_ = "Spdy31Enabled"; 101 field_trial_group_ = "Spdy31Enabled";
102 ConfigureSpdyGlobals(); 102 ConfigureSpdyGlobals();
103 EXPECT_THAT(globals_.next_protos, 103 EXPECT_THAT(globals_.next_protos,
104 ElementsAre(net::kProtoHTTP11, 104 ElementsAre(net::kProtoHTTP11,
105 net::kProtoSPDY31)); 105 net::kProtoSPDY31));
106 globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); 106 globals_.use_alternative_services.CopyToIfSet(&use_alternative_services);
107 EXPECT_TRUE(use_alternate_protocols); 107 EXPECT_TRUE(use_alternative_services);
108 } 108 }
109 109
110 TEST_F(IOThreadTest, SpdyFieldTrialSpdy4Enabled) { 110 TEST_F(IOThreadTest, SpdyFieldTrialSpdy4Enabled) {
111 bool use_alternate_protocols = false; 111 bool use_alternative_services = false;
112 field_trial_group_ = "Spdy4Enabled"; 112 field_trial_group_ = "Spdy4Enabled";
113 ConfigureSpdyGlobals(); 113 ConfigureSpdyGlobals();
114 EXPECT_THAT(globals_.next_protos, 114 EXPECT_THAT(globals_.next_protos,
115 ElementsAre(net::kProtoHTTP11, net::kProtoSPDY31, 115 ElementsAre(net::kProtoHTTP11, net::kProtoSPDY31,
116 net::kProtoHTTP2_14, net::kProtoHTTP2)); 116 net::kProtoHTTP2_14, net::kProtoHTTP2));
117 globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); 117 globals_.use_alternative_services.CopyToIfSet(&use_alternative_services);
118 EXPECT_TRUE(use_alternate_protocols); 118 EXPECT_TRUE(use_alternative_services);
119 } 119 }
120 120
121 TEST_F(IOThreadTest, SpdyFieldTrialDefault) { 121 TEST_F(IOThreadTest, SpdyFieldTrialDefault) {
122 field_trial_group_ = ""; 122 field_trial_group_ = "";
123 ConfigureSpdyGlobals(); 123 ConfigureSpdyGlobals();
124 EXPECT_THAT(globals_.next_protos, 124 EXPECT_THAT(globals_.next_protos,
125 ElementsAre(net::kProtoHTTP11, net::kProtoSPDY31, 125 ElementsAre(net::kProtoHTTP11, net::kProtoSPDY31,
126 net::kProtoHTTP2_14, net::kProtoHTTP2)); 126 net::kProtoHTTP2_14, net::kProtoHTTP2));
127 bool use_alternate_protocols = false; 127 bool use_alternative_services = false;
128 globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); 128 globals_.use_alternative_services.CopyToIfSet(&use_alternative_services);
129 EXPECT_TRUE(use_alternate_protocols); 129 EXPECT_TRUE(use_alternative_services);
130 } 130 }
131 131
132 TEST_F(IOThreadTest, SpdyFieldTrialParametrized) { 132 TEST_F(IOThreadTest, SpdyFieldTrialParametrized) {
133 field_trial_params_["enable_spdy31"] = "false"; 133 field_trial_params_["enable_spdy31"] = "false";
134 // Undefined parameter "enable_http2_14" should default to false. 134 // Undefined parameter "enable_http2_14" should default to false.
135 field_trial_params_["enable_http2"] = "true"; 135 field_trial_params_["enable_http2"] = "true";
136 field_trial_group_ = "ParametrizedHTTP2Only"; 136 field_trial_group_ = "ParametrizedHTTP2Only";
137 ConfigureSpdyGlobals(); 137 ConfigureSpdyGlobals();
138 EXPECT_THAT(globals_.next_protos, 138 EXPECT_THAT(globals_.next_protos,
139 ElementsAre(net::kProtoHTTP11, net::kProtoHTTP2)); 139 ElementsAre(net::kProtoHTTP11, net::kProtoHTTP2));
140 bool use_alternate_protocols = false; 140 bool use_alternative_services = false;
141 globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); 141 globals_.use_alternative_services.CopyToIfSet(&use_alternative_services);
142 EXPECT_TRUE(use_alternate_protocols); 142 EXPECT_TRUE(use_alternative_services);
143 } 143 }
144 144
145 TEST_F(IOThreadTest, SpdyCommandLineUseSpdyOff) { 145 TEST_F(IOThreadTest, SpdyCommandLineUseSpdyOff) {
146 command_line_.AppendSwitchASCII("use-spdy", "off"); 146 command_line_.AppendSwitchASCII("use-spdy", "off");
147 // Command line should overwrite field trial group. 147 // Command line should overwrite field trial group.
148 field_trial_group_ = "Spdy4Enabled"; 148 field_trial_group_ = "Spdy4Enabled";
149 ConfigureSpdyGlobals(); 149 ConfigureSpdyGlobals();
150 EXPECT_EQ(0u, globals_.next_protos.size()); 150 EXPECT_EQ(0u, globals_.next_protos.size());
151 } 151 }
152 152
153 TEST_F(IOThreadTest, SpdyCommandLineUseSpdyDisableAltProtocols) { 153 TEST_F(IOThreadTest, SpdyCommandLineUseSpdyDisableAltProtocols) {
154 command_line_.AppendSwitchASCII("use-spdy", "no-alt-protocols"); 154 command_line_.AppendSwitchASCII("use-spdy", "no-alt-protocols");
155 ConfigureSpdyGlobals(); 155 ConfigureSpdyGlobals();
156 bool use_alternate_protocols = true; 156 bool use_alternative_services = true;
157 globals_.use_alternate_protocols.CopyToIfSet(&use_alternate_protocols); 157 globals_.use_alternative_services.CopyToIfSet(&use_alternative_services);
158 EXPECT_FALSE(use_alternate_protocols); 158 EXPECT_FALSE(use_alternative_services);
159 } 159 }
160 160
161 TEST_F(IOThreadTest, DisableQuicByDefault) { 161 TEST_F(IOThreadTest, DisableQuicByDefault) {
162 ConfigureQuicGlobals(); 162 ConfigureQuicGlobals();
163 net::HttpNetworkSession::Params params; 163 net::HttpNetworkSession::Params params;
164 InitializeNetworkSessionParams(&params); 164 InitializeNetworkSessionParams(&params);
165 EXPECT_FALSE(params.enable_quic); 165 EXPECT_FALSE(params.enable_quic);
166 EXPECT_FALSE(params.enable_quic_for_proxies); 166 EXPECT_FALSE(params.enable_quic_for_proxies);
167 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy()); 167 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy());
168 } 168 }
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 command_line_.AppendSwitch(switches::kEnableQuic); 454 command_line_.AppendSwitch(switches::kEnableQuic);
455 is_quic_allowed_by_policy_ = false; 455 is_quic_allowed_by_policy_ = false;
456 ConfigureQuicGlobals(); 456 ConfigureQuicGlobals();
457 457
458 net::HttpNetworkSession::Params params; 458 net::HttpNetworkSession::Params params;
459 InitializeNetworkSessionParams(&params); 459 InitializeNetworkSessionParams(&params);
460 EXPECT_FALSE(params.enable_quic); 460 EXPECT_FALSE(params.enable_quic);
461 } 461 }
462 462
463 } // namespace test 463 } // namespace test
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/resources/net_internals/spdy_view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698