OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 #include <string> | 6 #include <string> |
7 #include <sys/epoll.h> | 7 #include <sys/epoll.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 server_hostname_, | 234 server_hostname_, |
235 false, // not secure | 235 false, // not secure |
236 client_config_, | 236 client_config_, |
237 client_supported_versions_); | 237 client_supported_versions_); |
238 client->UseWriter(writer); | 238 client->UseWriter(writer); |
239 client->Connect(); | 239 client->Connect(); |
240 return client; | 240 return client; |
241 } | 241 } |
242 | 242 |
243 void set_client_initial_flow_control_receive_window(uint32 window) { | 243 void set_client_initial_flow_control_receive_window(uint32 window) { |
244 CHECK(client_.get() == NULL); | 244 CHECK(client_.get() == nullptr); |
245 DVLOG(1) << "Setting client initial flow control window: " << window; | 245 DVLOG(1) << "Setting client initial flow control window: " << window; |
246 client_config_.SetInitialFlowControlWindowToSend(window); | 246 client_config_.SetInitialFlowControlWindowToSend(window); |
247 } | 247 } |
248 | 248 |
249 void set_client_initial_stream_flow_control_receive_window(uint32 window) { | 249 void set_client_initial_stream_flow_control_receive_window(uint32 window) { |
250 CHECK(client_.get() == NULL); | 250 CHECK(client_.get() == nullptr); |
251 DVLOG(1) << "Setting client initial stream flow control window: " << window; | 251 DVLOG(1) << "Setting client initial stream flow control window: " << window; |
252 client_config_.SetInitialStreamFlowControlWindowToSend(window); | 252 client_config_.SetInitialStreamFlowControlWindowToSend(window); |
253 } | 253 } |
254 | 254 |
255 void set_client_initial_session_flow_control_receive_window(uint32 window) { | 255 void set_client_initial_session_flow_control_receive_window(uint32 window) { |
256 CHECK(client_.get() == NULL); | 256 CHECK(client_.get() == nullptr); |
257 DVLOG(1) << "Setting client initial session flow control window: " | 257 DVLOG(1) << "Setting client initial session flow control window: " |
258 << window; | 258 << window; |
259 client_config_.SetInitialSessionFlowControlWindowToSend(window); | 259 client_config_.SetInitialSessionFlowControlWindowToSend(window); |
260 } | 260 } |
261 | 261 |
262 void set_server_initial_flow_control_receive_window(uint32 window) { | 262 void set_server_initial_flow_control_receive_window(uint32 window) { |
263 CHECK(server_thread_.get() == NULL); | 263 CHECK(server_thread_.get() == nullptr); |
264 DVLOG(1) << "Setting server initial flow control window: " << window; | 264 DVLOG(1) << "Setting server initial flow control window: " << window; |
265 server_config_.SetInitialFlowControlWindowToSend(window); | 265 server_config_.SetInitialFlowControlWindowToSend(window); |
266 } | 266 } |
267 | 267 |
268 void set_server_initial_stream_flow_control_receive_window(uint32 window) { | 268 void set_server_initial_stream_flow_control_receive_window(uint32 window) { |
269 CHECK(server_thread_.get() == NULL); | 269 CHECK(server_thread_.get() == nullptr); |
270 DVLOG(1) << "Setting server initial stream flow control window: " | 270 DVLOG(1) << "Setting server initial stream flow control window: " |
271 << window; | 271 << window; |
272 server_config_.SetInitialStreamFlowControlWindowToSend(window); | 272 server_config_.SetInitialStreamFlowControlWindowToSend(window); |
273 } | 273 } |
274 | 274 |
275 void set_server_initial_session_flow_control_receive_window(uint32 window) { | 275 void set_server_initial_session_flow_control_receive_window(uint32 window) { |
276 CHECK(server_thread_.get() == NULL); | 276 CHECK(server_thread_.get() == nullptr); |
277 DVLOG(1) << "Setting server initial session flow control window: " | 277 DVLOG(1) << "Setting server initial session flow control window: " |
278 << window; | 278 << window; |
279 server_config_.SetInitialSessionFlowControlWindowToSend(window); | 279 server_config_.SetInitialSessionFlowControlWindowToSend(window); |
280 } | 280 } |
281 | 281 |
282 const QuicSentPacketManager * | 282 const QuicSentPacketManager * |
283 GetSentPacketManagerFromFirstServerSession() const { | 283 GetSentPacketManagerFromFirstServerSession() const { |
284 QuicDispatcher* dispatcher = | 284 QuicDispatcher* dispatcher = |
285 QuicServerPeer::GetDispatcher(server_thread_->server()); | 285 QuicServerPeer::GetDispatcher(server_thread_->server()); |
286 QuicSession* session = dispatcher->session_map().begin()->second; | 286 QuicSession* session = dispatcher->session_map().begin()->second; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 ASSERT_TRUE(Initialize()); | 495 ASSERT_TRUE(Initialize()); |
496 | 496 |
497 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); | 497 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); |
498 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); | 498 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); |
499 EXPECT_EQ(kBarResponseBody, client_->SendSynchronousRequest("/bar")); | 499 EXPECT_EQ(kBarResponseBody, client_->SendSynchronousRequest("/bar")); |
500 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); | 500 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); |
501 } | 501 } |
502 | 502 |
503 TEST_P(EndToEndTest, MultipleClients) { | 503 TEST_P(EndToEndTest, MultipleClients) { |
504 ASSERT_TRUE(Initialize()); | 504 ASSERT_TRUE(Initialize()); |
505 scoped_ptr<QuicTestClient> client2(CreateQuicClient(NULL)); | 505 scoped_ptr<QuicTestClient> client2(CreateQuicClient(nullptr)); |
506 | 506 |
507 HTTPMessage request(HttpConstants::HTTP_1_1, | 507 HTTPMessage request(HttpConstants::HTTP_1_1, |
508 HttpConstants::POST, "/foo"); | 508 HttpConstants::POST, "/foo"); |
509 request.AddHeader("content-length", "3"); | 509 request.AddHeader("content-length", "3"); |
510 request.set_has_complete_message(false); | 510 request.set_has_complete_message(false); |
511 | 511 |
512 client_->SendMessage(request); | 512 client_->SendMessage(request); |
513 client2->SendMessage(request); | 513 client2->SendMessage(request); |
514 | 514 |
515 client_->SendData("bar", true); | 515 client_->SendData("bar", true); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 | 826 |
827 HTTPMessage request(HttpConstants::HTTP_1_1, | 827 HTTPMessage request(HttpConstants::HTTP_1_1, |
828 HttpConstants::POST, "/foo"); | 828 HttpConstants::POST, "/foo"); |
829 request.AddHeader("content-length", "3"); | 829 request.AddHeader("content-length", "3"); |
830 request.set_has_complete_message(false); | 830 request.set_has_complete_message(false); |
831 | 831 |
832 // Set the offset so we won't frame. Otherwise when we pick up termination | 832 // Set the offset so we won't frame. Otherwise when we pick up termination |
833 // before HTTP framing is complete, we send an error and close the stream, | 833 // before HTTP framing is complete, we send an error and close the stream, |
834 // and the second write is picked up as writing on a closed stream. | 834 // and the second write is picked up as writing on a closed stream. |
835 QuicSpdyClientStream* stream = client_->GetOrCreateStream(); | 835 QuicSpdyClientStream* stream = client_->GetOrCreateStream(); |
836 ASSERT_TRUE(stream != NULL); | 836 ASSERT_TRUE(stream != nullptr); |
837 ReliableQuicStreamPeer::SetStreamBytesWritten(3, stream); | 837 ReliableQuicStreamPeer::SetStreamBytesWritten(3, stream); |
838 | 838 |
839 client_->SendData("bar", true); | 839 client_->SendData("bar", true); |
840 client_->WaitForWriteToFlush(); | 840 client_->WaitForWriteToFlush(); |
841 | 841 |
842 // By default the stream protects itself from writes after terminte is set. | 842 // By default the stream protects itself from writes after terminte is set. |
843 // Override this to test the server handling buggy clients. | 843 // Override this to test the server handling buggy clients. |
844 ReliableQuicStreamPeer::SetWriteSideClosed( | 844 ReliableQuicStreamPeer::SetWriteSideClosed( |
845 false, client_->GetOrCreateStream()); | 845 false, client_->GetOrCreateStream()); |
846 | 846 |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 QuicSession* session = dispatcher->session_map().begin()->second; | 1363 QuicSession* session = dispatcher->session_map().begin()->second; |
1364 EXPECT_EQ(0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset( | 1364 EXPECT_EQ(0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset( |
1365 session).size()); | 1365 session).size()); |
1366 server_thread_->Resume(); | 1366 server_thread_->Resume(); |
1367 } | 1367 } |
1368 | 1368 |
1369 } // namespace | 1369 } // namespace |
1370 } // namespace test | 1370 } // namespace test |
1371 } // namespace tools | 1371 } // namespace tools |
1372 } // namespace net | 1372 } // namespace net |
OLD | NEW |