Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: net/ftp/ftp_network_transaction_unittest.cc

Issue 1893083002: Change scoped_ptr to std::unique_ptr in //net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-net-all: iwyu Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/ftp/ftp_network_transaction.h ('k') | net/ftp/ftp_transaction_factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/macros.h"
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 mock_socket_factory_.AddSocketDataProvider(ctrl_socket); 877 mock_socket_factory_.AddSocketDataProvider(ctrl_socket);
878 878
879 std::string mock_data("mock-data"); 879 std::string mock_data("mock-data");
880 MockRead data_reads[] = { 880 MockRead data_reads[] = {
881 // Usually FTP servers close the data connection after the entire data has 881 // Usually FTP servers close the data connection after the entire data has
882 // been received. 882 // been received.
883 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), 883 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
884 MockRead(mock_data.c_str()), 884 MockRead(mock_data.c_str()),
885 }; 885 };
886 886
887 scoped_ptr<StaticSocketDataProvider> data_socket( 887 std::unique_ptr<StaticSocketDataProvider> data_socket(
888 new StaticSocketDataProvider(data_reads, arraysize(data_reads), NULL, 888 new StaticSocketDataProvider(data_reads, arraysize(data_reads), NULL,
889 0)); 889 0));
890 mock_socket_factory_.AddSocketDataProvider(data_socket.get()); 890 mock_socket_factory_.AddSocketDataProvider(data_socket.get());
891 FtpRequestInfo request_info = GetRequestInfo(request); 891 FtpRequestInfo request_info = GetRequestInfo(request);
892 EXPECT_EQ(LOAD_STATE_IDLE, transaction_.GetLoadState()); 892 EXPECT_EQ(LOAD_STATE_IDLE, transaction_.GetLoadState());
893 ASSERT_EQ(ERR_IO_PENDING, 893 ASSERT_EQ(ERR_IO_PENDING,
894 transaction_.Start(&request_info, callback_.callback(), 894 transaction_.Start(&request_info, callback_.callback(),
895 BoundNetLog())); 895 BoundNetLog()));
896 EXPECT_NE(LOAD_STATE_IDLE, transaction_.GetLoadState()); 896 EXPECT_NE(LOAD_STATE_IDLE, transaction_.GetLoadState());
897 ASSERT_EQ(expected_result, callback_.WaitForResult()); 897 ASSERT_EQ(expected_result, callback_.WaitForResult());
(...skipping 23 matching lines...) Expand all
921 void TransactionFailHelper(FtpSocketDataProvider* ctrl_socket, 921 void TransactionFailHelper(FtpSocketDataProvider* ctrl_socket,
922 const char* request, 922 const char* request,
923 FtpSocketDataProvider::State state, 923 FtpSocketDataProvider::State state,
924 FtpSocketDataProvider::State next_state, 924 FtpSocketDataProvider::State next_state,
925 const char* response, 925 const char* response,
926 int expected_result) { 926 int expected_result) {
927 ctrl_socket->InjectFailure(state, next_state, response); 927 ctrl_socket->InjectFailure(state, next_state, response);
928 ExecuteTransaction(ctrl_socket, request, expected_result); 928 ExecuteTransaction(ctrl_socket, request, expected_result);
929 } 929 }
930 930
931 scoped_ptr<MockHostResolver> host_resolver_; 931 std::unique_ptr<MockHostResolver> host_resolver_;
932 MockClientSocketFactory mock_socket_factory_; 932 MockClientSocketFactory mock_socket_factory_;
933 FtpNetworkTransaction transaction_; 933 FtpNetworkTransaction transaction_;
934 TestCompletionCallback callback_; 934 TestCompletionCallback callback_;
935 }; 935 };
936 936
937 TEST_P(FtpNetworkTransactionTest, FailedLookup) { 937 TEST_P(FtpNetworkTransactionTest, FailedLookup) {
938 FtpRequestInfo request_info = GetRequestInfo("ftp://badhost"); 938 FtpRequestInfo request_info = GetRequestInfo("ftp://badhost");
939 scoped_refptr<RuleBasedHostResolverProc> rules( 939 scoped_refptr<RuleBasedHostResolverProc> rules(
940 new RuleBasedHostResolverProc(NULL)); 940 new RuleBasedHostResolverProc(NULL));
941 rules->AddSimulatedFailure("badhost"); 941 rules->AddSimulatedFailure("badhost");
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 FtpSocketDataProvider::PRE_TYPE, 1653 FtpSocketDataProvider::PRE_TYPE,
1654 "257 \"\"\r\n", 1654 "257 \"\"\r\n",
1655 OK); 1655 OK);
1656 } 1656 }
1657 1657
1658 INSTANTIATE_TEST_CASE_P(FTP, 1658 INSTANTIATE_TEST_CASE_P(FTP,
1659 FtpNetworkTransactionTest, 1659 FtpNetworkTransactionTest,
1660 ::testing::Values(AF_INET, AF_INET6)); 1660 ::testing::Values(AF_INET, AF_INET6));
1661 1661
1662 } // namespace net 1662 } // namespace net
OLDNEW
« no previous file with comments | « net/ftp/ftp_network_transaction.h ('k') | net/ftp/ftp_transaction_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698