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

Unified Diff: net/url_request/url_request_ftp_job_unittest.cc

Issue 11931024: Removed static factories for data, ftp, file, and about jobs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test for IsSafeRedirectTarget Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: net/url_request/url_request_ftp_job_unittest.cc
diff --git a/net/url_request/url_request_ftp_job_unittest.cc b/net/url_request/url_request_ftp_job_unittest.cc
index 7647b3f5ee7413f7e5c75668c7704dd629640d88..b7111f2c78561e48146c300b0c13f42c358a2bda 100644
--- a/net/url_request/url_request_ftp_job_unittest.cc
+++ b/net/url_request/url_request_ftp_job_unittest.cc
@@ -6,10 +6,13 @@
#include "base/run_loop.h"
#include "net/proxy/proxy_config_service.h"
#include "net/socket/socket_test_util.h"
+#include "net/url_request/ftp_protocol_handler.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
+#include "net/url_request/url_request_job_factory_impl.h"
#include "net/url_request/url_request_status.h"
#include "net/url_request/url_request_test_util.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
@@ -49,15 +52,26 @@ class SimpleProxyConfigService : public ProxyConfigService {
Observer* observer_;
};
+class MockFtpTransactionFactory : public FtpTransactionFactory {
+ public:
+ MOCK_METHOD0(CreateTransaction, FtpTransaction*());
+ MOCK_METHOD1(Suspend, void(bool suspend));
+};
+
class FtpTestURLRequestContext : public TestURLRequestContext {
public:
FtpTestURLRequestContext(ClientSocketFactory* socket_factory,
ProxyService* proxy_service,
- NetworkDelegate* network_delegate)
+ NetworkDelegate* network_delegate,
+ FtpTransactionFactory* ftp_transaction_factory)
: TestURLRequestContext(true) {
set_client_socket_factory(socket_factory);
context_storage_.set_proxy_service(proxy_service);
set_network_delegate(network_delegate);
+ URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl;
+ job_factory->SetProtocolHandler(
+ "ftp", new FtpProtocolHandler(ftp_transaction_factory));
+ context_storage_.set_job_factory(job_factory);
Init();
}
};
@@ -69,7 +83,8 @@ class URLRequestFtpJobTest : public testing::Test {
new SimpleProxyConfigService, NULL, NULL)),
request_context_(&socket_factory_,
proxy_service_,
- &network_delegate_) {
+ &network_delegate_,
+ &ftp_transaction_factory_) {
}
virtual ~URLRequestFtpJobTest() {
@@ -99,6 +114,7 @@ class URLRequestFtpJobTest : public testing::Test {
ScopedVector<DeterministicSocketData> socket_data_;
DeterministicMockClientSocketFactory socket_factory_;
TestNetworkDelegate network_delegate_;
+ ::testing::StrictMock<MockFtpTransactionFactory> ftp_transaction_factory_;
// Owned by |request_context_|:
ProxyService* proxy_service_;

Powered by Google App Engine
This is Rietveld 408576698