| 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_stream_parser.h" | 5 #include "net/http/http_stream_parser.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "googleurl/src/gurl.h" | |
| 14 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
| 15 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 16 #include "net/base/test_completion_callback.h" | 15 #include "net/base/test_completion_callback.h" |
| 17 #include "net/base/upload_bytes_element_reader.h" | 16 #include "net/base/upload_bytes_element_reader.h" |
| 18 #include "net/base/upload_data_stream.h" | 17 #include "net/base/upload_data_stream.h" |
| 19 #include "net/base/upload_file_element_reader.h" | 18 #include "net/base/upload_file_element_reader.h" |
| 20 #include "net/http/http_request_headers.h" | 19 #include "net/http/http_request_headers.h" |
| 21 #include "net/http/http_request_info.h" | 20 #include "net/http/http_request_info.h" |
| 22 #include "net/http/http_response_info.h" | 21 #include "net/http/http_response_info.h" |
| 23 #include "net/socket/client_socket_handle.h" | 22 #include "net/socket/client_socket_handle.h" |
| 24 #include "net/socket/socket_test_util.h" | 23 #include "net/socket/socket_test_util.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 25 #include "url/gurl.h" |
| 26 | 26 |
| 27 namespace net { | 27 namespace net { |
| 28 | 28 |
| 29 const size_t kOutputSize = 1024; // Just large enough for this test. | 29 const size_t kOutputSize = 1024; // Just large enough for this test. |
| 30 // The number of bytes that can fit in a buffer of kOutputSize. | 30 // The number of bytes that can fit in a buffer of kOutputSize. |
| 31 const size_t kMaxPayloadSize = | 31 const size_t kMaxPayloadSize = |
| 32 kOutputSize - HttpStreamParser::kChunkHeaderFooterSize; | 32 kOutputSize - HttpStreamParser::kChunkHeaderFooterSize; |
| 33 | 33 |
| 34 // The empty payload is how the last chunk is encoded. | 34 // The empty payload is how the last chunk is encoded. |
| 35 TEST(HttpStreamParser, EncodeChunk_EmptyPayload) { | 35 TEST(HttpStreamParser, EncodeChunk_EmptyPayload) { |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 } else { | 407 } else { |
| 408 EXPECT_EQ(ERR_RESPONSE_HEADERS_TRUNCATED, rv); | 408 EXPECT_EQ(ERR_RESPONSE_HEADERS_TRUNCATED, rv); |
| 409 EXPECT_FALSE(response_info.headers.get()); | 409 EXPECT_FALSE(response_info.headers.get()); |
| 410 } | 410 } |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 } | 413 } |
| 414 } | 414 } |
| 415 | 415 |
| 416 } // namespace net | 416 } // namespace net |
| OLD | NEW |