| 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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1685 HttpRequestInfo request; | 1685 HttpRequestInfo request; |
| 1686 request.method = "POST"; | 1686 request.method = "POST"; |
| 1687 request.url = GURL("http://www.google.com/"); | 1687 request.url = GURL("http://www.google.com/"); |
| 1688 // Create an empty UploadData. | 1688 // Create an empty UploadData. |
| 1689 request.upload_data = new UploadData(); | 1689 request.upload_data = new UploadData(); |
| 1690 | 1690 |
| 1691 // Http POST Content-Length is using UploadDataStream::size(). | 1691 // Http POST Content-Length is using UploadDataStream::size(). |
| 1692 // It is the same as request.upload_data->GetContentLengthSync(). | 1692 // It is the same as request.upload_data->GetContentLengthSync(). |
| 1693 scoped_ptr<UploadDataStream> stream( | 1693 scoped_ptr<UploadDataStream> stream( |
| 1694 new UploadDataStream(request.upload_data)); | 1694 new UploadDataStream(request.upload_data)); |
| 1695 ASSERT_EQ(OK, stream->Init()); | 1695 ASSERT_EQ(OK, stream->InitSync()); |
| 1696 ASSERT_EQ(request.upload_data->GetContentLengthSync(), | 1696 ASSERT_EQ(request.upload_data->GetContentLengthSync(), |
| 1697 stream->size()); | 1697 stream->size()); |
| 1698 | 1698 |
| 1699 scoped_ptr<spdy::SpdyFrame> | 1699 scoped_ptr<spdy::SpdyFrame> |
| 1700 req(ConstructSpdyPost( | 1700 req(ConstructSpdyPost( |
| 1701 request.upload_data->GetContentLengthSync(), NULL, 0)); | 1701 request.upload_data->GetContentLengthSync(), NULL, 0)); |
| 1702 // Set the FIN bit since there will be no body. | 1702 // Set the FIN bit since there will be no body. |
| 1703 req->set_flags(spdy::CONTROL_FLAG_FIN); | 1703 req->set_flags(spdy::CONTROL_FLAG_FIN); |
| 1704 MockWrite writes[] = { | 1704 MockWrite writes[] = { |
| 1705 CreateMockWrite(*req), | 1705 CreateMockWrite(*req), |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1734 HttpRequestInfo request; | 1734 HttpRequestInfo request; |
| 1735 request.method = "POST"; | 1735 request.method = "POST"; |
| 1736 request.url = GURL("http://www.google.com/"); | 1736 request.url = GURL("http://www.google.com/"); |
| 1737 request.upload_data = new UploadData(); | 1737 request.upload_data = new UploadData(); |
| 1738 request.upload_data->AppendBytes(upload, sizeof(upload)); | 1738 request.upload_data->AppendBytes(upload, sizeof(upload)); |
| 1739 | 1739 |
| 1740 // Http POST Content-Length is using UploadDataStream::size(). | 1740 // Http POST Content-Length is using UploadDataStream::size(). |
| 1741 // It is the same as request.upload_data->GetContentLengthSync(). | 1741 // It is the same as request.upload_data->GetContentLengthSync(). |
| 1742 scoped_ptr<UploadDataStream> stream( | 1742 scoped_ptr<UploadDataStream> stream( |
| 1743 new UploadDataStream(request.upload_data)); | 1743 new UploadDataStream(request.upload_data)); |
| 1744 ASSERT_EQ(OK, stream->Init()); | 1744 ASSERT_EQ(OK, stream->InitSync()); |
| 1745 ASSERT_EQ(request.upload_data->GetContentLengthSync(), | 1745 ASSERT_EQ(request.upload_data->GetContentLengthSync(), |
| 1746 stream->size()); | 1746 stream->size()); |
| 1747 scoped_ptr<spdy::SpdyFrame> stream_reply(ConstructSpdyPostSynReply(NULL, 0)); | 1747 scoped_ptr<spdy::SpdyFrame> stream_reply(ConstructSpdyPostSynReply(NULL, 0)); |
| 1748 scoped_ptr<spdy::SpdyFrame> stream_body(ConstructSpdyBodyFrame(1, true)); | 1748 scoped_ptr<spdy::SpdyFrame> stream_body(ConstructSpdyBodyFrame(1, true)); |
| 1749 MockRead reads[] = { | 1749 MockRead reads[] = { |
| 1750 CreateMockRead(*stream_reply, 2), | 1750 CreateMockRead(*stream_reply, 2), |
| 1751 CreateMockRead(*stream_body, 3), | 1751 CreateMockRead(*stream_body, 3), |
| 1752 MockRead(false, 0, 0) // EOF | 1752 MockRead(false, 0, 0) // EOF |
| 1753 }; | 1753 }; |
| 1754 | 1754 |
| (...skipping 3948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5703 << " Write index: " | 5703 << " Write index: " |
| 5704 << data->write_index(); | 5704 << data->write_index(); |
| 5705 | 5705 |
| 5706 // Verify the SYN_REPLY. | 5706 // Verify the SYN_REPLY. |
| 5707 HttpResponseInfo response = *trans->GetResponseInfo(); | 5707 HttpResponseInfo response = *trans->GetResponseInfo(); |
| 5708 EXPECT_TRUE(response.headers != NULL); | 5708 EXPECT_TRUE(response.headers != NULL); |
| 5709 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); | 5709 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); |
| 5710 } | 5710 } |
| 5711 | 5711 |
| 5712 } // namespace net | 5712 } // namespace net |
| OLD | NEW |