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

Side by Side Diff: net/http/http_pipelined_host_impl_unittest.cc

Issue 25977005: [SPDY] Do not advertise SPDY/2 by default (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/http/http_pipelined_host_impl.h" 5 #include "net/http/http_pipelined_host_impl.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "net/http/http_pipelined_connection.h" 8 #include "net/http/http_pipelined_connection.h"
9 #include "net/http/http_pipelined_host_test_util.h" 9 #include "net/http/http_pipelined_host_test_util.h"
10 #include "net/proxy/proxy_info.h" 10 #include "net/proxy/proxy_info.h"
(...skipping 30 matching lines...) Expand all
41 host_.reset(new HttpPipelinedHostImpl( 41 host_.reset(new HttpPipelinedHostImpl(
42 &delegate_, key_, factory_, capability)); 42 &delegate_, key_, factory_, capability));
43 } 43 }
44 44
45 MockPipeline* AddTestPipeline(int depth, bool usable, bool active) { 45 MockPipeline* AddTestPipeline(int depth, bool usable, bool active) {
46 MockPipeline* pipeline = new MockPipeline(depth, usable, active); 46 MockPipeline* pipeline = new MockPipeline(depth, usable, active);
47 EXPECT_CALL(*factory_, CreateNewPipeline(kDummyConnection, host_.get(), 47 EXPECT_CALL(*factory_, CreateNewPipeline(kDummyConnection, host_.get(),
48 MatchesOrigin(key_.origin()), 48 MatchesOrigin(key_.origin()),
49 Ref(ssl_config_), Ref(proxy_info_), 49 Ref(ssl_config_), Ref(proxy_info_),
50 Ref(net_log_), true, 50 Ref(net_log_), true,
51 kProtoSPDY2)) 51 kProtoSPDY3))
52 .Times(1) 52 .Times(1)
53 .WillOnce(Return(pipeline)); 53 .WillOnce(Return(pipeline));
54 EXPECT_CALL(*pipeline, CreateNewStream()) 54 EXPECT_CALL(*pipeline, CreateNewStream())
55 .Times(1) 55 .Times(1)
56 .WillOnce(Return(kDummyStream)); 56 .WillOnce(Return(kDummyStream));
57 EXPECT_EQ(kDummyStream, host_->CreateStreamOnNewPipeline( 57 EXPECT_EQ(kDummyStream, host_->CreateStreamOnNewPipeline(
58 kDummyConnection, ssl_config_, proxy_info_, net_log_, true, 58 kDummyConnection, ssl_config_, proxy_info_, net_log_, true,
59 kProtoSPDY2)); 59 kProtoSPDY3));
60 return pipeline; 60 return pipeline;
61 } 61 }
62 62
63 void ClearTestPipeline(MockPipeline* pipeline) { 63 void ClearTestPipeline(MockPipeline* pipeline) {
64 pipeline->SetState(0, true, true); 64 pipeline->SetState(0, true, true);
65 host_->OnPipelineHasCapacity(pipeline); 65 host_->OnPipelineHasCapacity(pipeline);
66 } 66 }
67 67
68 NiceMock<MockHostDelegate> delegate_; 68 NiceMock<MockHostDelegate> delegate_;
69 HttpPipelinedHost::Key key_; 69 HttpPipelinedHost::Key key_;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 .Times(0); 201 .Times(0);
202 EXPECT_CALL(delegate_, 202 EXPECT_CALL(delegate_,
203 OnHostDeterminedCapability(host_.get(), PIPELINE_INCAPABLE)) 203 OnHostDeterminedCapability(host_.get(), PIPELINE_INCAPABLE))
204 .Times(1); 204 .Times(1);
205 host_->OnPipelineFeedback(pipeline, 205 host_->OnPipelineFeedback(pipeline,
206 HttpPipelinedConnection::OLD_HTTP_VERSION); 206 HttpPipelinedConnection::OLD_HTTP_VERSION);
207 207
208 ClearTestPipeline(pipeline); 208 ClearTestPipeline(pipeline);
209 EXPECT_EQ(NULL, host_->CreateStreamOnNewPipeline( 209 EXPECT_EQ(NULL, host_->CreateStreamOnNewPipeline(
210 kDummyConnection, ssl_config_, proxy_info_, net_log_, true, 210 kDummyConnection, ssl_config_, proxy_info_, net_log_, true,
211 kProtoSPDY2)); 211 kProtoSPDY3));
212 } 212 }
213 213
214 TEST_F(HttpPipelinedHostImplTest, ShutsDownOnAuthenticationRequired) { 214 TEST_F(HttpPipelinedHostImplTest, ShutsDownOnAuthenticationRequired) {
215 SetCapability(PIPELINE_UNKNOWN); 215 SetCapability(PIPELINE_UNKNOWN);
216 MockPipeline* pipeline = AddTestPipeline(1, true, true); 216 MockPipeline* pipeline = AddTestPipeline(1, true, true);
217 217
218 EXPECT_EQ(NULL, host_->CreateStreamOnExistingPipeline()); 218 EXPECT_EQ(NULL, host_->CreateStreamOnExistingPipeline());
219 EXPECT_CALL(delegate_, OnHostHasAdditionalCapacity(host_.get())) 219 EXPECT_CALL(delegate_, OnHostHasAdditionalCapacity(host_.get()))
220 .Times(0); 220 .Times(0);
221 EXPECT_CALL(delegate_, 221 EXPECT_CALL(delegate_,
222 OnHostDeterminedCapability(host_.get(), PIPELINE_INCAPABLE)) 222 OnHostDeterminedCapability(host_.get(), PIPELINE_INCAPABLE))
223 .Times(1); 223 .Times(1);
224 host_->OnPipelineFeedback(pipeline, 224 host_->OnPipelineFeedback(pipeline,
225 HttpPipelinedConnection::AUTHENTICATION_REQUIRED); 225 HttpPipelinedConnection::AUTHENTICATION_REQUIRED);
226 226
227 ClearTestPipeline(pipeline); 227 ClearTestPipeline(pipeline);
228 EXPECT_EQ(NULL, host_->CreateStreamOnNewPipeline( 228 EXPECT_EQ(NULL, host_->CreateStreamOnNewPipeline(
229 kDummyConnection, ssl_config_, proxy_info_, net_log_, true, 229 kDummyConnection, ssl_config_, proxy_info_, net_log_, true,
230 kProtoSPDY2)); 230 kProtoSPDY3));
231 } 231 }
232 232
233 TEST_F(HttpPipelinedHostImplTest, ConnectionCloseHasNoEffect) { 233 TEST_F(HttpPipelinedHostImplTest, ConnectionCloseHasNoEffect) {
234 SetCapability(PIPELINE_UNKNOWN); 234 SetCapability(PIPELINE_UNKNOWN);
235 MockPipeline* pipeline = AddTestPipeline(1, true, true); 235 MockPipeline* pipeline = AddTestPipeline(1, true, true);
236 236
237 EXPECT_CALL(delegate_, OnHostHasAdditionalCapacity(host_.get())) 237 EXPECT_CALL(delegate_, OnHostHasAdditionalCapacity(host_.get()))
238 .Times(0); 238 .Times(0);
239 EXPECT_CALL(delegate_, OnHostDeterminedCapability(host_.get(), _)) 239 EXPECT_CALL(delegate_, OnHostDeterminedCapability(host_.get(), _))
240 .Times(0); 240 .Times(0);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 .Times(1); 299 .Times(1);
300 host_->OnPipelineFeedback(pipeline, 300 host_->OnPipelineFeedback(pipeline,
301 HttpPipelinedConnection::PIPELINE_SOCKET_ERROR); 301 HttpPipelinedConnection::PIPELINE_SOCKET_ERROR);
302 302
303 ClearTestPipeline(pipeline); 303 ClearTestPipeline(pipeline);
304 } 304 }
305 305
306 } // anonymous namespace 306 } // anonymous namespace
307 307
308 } // namespace net 308 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_pipelined_host_forced_unittest.cc ('k') | net/http/http_proxy_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698