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 50eeb36163a4a645ae98279fbb50132012254aaa..9e3e5c13f59b4d7029dcec8bd0e293ad00c2ece6 100644 |
--- a/net/url_request/url_request_ftp_job_unittest.cc |
+++ b/net/url_request/url_request_ftp_job_unittest.cc |
@@ -111,9 +111,7 @@ class TestURLRequestFtpJob : public URLRequestFtpJob { |
class MockFtpTransactionFactory : public FtpTransactionFactory { |
public: |
- virtual FtpTransaction* CreateTransaction() OVERRIDE { |
- return NULL; |
- } |
+ virtual FtpTransaction* CreateTransaction() OVERRIDE { return NULL; } |
virtual void Suspend(bool suspend) OVERRIDE {} |
}; |
@@ -144,8 +142,8 @@ class URLRequestFtpJobPriorityTest : public testing::Test { |
// Make sure that SetPriority actually sets the URLRequestFtpJob's |
// priority, both before and after start. |
TEST_F(URLRequestFtpJobPriorityTest, SetPriorityBasic) { |
- scoped_refptr<TestURLRequestFtpJob> job(new TestURLRequestFtpJob( |
- &req_, &ftp_factory_, &ftp_auth_cache_)); |
+ scoped_refptr<TestURLRequestFtpJob> job( |
+ new TestURLRequestFtpJob(&req_, &ftp_factory_, &ftp_auth_cache_)); |
EXPECT_EQ(DEFAULT_PRIORITY, job->priority()); |
job->SetPriority(LOWEST); |
@@ -164,8 +162,8 @@ TEST_F(URLRequestFtpJobPriorityTest, SetPriorityBasic) { |
// Make sure that URLRequestFtpJob passes on its priority to its |
// transaction on start. |
TEST_F(URLRequestFtpJobPriorityTest, SetTransactionPriorityOnStart) { |
- scoped_refptr<TestURLRequestFtpJob> job(new TestURLRequestFtpJob( |
- &req_, &ftp_factory_, &ftp_auth_cache_)); |
+ scoped_refptr<TestURLRequestFtpJob> job( |
+ new TestURLRequestFtpJob(&req_, &ftp_factory_, &ftp_auth_cache_)); |
job->SetPriority(LOW); |
EXPECT_FALSE(network_layer_.last_transaction()); |
@@ -179,8 +177,8 @@ TEST_F(URLRequestFtpJobPriorityTest, SetTransactionPriorityOnStart) { |
// Make sure that URLRequestFtpJob passes on its priority updates to |
// its transaction. |
TEST_F(URLRequestFtpJobPriorityTest, SetTransactionPriority) { |
- scoped_refptr<TestURLRequestFtpJob> job(new TestURLRequestFtpJob( |
- &req_, &ftp_factory_, &ftp_auth_cache_)); |
+ scoped_refptr<TestURLRequestFtpJob> job( |
+ new TestURLRequestFtpJob(&req_, &ftp_factory_, &ftp_auth_cache_)); |
job->SetPriority(LOW); |
job->Start(); |
ASSERT_TRUE(network_layer_.last_transaction()); |
@@ -193,8 +191,8 @@ TEST_F(URLRequestFtpJobPriorityTest, SetTransactionPriority) { |
// Make sure that URLRequestFtpJob passes on its priority updates to |
// newly-created transactions after the first one. |
TEST_F(URLRequestFtpJobPriorityTest, SetSubsequentTransactionPriority) { |
- scoped_refptr<TestURLRequestFtpJob> job(new TestURLRequestFtpJob( |
- &req_, &ftp_factory_, &ftp_auth_cache_)); |
+ scoped_refptr<TestURLRequestFtpJob> job( |
+ new TestURLRequestFtpJob(&req_, &ftp_factory_, &ftp_auth_cache_)); |
job->Start(); |
job->SetPriority(LOW); |
@@ -213,12 +211,11 @@ TEST_F(URLRequestFtpJobPriorityTest, SetSubsequentTransactionPriority) { |
class URLRequestFtpJobTest : public testing::Test { |
public: |
URLRequestFtpJobTest() |
- : request_context_(&socket_factory_, |
- new ProxyService( |
- new SimpleProxyConfigService, NULL, NULL), |
- &network_delegate_, |
- &ftp_transaction_factory_) { |
- } |
+ : request_context_( |
+ &socket_factory_, |
+ new ProxyService(new SimpleProxyConfigService, NULL, NULL), |
+ &network_delegate_, |
+ &ftp_transaction_factory_) {} |
virtual ~URLRequestFtpJobTest() { |
// Clean up any remaining tasks that mess up unrelated tests. |
@@ -226,10 +223,12 @@ class URLRequestFtpJobTest : public testing::Test { |
run_loop.RunUntilIdle(); |
} |
- void AddSocket(MockRead* reads, size_t reads_size, |
- MockWrite* writes, size_t writes_size) { |
- DeterministicSocketData* socket_data = new DeterministicSocketData( |
- reads, reads_size, writes, writes_size); |
+ void AddSocket(MockRead* reads, |
+ size_t reads_size, |
+ MockWrite* writes, |
+ size_t writes_size) { |
+ DeterministicSocketData* socket_data = |
+ new DeterministicSocketData(reads, reads_size, writes, writes_size); |
socket_data->set_connect_data(MockConnect(SYNCHRONOUS, OK)); |
socket_data->StopAfter(reads_size + writes_size - 1); |
socket_factory_.AddSocketDataProvider(socket_data); |
@@ -254,14 +253,16 @@ class URLRequestFtpJobTest : public testing::Test { |
TEST_F(URLRequestFtpJobTest, FtpProxyRequest) { |
MockWrite writes[] = { |
- MockWrite(ASYNC, 0, "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
- "Host: ftp.example.com\r\n" |
- "Proxy-Connection: keep-alive\r\n\r\n"), |
+ MockWrite(ASYNC, |
+ 0, |
+ "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
+ "Host: ftp.example.com\r\n" |
+ "Proxy-Connection: keep-alive\r\n\r\n"), |
}; |
MockRead reads[] = { |
- MockRead(ASYNC, 1, "HTTP/1.1 200 OK\r\n"), |
- MockRead(ASYNC, 2, "Content-Length: 9\r\n\r\n"), |
- MockRead(ASYNC, 3, "test.html"), |
+ MockRead(ASYNC, 1, "HTTP/1.1 200 OK\r\n"), |
+ MockRead(ASYNC, 2, "Content-Length: 9\r\n\r\n"), |
+ MockRead(ASYNC, 3, "test.html"), |
}; |
AddSocket(reads, arraysize(reads), writes, arraysize(writes)); |
@@ -285,11 +286,11 @@ TEST_F(URLRequestFtpJobTest, FtpProxyRequest) { |
// Regression test for http://crbug.com/237526 . |
TEST_F(URLRequestFtpJobTest, FtpProxyRequestOrphanJob) { |
// Use a PAC URL so that URLRequestFtpJob's |pac_request_| field is non-NULL. |
- request_context()->set_proxy_service( |
- new ProxyService( |
- new ProxyConfigServiceFixed( |
- ProxyConfig::CreateFromCustomPacURL(GURL("http://foo"))), |
- new MockAsyncProxyResolver, NULL)); |
+ request_context()->set_proxy_service(new ProxyService( |
+ new ProxyConfigServiceFixed( |
+ ProxyConfig::CreateFromCustomPacURL(GURL("http://foo"))), |
+ new MockAsyncProxyResolver, |
+ NULL)); |
TestDelegate request_delegate; |
URLRequest url_request(GURL("ftp://ftp.example.com/"), |
@@ -304,17 +305,21 @@ TEST_F(URLRequestFtpJobTest, FtpProxyRequestOrphanJob) { |
TEST_F(URLRequestFtpJobTest, FtpProxyRequestNeedProxyAuthNoCredentials) { |
MockWrite writes[] = { |
- MockWrite(ASYNC, 0, "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
- "Host: ftp.example.com\r\n" |
- "Proxy-Connection: keep-alive\r\n\r\n"), |
+ MockWrite(ASYNC, |
+ 0, |
+ "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
+ "Host: ftp.example.com\r\n" |
+ "Proxy-Connection: keep-alive\r\n\r\n"), |
}; |
MockRead reads[] = { |
- // No credentials. |
- MockRead(ASYNC, 1, "HTTP/1.1 407 Proxy Authentication Required\r\n"), |
- MockRead(ASYNC, 2, "Proxy-Authenticate: Basic " |
- "realm=\"MyRealm1\"\r\n"), |
- MockRead(ASYNC, 3, "Content-Length: 9\r\n\r\n"), |
- MockRead(ASYNC, 4, "test.html"), |
+ // No credentials. |
+ MockRead(ASYNC, 1, "HTTP/1.1 407 Proxy Authentication Required\r\n"), |
+ MockRead(ASYNC, |
+ 2, |
+ "Proxy-Authenticate: Basic " |
+ "realm=\"MyRealm1\"\r\n"), |
+ MockRead(ASYNC, 3, "Content-Length: 9\r\n\r\n"), |
+ MockRead(ASYNC, 4, "test.html"), |
}; |
AddSocket(reads, arraysize(reads), writes, arraysize(writes)); |
@@ -337,26 +342,32 @@ TEST_F(URLRequestFtpJobTest, FtpProxyRequestNeedProxyAuthNoCredentials) { |
TEST_F(URLRequestFtpJobTest, FtpProxyRequestNeedProxyAuthWithCredentials) { |
MockWrite writes[] = { |
- MockWrite(ASYNC, 0, "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
- "Host: ftp.example.com\r\n" |
- "Proxy-Connection: keep-alive\r\n\r\n"), |
- MockWrite(ASYNC, 5, "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
- "Host: ftp.example.com\r\n" |
- "Proxy-Connection: keep-alive\r\n" |
- "Proxy-Authorization: Basic bXl1c2VyOm15cGFzcw==\r\n\r\n"), |
+ MockWrite(ASYNC, |
+ 0, |
+ "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
+ "Host: ftp.example.com\r\n" |
+ "Proxy-Connection: keep-alive\r\n\r\n"), |
+ MockWrite(ASYNC, |
+ 5, |
+ "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
+ "Host: ftp.example.com\r\n" |
+ "Proxy-Connection: keep-alive\r\n" |
+ "Proxy-Authorization: Basic bXl1c2VyOm15cGFzcw==\r\n\r\n"), |
}; |
MockRead reads[] = { |
- // No credentials. |
- MockRead(ASYNC, 1, "HTTP/1.1 407 Proxy Authentication Required\r\n"), |
- MockRead(ASYNC, 2, "Proxy-Authenticate: Basic " |
- "realm=\"MyRealm1\"\r\n"), |
- MockRead(ASYNC, 3, "Content-Length: 9\r\n\r\n"), |
- MockRead(ASYNC, 4, "test.html"), |
- |
- // Second response. |
- MockRead(ASYNC, 6, "HTTP/1.1 200 OK\r\n"), |
- MockRead(ASYNC, 7, "Content-Length: 10\r\n\r\n"), |
- MockRead(ASYNC, 8, "test2.html"), |
+ // No credentials. |
+ MockRead(ASYNC, 1, "HTTP/1.1 407 Proxy Authentication Required\r\n"), |
+ MockRead(ASYNC, |
+ 2, |
+ "Proxy-Authenticate: Basic " |
+ "realm=\"MyRealm1\"\r\n"), |
+ MockRead(ASYNC, 3, "Content-Length: 9\r\n\r\n"), |
+ MockRead(ASYNC, 4, "test.html"), |
+ |
+ // Second response. |
+ MockRead(ASYNC, 6, "HTTP/1.1 200 OK\r\n"), |
+ MockRead(ASYNC, 7, "Content-Length: 10\r\n\r\n"), |
+ MockRead(ASYNC, 8, "test2.html"), |
}; |
AddSocket(reads, arraysize(reads), writes, arraysize(writes)); |
@@ -381,17 +392,20 @@ TEST_F(URLRequestFtpJobTest, FtpProxyRequestNeedProxyAuthWithCredentials) { |
TEST_F(URLRequestFtpJobTest, FtpProxyRequestNeedServerAuthNoCredentials) { |
MockWrite writes[] = { |
- MockWrite(ASYNC, 0, "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
- "Host: ftp.example.com\r\n" |
- "Proxy-Connection: keep-alive\r\n\r\n"), |
+ MockWrite(ASYNC, |
+ 0, |
+ "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
+ "Host: ftp.example.com\r\n" |
+ "Proxy-Connection: keep-alive\r\n\r\n"), |
}; |
- MockRead reads[] = { |
- // No credentials. |
- MockRead(ASYNC, 1, "HTTP/1.1 401 Unauthorized\r\n"), |
- MockRead(ASYNC, 2, "WWW-Authenticate: Basic " |
- "realm=\"MyRealm1\"\r\n"), |
- MockRead(ASYNC, 3, "Content-Length: 9\r\n\r\n"), |
- MockRead(ASYNC, 4, "test.html"), |
+ MockRead reads[] = {// No credentials. |
+ MockRead(ASYNC, 1, "HTTP/1.1 401 Unauthorized\r\n"), |
+ MockRead(ASYNC, |
+ 2, |
+ "WWW-Authenticate: Basic " |
+ "realm=\"MyRealm1\"\r\n"), |
+ MockRead(ASYNC, 3, "Content-Length: 9\r\n\r\n"), |
+ MockRead(ASYNC, 4, "test.html"), |
}; |
AddSocket(reads, arraysize(reads), writes, arraysize(writes)); |
@@ -414,26 +428,31 @@ TEST_F(URLRequestFtpJobTest, FtpProxyRequestNeedServerAuthNoCredentials) { |
TEST_F(URLRequestFtpJobTest, FtpProxyRequestNeedServerAuthWithCredentials) { |
MockWrite writes[] = { |
- MockWrite(ASYNC, 0, "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
- "Host: ftp.example.com\r\n" |
- "Proxy-Connection: keep-alive\r\n\r\n"), |
- MockWrite(ASYNC, 5, "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
- "Host: ftp.example.com\r\n" |
- "Proxy-Connection: keep-alive\r\n" |
- "Authorization: Basic bXl1c2VyOm15cGFzcw==\r\n\r\n"), |
+ MockWrite(ASYNC, |
+ 0, |
+ "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
+ "Host: ftp.example.com\r\n" |
+ "Proxy-Connection: keep-alive\r\n\r\n"), |
+ MockWrite(ASYNC, |
+ 5, |
+ "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
+ "Host: ftp.example.com\r\n" |
+ "Proxy-Connection: keep-alive\r\n" |
+ "Authorization: Basic bXl1c2VyOm15cGFzcw==\r\n\r\n"), |
}; |
- MockRead reads[] = { |
- // No credentials. |
- MockRead(ASYNC, 1, "HTTP/1.1 401 Unauthorized\r\n"), |
- MockRead(ASYNC, 2, "WWW-Authenticate: Basic " |
- "realm=\"MyRealm1\"\r\n"), |
- MockRead(ASYNC, 3, "Content-Length: 9\r\n\r\n"), |
- MockRead(ASYNC, 4, "test.html"), |
- |
- // Second response. |
- MockRead(ASYNC, 6, "HTTP/1.1 200 OK\r\n"), |
- MockRead(ASYNC, 7, "Content-Length: 10\r\n\r\n"), |
- MockRead(ASYNC, 8, "test2.html"), |
+ MockRead reads[] = {// No credentials. |
+ MockRead(ASYNC, 1, "HTTP/1.1 401 Unauthorized\r\n"), |
+ MockRead(ASYNC, |
+ 2, |
+ "WWW-Authenticate: Basic " |
+ "realm=\"MyRealm1\"\r\n"), |
+ MockRead(ASYNC, 3, "Content-Length: 9\r\n\r\n"), |
+ MockRead(ASYNC, 4, "test.html"), |
+ |
+ // Second response. |
+ MockRead(ASYNC, 6, "HTTP/1.1 200 OK\r\n"), |
+ MockRead(ASYNC, 7, "Content-Length: 10\r\n\r\n"), |
+ MockRead(ASYNC, 8, "test2.html"), |
}; |
AddSocket(reads, arraysize(reads), writes, arraysize(writes)); |
@@ -458,40 +477,50 @@ TEST_F(URLRequestFtpJobTest, FtpProxyRequestNeedServerAuthWithCredentials) { |
TEST_F(URLRequestFtpJobTest, FtpProxyRequestNeedProxyAndServerAuth) { |
MockWrite writes[] = { |
- MockWrite(ASYNC, 0, "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
- "Host: ftp.example.com\r\n" |
- "Proxy-Connection: keep-alive\r\n\r\n"), |
- MockWrite(ASYNC, 5, "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
- "Host: ftp.example.com\r\n" |
- "Proxy-Connection: keep-alive\r\n" |
- "Proxy-Authorization: Basic " |
- "cHJveHl1c2VyOnByb3h5cGFzcw==\r\n\r\n"), |
- MockWrite(ASYNC, 10, "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
- "Host: ftp.example.com\r\n" |
- "Proxy-Connection: keep-alive\r\n" |
- "Proxy-Authorization: Basic " |
- "cHJveHl1c2VyOnByb3h5cGFzcw==\r\n" |
- "Authorization: Basic bXl1c2VyOm15cGFzcw==\r\n\r\n"), |
+ MockWrite(ASYNC, |
+ 0, |
+ "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
+ "Host: ftp.example.com\r\n" |
+ "Proxy-Connection: keep-alive\r\n\r\n"), |
+ MockWrite(ASYNC, |
+ 5, |
+ "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
+ "Host: ftp.example.com\r\n" |
+ "Proxy-Connection: keep-alive\r\n" |
+ "Proxy-Authorization: Basic " |
+ "cHJveHl1c2VyOnByb3h5cGFzcw==\r\n\r\n"), |
+ MockWrite(ASYNC, |
+ 10, |
+ "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
+ "Host: ftp.example.com\r\n" |
+ "Proxy-Connection: keep-alive\r\n" |
+ "Proxy-Authorization: Basic " |
+ "cHJveHl1c2VyOnByb3h5cGFzcw==\r\n" |
+ "Authorization: Basic bXl1c2VyOm15cGFzcw==\r\n\r\n"), |
}; |
MockRead reads[] = { |
- // No credentials. |
- MockRead(ASYNC, 1, "HTTP/1.1 407 Proxy Authentication Required\r\n"), |
- MockRead(ASYNC, 2, "Proxy-Authenticate: Basic " |
- "realm=\"MyRealm1\"\r\n"), |
- MockRead(ASYNC, 3, "Content-Length: 9\r\n\r\n"), |
- MockRead(ASYNC, 4, "test.html"), |
- |
- // Second response. |
- MockRead(ASYNC, 6, "HTTP/1.1 401 Unauthorized\r\n"), |
- MockRead(ASYNC, 7, "WWW-Authenticate: Basic " |
- "realm=\"MyRealm1\"\r\n"), |
- MockRead(ASYNC, 8, "Content-Length: 9\r\n\r\n"), |
- MockRead(ASYNC, 9, "test.html"), |
- |
- // Third response. |
- MockRead(ASYNC, 11, "HTTP/1.1 200 OK\r\n"), |
- MockRead(ASYNC, 12, "Content-Length: 10\r\n\r\n"), |
- MockRead(ASYNC, 13, "test2.html"), |
+ // No credentials. |
+ MockRead(ASYNC, 1, "HTTP/1.1 407 Proxy Authentication Required\r\n"), |
+ MockRead(ASYNC, |
+ 2, |
+ "Proxy-Authenticate: Basic " |
+ "realm=\"MyRealm1\"\r\n"), |
+ MockRead(ASYNC, 3, "Content-Length: 9\r\n\r\n"), |
+ MockRead(ASYNC, 4, "test.html"), |
+ |
+ // Second response. |
+ MockRead(ASYNC, 6, "HTTP/1.1 401 Unauthorized\r\n"), |
+ MockRead(ASYNC, |
+ 7, |
+ "WWW-Authenticate: Basic " |
+ "realm=\"MyRealm1\"\r\n"), |
+ MockRead(ASYNC, 8, "Content-Length: 9\r\n\r\n"), |
+ MockRead(ASYNC, 9, "test.html"), |
+ |
+ // Third response. |
+ MockRead(ASYNC, 11, "HTTP/1.1 200 OK\r\n"), |
+ MockRead(ASYNC, 12, "Content-Length: 10\r\n\r\n"), |
+ MockRead(ASYNC, 13, "test2.html"), |
}; |
AddSocket(reads, arraysize(reads), writes, arraysize(writes)); |
@@ -526,15 +555,17 @@ TEST_F(URLRequestFtpJobTest, FtpProxyRequestNeedProxyAndServerAuth) { |
TEST_F(URLRequestFtpJobTest, FtpProxyRequestDoNotSaveCookies) { |
MockWrite writes[] = { |
- MockWrite(ASYNC, 0, "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
- "Host: ftp.example.com\r\n" |
- "Proxy-Connection: keep-alive\r\n\r\n"), |
+ MockWrite(ASYNC, |
+ 0, |
+ "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
+ "Host: ftp.example.com\r\n" |
+ "Proxy-Connection: keep-alive\r\n\r\n"), |
}; |
MockRead reads[] = { |
- MockRead(ASYNC, 1, "HTTP/1.1 200 OK\r\n"), |
- MockRead(ASYNC, 2, "Content-Length: 9\r\n"), |
- MockRead(ASYNC, 3, "Set-Cookie: name=value\r\n\r\n"), |
- MockRead(ASYNC, 4, "test.html"), |
+ MockRead(ASYNC, 1, "HTTP/1.1 200 OK\r\n"), |
+ MockRead(ASYNC, 2, "Content-Length: 9\r\n"), |
+ MockRead(ASYNC, 3, "Set-Cookie: name=value\r\n\r\n"), |
+ MockRead(ASYNC, 4, "test.html"), |
}; |
AddSocket(reads, arraysize(reads), writes, arraysize(writes)); |
@@ -562,13 +593,15 @@ TEST_F(URLRequestFtpJobTest, FtpProxyRequestDoNotSaveCookies) { |
TEST_F(URLRequestFtpJobTest, FtpProxyRequestDoNotFollowRedirects) { |
MockWrite writes[] = { |
- MockWrite(SYNCHRONOUS, 0, "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
- "Host: ftp.example.com\r\n" |
- "Proxy-Connection: keep-alive\r\n\r\n"), |
+ MockWrite(SYNCHRONOUS, |
+ 0, |
+ "GET ftp://ftp.example.com/ HTTP/1.1\r\n" |
+ "Host: ftp.example.com\r\n" |
+ "Proxy-Connection: keep-alive\r\n\r\n"), |
}; |
MockRead reads[] = { |
- MockRead(SYNCHRONOUS, 1, "HTTP/1.1 302 Found\r\n"), |
- MockRead(ASYNC, 2, "Location: http://other.example.com/\r\n\r\n"), |
+ MockRead(SYNCHRONOUS, 1, "HTTP/1.1 302 Found\r\n"), |
+ MockRead(ASYNC, 2, "Location: http://other.example.com/\r\n\r\n"), |
}; |
AddSocket(reads, arraysize(reads), writes, arraysize(writes)); |
@@ -599,20 +632,24 @@ TEST_F(URLRequestFtpJobTest, FtpProxyRequestDoNotFollowRedirects) { |
// We should re-use socket for requests using the same scheme, host, and port. |
TEST_F(URLRequestFtpJobTest, FtpProxyRequestReuseSocket) { |
MockWrite writes[] = { |
- MockWrite(ASYNC, 0, "GET ftp://ftp.example.com/first HTTP/1.1\r\n" |
- "Host: ftp.example.com\r\n" |
- "Proxy-Connection: keep-alive\r\n\r\n"), |
- MockWrite(ASYNC, 4, "GET ftp://ftp.example.com/second HTTP/1.1\r\n" |
- "Host: ftp.example.com\r\n" |
- "Proxy-Connection: keep-alive\r\n\r\n"), |
+ MockWrite(ASYNC, |
+ 0, |
+ "GET ftp://ftp.example.com/first HTTP/1.1\r\n" |
+ "Host: ftp.example.com\r\n" |
+ "Proxy-Connection: keep-alive\r\n\r\n"), |
+ MockWrite(ASYNC, |
+ 4, |
+ "GET ftp://ftp.example.com/second HTTP/1.1\r\n" |
+ "Host: ftp.example.com\r\n" |
+ "Proxy-Connection: keep-alive\r\n\r\n"), |
}; |
MockRead reads[] = { |
- MockRead(ASYNC, 1, "HTTP/1.1 200 OK\r\n"), |
- MockRead(ASYNC, 2, "Content-Length: 10\r\n\r\n"), |
- MockRead(ASYNC, 3, "test1.html"), |
- MockRead(ASYNC, 5, "HTTP/1.1 200 OK\r\n"), |
- MockRead(ASYNC, 6, "Content-Length: 10\r\n\r\n"), |
- MockRead(ASYNC, 7, "test2.html"), |
+ MockRead(ASYNC, 1, "HTTP/1.1 200 OK\r\n"), |
+ MockRead(ASYNC, 2, "Content-Length: 10\r\n\r\n"), |
+ MockRead(ASYNC, 3, "test1.html"), |
+ MockRead(ASYNC, 5, "HTTP/1.1 200 OK\r\n"), |
+ MockRead(ASYNC, 6, "Content-Length: 10\r\n\r\n"), |
+ MockRead(ASYNC, 7, "test2.html"), |
}; |
AddSocket(reads, arraysize(reads), writes, arraysize(writes)); |
@@ -652,27 +689,31 @@ TEST_F(URLRequestFtpJobTest, FtpProxyRequestReuseSocket) { |
// but one is FTP and the other is HTTP. |
TEST_F(URLRequestFtpJobTest, FtpProxyRequestDoNotReuseSocket) { |
MockWrite writes1[] = { |
- MockWrite(ASYNC, 0, "GET ftp://ftp.example.com/first HTTP/1.1\r\n" |
- "Host: ftp.example.com\r\n" |
- "Proxy-Connection: keep-alive\r\n\r\n"), |
+ MockWrite(ASYNC, |
+ 0, |
+ "GET ftp://ftp.example.com/first HTTP/1.1\r\n" |
+ "Host: ftp.example.com\r\n" |
+ "Proxy-Connection: keep-alive\r\n\r\n"), |
}; |
MockWrite writes2[] = { |
- MockWrite(ASYNC, 0, "GET /second HTTP/1.1\r\n" |
- "Host: ftp.example.com\r\n" |
- "Connection: keep-alive\r\n" |
- "User-Agent:\r\n" |
- "Accept-Encoding: gzip,deflate\r\n" |
- "Accept-Language: en-us,fr\r\n\r\n"), |
+ MockWrite(ASYNC, |
+ 0, |
+ "GET /second HTTP/1.1\r\n" |
+ "Host: ftp.example.com\r\n" |
+ "Connection: keep-alive\r\n" |
+ "User-Agent:\r\n" |
+ "Accept-Encoding: gzip,deflate\r\n" |
+ "Accept-Language: en-us,fr\r\n\r\n"), |
}; |
MockRead reads1[] = { |
- MockRead(ASYNC, 1, "HTTP/1.1 200 OK\r\n"), |
- MockRead(ASYNC, 2, "Content-Length: 10\r\n\r\n"), |
- MockRead(ASYNC, 3, "test1.html"), |
+ MockRead(ASYNC, 1, "HTTP/1.1 200 OK\r\n"), |
+ MockRead(ASYNC, 2, "Content-Length: 10\r\n\r\n"), |
+ MockRead(ASYNC, 3, "test1.html"), |
}; |
MockRead reads2[] = { |
- MockRead(ASYNC, 1, "HTTP/1.1 200 OK\r\n"), |
- MockRead(ASYNC, 2, "Content-Length: 10\r\n\r\n"), |
- MockRead(ASYNC, 3, "test2.html"), |
+ MockRead(ASYNC, 1, "HTTP/1.1 200 OK\r\n"), |
+ MockRead(ASYNC, 2, "Content-Length: 10\r\n\r\n"), |
+ MockRead(ASYNC, 3, "test2.html"), |
}; |
AddSocket(reads1, arraysize(reads1), writes1, arraysize(writes1)); |