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/ftp/ftp_network_transaction.h" | 5 #include "net/ftp/ftp_network_transaction.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "net/base/host_port_pair.h" | 14 #include "net/base/host_port_pair.h" |
14 #include "net/base/io_buffer.h" | 15 #include "net/base/io_buffer.h" |
15 #include "net/base/net_util.h" | 16 #include "net/base/net_util.h" |
16 #include "net/base/test_completion_callback.h" | 17 #include "net/base/test_completion_callback.h" |
17 #include "net/dns/mock_host_resolver.h" | 18 #include "net/dns/mock_host_resolver.h" |
18 #include "net/ftp/ftp_request_info.h" | 19 #include "net/ftp/ftp_request_info.h" |
19 #include "net/socket/socket_test_util.h" | 20 #include "net/socket/socket_test_util.h" |
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 } | 1380 } |
1380 | 1381 |
1381 TEST_P(FtpNetworkTransactionTest, Escaping) { | 1382 TEST_P(FtpNetworkTransactionTest, Escaping) { |
1382 FtpSocketDataProviderEscaping ctrl_socket; | 1383 FtpSocketDataProviderEscaping ctrl_socket; |
1383 ExecuteTransaction(&ctrl_socket, "ftp://host/%20%21%22%23%24%25%79%80%81", | 1384 ExecuteTransaction(&ctrl_socket, "ftp://host/%20%21%22%23%24%25%79%80%81", |
1384 OK); | 1385 OK); |
1385 } | 1386 } |
1386 | 1387 |
1387 // Test for http://crbug.com/23794. | 1388 // Test for http://crbug.com/23794. |
1388 TEST_P(FtpNetworkTransactionTest, DownloadTransactionEvilSize) { | 1389 TEST_P(FtpNetworkTransactionTest, DownloadTransactionEvilSize) { |
1389 // Try to overflow int64 in the response. | 1390 // Try to overflow int64_t in the response. |
1390 FtpSocketDataProviderEvilSize ctrl_socket( | 1391 FtpSocketDataProviderEvilSize ctrl_socket( |
1391 "213 99999999999999999999999999999999\r\n", | 1392 "213 99999999999999999999999999999999\r\n", |
1392 FtpSocketDataProvider::PRE_QUIT); | 1393 FtpSocketDataProvider::PRE_QUIT); |
1393 ExecuteTransaction(&ctrl_socket, "ftp://host/file", ERR_INVALID_RESPONSE); | 1394 ExecuteTransaction(&ctrl_socket, "ftp://host/file", ERR_INVALID_RESPONSE); |
1394 } | 1395 } |
1395 | 1396 |
1396 // Test for http://crbug.com/36360. | 1397 // Test for http://crbug.com/36360. |
1397 TEST_P(FtpNetworkTransactionTest, DownloadTransactionBigSize) { | 1398 TEST_P(FtpNetworkTransactionTest, DownloadTransactionBigSize) { |
1398 // Pass a valid, but large file size. The transaction should not fail. | 1399 // Pass a valid, but large file size. The transaction should not fail. |
1399 FtpSocketDataProviderEvilSize ctrl_socket( | 1400 FtpSocketDataProviderEvilSize ctrl_socket( |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 FtpSocketDataProvider::PRE_TYPE, | 1614 FtpSocketDataProvider::PRE_TYPE, |
1614 "257 \"\"\r\n", | 1615 "257 \"\"\r\n", |
1615 OK); | 1616 OK); |
1616 } | 1617 } |
1617 | 1618 |
1618 INSTANTIATE_TEST_CASE_P(FTP, | 1619 INSTANTIATE_TEST_CASE_P(FTP, |
1619 FtpNetworkTransactionTest, | 1620 FtpNetworkTransactionTest, |
1620 ::testing::Values(AF_INET, AF_INET6)); | 1621 ::testing::Values(AF_INET, AF_INET6)); |
1621 | 1622 |
1622 } // namespace net | 1623 } // namespace net |
OLD | NEW |