summaryrefslogtreecommitdiffstats
path: root/net/ftp/ftp_network_transaction_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/ftp/ftp_network_transaction_unittest.cc')
-rw-r--r--net/ftp/ftp_network_transaction_unittest.cc27
1 files changed, 17 insertions, 10 deletions
diff --git a/net/ftp/ftp_network_transaction_unittest.cc b/net/ftp/ftp_network_transaction_unittest.cc
index 5d686e0..08be329 100644
--- a/net/ftp/ftp_network_transaction_unittest.cc
+++ b/net/ftp/ftp_network_transaction_unittest.cc
@@ -782,20 +782,23 @@ class FtpNetworkTransactionTest : public PlatformTest {
FtpRequestInfo request_info = GetRequestInfo(request);
EXPECT_EQ(LOAD_STATE_IDLE, transaction_.GetLoadState());
ASSERT_EQ(ERR_IO_PENDING,
- transaction_.Start(&request_info, &callback_, BoundNetLog()));
+ transaction_.Start(&request_info, callback_.callback(),
+ BoundNetLog()));
EXPECT_NE(LOAD_STATE_IDLE, transaction_.GetLoadState());
ASSERT_EQ(expected_result, callback_.WaitForResult());
if (expected_result == OK) {
scoped_refptr<IOBuffer> io_buffer(new IOBuffer(kBufferSize));
memset(io_buffer->data(), 0, kBufferSize);
ASSERT_EQ(ERR_IO_PENDING,
- transaction_.Read(io_buffer.get(), kBufferSize, &callback_));
+ transaction_.Read(io_buffer.get(), kBufferSize,
+ callback_.callback()));
ASSERT_EQ(static_cast<int>(mock_data.length()),
callback_.WaitForResult());
EXPECT_EQ(mock_data, std::string(io_buffer->data(), mock_data.length()));
// Do another Read to detect that the data socket is now closed.
- int rv = transaction_.Read(io_buffer.get(), kBufferSize, &callback_);
+ int rv = transaction_.Read(io_buffer.get(), kBufferSize,
+ callback_.callback());
if (rv == ERR_IO_PENDING) {
EXPECT_EQ(0, callback_.WaitForResult());
} else {
@@ -820,7 +823,7 @@ class FtpNetworkTransactionTest : public PlatformTest {
scoped_refptr<FtpNetworkSession> session_;
MockClientSocketFactory mock_socket_factory_;
FtpNetworkTransaction transaction_;
- TestOldCompletionCallback callback_;
+ TestCompletionCallback callback_;
};
TEST_F(FtpNetworkTransactionTest, FailedLookup) {
@@ -828,7 +831,8 @@ TEST_F(FtpNetworkTransactionTest, FailedLookup) {
host_resolver_->rules()->AddSimulatedFailure("badhost");
EXPECT_EQ(LOAD_STATE_IDLE, transaction_.GetLoadState());
ASSERT_EQ(ERR_IO_PENDING,
- transaction_.Start(&request_info, &callback_, BoundNetLog()));
+ transaction_.Start(&request_info, callback_.callback(),
+ BoundNetLog()));
ASSERT_EQ(ERR_NAME_NOT_RESOLVED, callback_.WaitForResult());
EXPECT_EQ(LOAD_STATE_IDLE, transaction_.GetLoadState());
}
@@ -1051,7 +1055,8 @@ TEST_F(FtpNetworkTransactionTest, DownloadTransactionEvilPasvUnsafeHost) {
// Start the transaction.
ASSERT_EQ(ERR_IO_PENDING,
- transaction_.Start(&request_info, &callback_, BoundNetLog()));
+ transaction_.Start(&request_info, callback_.callback(),
+ BoundNetLog()));
ASSERT_EQ(OK, callback_.WaitForResult());
// The transaction fires the callback when we can start reading data. That
@@ -1175,7 +1180,8 @@ TEST_F(FtpNetworkTransactionTest, EvilRestartUser) {
FtpRequestInfo request_info = GetRequestInfo("ftp://host/file");
ASSERT_EQ(ERR_IO_PENDING,
- transaction_.Start(&request_info, &callback_, BoundNetLog()));
+ transaction_.Start(&request_info, callback_.callback(),
+ BoundNetLog()));
ASSERT_EQ(ERR_FTP_FAILED, callback_.WaitForResult());
MockRead ctrl_reads[] = {
@@ -1194,7 +1200,7 @@ TEST_F(FtpNetworkTransactionTest, EvilRestartUser) {
AuthCredentials(
ASCIIToUTF16("foo\nownz0red"),
ASCIIToUTF16("innocent")),
- &callback_));
+ callback_.callback()));
EXPECT_EQ(ERR_MALFORMED_IDENTITY, callback_.WaitForResult());
}
@@ -1208,7 +1214,8 @@ TEST_F(FtpNetworkTransactionTest, EvilRestartPassword) {
FtpRequestInfo request_info = GetRequestInfo("ftp://host/file");
ASSERT_EQ(ERR_IO_PENDING,
- transaction_.Start(&request_info, &callback_, BoundNetLog()));
+ transaction_.Start(&request_info, callback_.callback(),
+ BoundNetLog()));
ASSERT_EQ(ERR_FTP_FAILED, callback_.WaitForResult());
MockRead ctrl_reads[] = {
@@ -1228,7 +1235,7 @@ TEST_F(FtpNetworkTransactionTest, EvilRestartPassword) {
transaction_.RestartWithAuth(
AuthCredentials(ASCIIToUTF16("innocent"),
ASCIIToUTF16("foo\nownz0red")),
- &callback_));
+ callback_.callback()));
EXPECT_EQ(ERR_MALFORMED_IDENTITY, callback_.WaitForResult());
}