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 "net/quic/quic_http_stream.h" | 5 #include "net/quic/quic_http_stream.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
12 #include "net/base/chunked_upload_data_stream.h" | 13 #include "net/base/chunked_upload_data_stream.h" |
13 #include "net/base/elements_upload_data_stream.h" | 14 #include "net/base/elements_upload_data_stream.h" |
14 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
15 #include "net/base/socket_performance_watcher.h" | 16 #include "net/base/socket_performance_watcher.h" |
16 #include "net/base/test_completion_callback.h" | 17 #include "net/base/test_completion_callback.h" |
17 #include "net/base/upload_bytes_element_reader.h" | 18 #include "net/base/upload_bytes_element_reader.h" |
18 #include "net/http/http_response_headers.h" | 19 #include "net/http/http_response_headers.h" |
19 #include "net/http/transport_security_state.h" | 20 #include "net/http/transport_security_state.h" |
20 #include "net/quic/congestion_control/send_algorithm_interface.h" | 21 #include "net/quic/congestion_control/send_algorithm_interface.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 TEST_P(QuicHttpStreamTest, SendPostRequest) { | 512 TEST_P(QuicHttpStreamTest, SendPostRequest) { |
512 SetRequest("POST", "/", DEFAULT_PRIORITY); | 513 SetRequest("POST", "/", DEFAULT_PRIORITY); |
513 size_t spdy_request_headers_frame_length; | 514 size_t spdy_request_headers_frame_length; |
514 AddWrite(ConstructRequestHeadersPacket(1, !kFin, DEFAULT_PRIORITY, | 515 AddWrite(ConstructRequestHeadersPacket(1, !kFin, DEFAULT_PRIORITY, |
515 &spdy_request_headers_frame_length)); | 516 &spdy_request_headers_frame_length)); |
516 AddWrite(ConstructDataPacket(2, kIncludeVersion, kFin, 0, kUploadData)); | 517 AddWrite(ConstructDataPacket(2, kIncludeVersion, kFin, 0, kUploadData)); |
517 AddWrite(ConstructAckPacket(3, 3, 1)); | 518 AddWrite(ConstructAckPacket(3, 3, 1)); |
518 | 519 |
519 Initialize(); | 520 Initialize(); |
520 | 521 |
521 ScopedVector<UploadElementReader> element_readers; | 522 std::vector<scoped_ptr<UploadElementReader>> element_readers; |
522 element_readers.push_back( | 523 element_readers.push_back(make_scoped_ptr( |
523 new UploadBytesElementReader(kUploadData, strlen(kUploadData))); | 524 new UploadBytesElementReader(kUploadData, strlen(kUploadData)))); |
524 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 525 ElementsUploadDataStream upload_data_stream(std::move(element_readers), 0); |
525 request_.method = "POST"; | 526 request_.method = "POST"; |
526 request_.url = GURL("http://www.google.com/"); | 527 request_.url = GURL("http://www.google.com/"); |
527 request_.upload_data_stream = &upload_data_stream; | 528 request_.upload_data_stream = &upload_data_stream; |
528 ASSERT_EQ(OK, request_.upload_data_stream->Init(CompletionCallback())); | 529 ASSERT_EQ(OK, request_.upload_data_stream->Init(CompletionCallback())); |
529 | 530 |
530 EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, | 531 EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, |
531 net_log_, callback_.callback())); | 532 net_log_, callback_.callback())); |
532 EXPECT_EQ(OK, stream_->SendRequest(headers_, &response_, | 533 EXPECT_EQ(OK, stream_->SendRequest(headers_, &response_, |
533 callback_.callback())); | 534 callback_.callback())); |
534 | 535 |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, | 885 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, |
885 reliable_stream->EffectivePriority()); | 886 reliable_stream->EffectivePriority()); |
886 reliable_stream->SetDelegate(delegate); | 887 reliable_stream->SetDelegate(delegate); |
887 | 888 |
888 EXPECT_EQ(0, stream_->GetTotalSentBytes()); | 889 EXPECT_EQ(0, stream_->GetTotalSentBytes()); |
889 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); | 890 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); |
890 } | 891 } |
891 | 892 |
892 } // namespace test | 893 } // namespace test |
893 } // namespace net | 894 } // namespace net |
OLD | NEW |