Index: net/http/http_network_transaction_unittest.cc |
=================================================================== |
--- net/http/http_network_transaction_unittest.cc (revision 227981) |
+++ net/http/http_network_transaction_unittest.cc (working copy) |
@@ -289,9 +289,9 @@ |
CapturingBoundNetLog log; |
session_deps_.net_log = log.bound().net_log(); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
for (size_t i = 0; i < data_count; ++i) { |
session_deps_.socket_factory->AddSocketDataProvider(data[i]); |
@@ -566,9 +566,9 @@ |
} // namespace |
TEST_P(HttpNetworkTransactionTest, Basic) { |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
} |
TEST_P(HttpNetworkTransactionTest, SimpleGET) { |
@@ -861,9 +861,9 @@ |
request.url = GURL("http://redirect.com/"); |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
session_deps_.socket_factory->AddSocketDataProvider(&data); |
@@ -905,9 +905,9 @@ |
request.url = GURL("http://www.google.com/"); |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes1[] = { |
MockWrite("HEAD / HTTP/1.1\r\n" |
@@ -1017,9 +1017,9 @@ |
request.upload_data_stream = &upload_data_stream; |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockRead data_reads[] = { |
MockRead("HTTP/1.0 100 Continue\r\n\r\n"), |
@@ -1059,9 +1059,9 @@ |
request.url = GURL("http://www.foo.com/"); |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockRead data_reads[] = { |
MockRead("HTTP/1.1 102 Unspecified status code\r\n\r\n" |
@@ -1098,9 +1098,9 @@ |
request.url = GURL("http://www.foo.com/"); |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockRead data_reads[] = { |
MockRead(SYNCHRONOUS, "HTTP/1.0 100 Continue\r\n"), |
@@ -1129,10 +1129,11 @@ |
request.url = GURL("http://www.foo.com/"); |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
+ |
MockRead data_reads[] = { |
MockRead(ASYNC, 0), |
}; |
@@ -1259,9 +1260,9 @@ |
request.url = GURL("http://www.google.com/"); |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockRead data_reads[] = { |
MockRead(ASYNC, ERR_CONNECTION_RESET), |
@@ -1507,9 +1508,9 @@ |
CapturingNetLog log; |
session_deps_.net_log = &log; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes1[] = { |
MockWrite("GET / HTTP/1.1\r\n" |
@@ -1600,9 +1601,9 @@ |
request.url = GURL("http://www.google.com/"); |
request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite("GET / HTTP/1.1\r\n" |
@@ -2263,9 +2264,9 @@ |
request.load_flags = 0; |
// We are using a DIRECT connection (i.e. no proxy) for this session. |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes1[] = { |
MockWrite("GET / HTTP/1.1\r\n" |
@@ -3529,7 +3530,6 @@ |
// Configure against proxy server "myproxy:70". |
session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); |
- |
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
// Since we have proxy, should try to establish tunnel. |
@@ -3741,11 +3741,12 @@ |
request.url = GURL("http://www.google.com/"); |
request.load_flags = 0; |
+ // Configure against proxy server "myproxy:70". |
session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
- // Configure against proxy server "myproxy:70". |
- scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ scoped_ptr<HttpTransaction> trans( |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes1[] = { |
MockWrite("GET http://www.google.com/ HTTP/1.1\r\n" |
@@ -4201,9 +4202,9 @@ |
request.url = GURL("http://www.google.com/"); |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
// Respond with 300 kb of headers (we should fail after 256 kb). |
std::string large_headers_string; |
@@ -4656,9 +4657,9 @@ |
request.url = GURL("http://foo:b@r@www.google.com/"); |
request.load_flags = LOAD_NORMAL; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
// The password contains an escaped character -- for this test to pass it |
// will need to be unescaped by HttpNetworkTransaction. |
@@ -4737,9 +4738,9 @@ |
request.load_flags = LOAD_NORMAL; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes1[] = { |
MockWrite("GET / HTTP/1.1\r\n" |
@@ -5356,9 +5357,9 @@ |
// Test the ResetStateForRestart() private method. |
TEST_P(HttpNetworkTransactionTest, ResetStateForRestart) { |
// Create a transaction (the dependencies aren't important). |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpNetworkTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
// Setup some state (which we expect ResetStateForRestart() will clear). |
trans->read_buf_ = new IOBuffer(15); |
@@ -5403,9 +5404,9 @@ |
request.url = GURL("https://www.google.com/"); |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite("GET / HTTP/1.1\r\n" |
@@ -5507,9 +5508,9 @@ |
for (int i = 0; i < 2; i++) { |
session_deps_.socket_factory->ResetNextMockIndexes(); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
@@ -5571,9 +5572,9 @@ |
TestCompletionCallback callback; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
@@ -5629,9 +5630,9 @@ |
TestCompletionCallback callback; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
@@ -5714,9 +5715,9 @@ |
TestCompletionCallback callback; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
@@ -5766,9 +5767,9 @@ |
TestCompletionCallback callback; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
@@ -5827,9 +5828,9 @@ |
TestCompletionCallback callback; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
@@ -6252,9 +6253,9 @@ |
TestCompletionCallback callback; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
@@ -6281,9 +6282,9 @@ |
request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, |
"Chromium Ultra Awesome X Edition"); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite("GET / HTTP/1.1\r\n" |
@@ -6321,9 +6322,9 @@ |
"Chromium Ultra Awesome X Edition"); |
session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" |
@@ -6360,9 +6361,9 @@ |
request.extra_headers.SetHeader(HttpRequestHeaders::kReferer, |
"http://the.previous.site.com/"); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite("GET / HTTP/1.1\r\n" |
@@ -6397,9 +6398,9 @@ |
request.method = "POST"; |
request.url = GURL("http://www.google.com/"); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite("POST / HTTP/1.1\r\n" |
@@ -6434,9 +6435,9 @@ |
request.method = "PUT"; |
request.url = GURL("http://www.google.com/"); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite("PUT / HTTP/1.1\r\n" |
@@ -6471,9 +6472,9 @@ |
request.method = "HEAD"; |
request.url = GURL("http://www.google.com/"); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite("HEAD / HTTP/1.1\r\n" |
@@ -6509,9 +6510,9 @@ |
request.url = GURL("http://www.google.com/"); |
request.load_flags = LOAD_BYPASS_CACHE; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite("GET / HTTP/1.1\r\n" |
@@ -6549,9 +6550,9 @@ |
request.url = GURL("http://www.google.com/"); |
request.load_flags = LOAD_VALIDATE_CACHE; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite("GET / HTTP/1.1\r\n" |
@@ -6587,9 +6588,9 @@ |
request.url = GURL("http://www.google.com/"); |
request.extra_headers.SetHeader("FooHeader", "Bar"); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite("GET / HTTP/1.1\r\n" |
@@ -6627,9 +6628,9 @@ |
request.extra_headers.SetHeader("hEllo", "Kitty"); |
request.extra_headers.SetHeader("FoO", "bar"); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite("GET / HTTP/1.1\r\n" |
@@ -6672,9 +6673,9 @@ |
CapturingNetLog net_log; |
session_deps_.net_log = &net_log; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; |
char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
@@ -6731,9 +6732,9 @@ |
CapturingNetLog net_log; |
session_deps_.net_log = &net_log; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
unsigned char write_buffer[] = { 0x04, 0x01, 0x01, 0xBB, 127, 0, 0, 1, 0 }; |
unsigned char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
@@ -6795,9 +6796,9 @@ |
CapturingNetLog net_log; |
session_deps_.net_log = &net_log; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; |
char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
@@ -6854,9 +6855,9 @@ |
CapturingNetLog net_log; |
session_deps_.net_log = &net_log; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; |
const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; |
@@ -6927,9 +6928,9 @@ |
CapturingNetLog net_log; |
session_deps_.net_log = &net_log; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; |
const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; |
@@ -7255,9 +7256,9 @@ |
// connecting to both proxies (myproxy:70 and foobar:80). |
session_deps_.host_resolver->rules()->AddSimulatedFailure("*"); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
TestCompletionCallback callback; |
@@ -7281,8 +7282,9 @@ |
// Select a host resolver that does caching. |
session_deps_.host_resolver.reset(new MockCachingHostResolver); |
- scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
+ scoped_ptr<HttpTransaction> trans( |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
// Warm up the host cache so it has an entry for "www.google.com". |
AddressList addrlist; |
@@ -7346,8 +7348,6 @@ |
// Make sure we can handle an error when writing the request. |
TEST_P(HttpNetworkTransactionTest, RequestWriteError) { |
- scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
- |
HttpRequestInfo request; |
request.method = "GET"; |
request.url = GURL("http://www.foo.com/"); |
@@ -7359,12 +7359,12 @@ |
StaticSocketDataProvider data(NULL, 0, |
write_failure, arraysize(write_failure)); |
session_deps_.socket_factory->AddSocketDataProvider(&data); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
TestCompletionCallback callback; |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
@@ -7375,8 +7375,6 @@ |
// Check that a connection closed after the start of the headers finishes ok. |
TEST_P(HttpNetworkTransactionTest, ConnectionClosedAfterStartOfHeaders) { |
- scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
- |
HttpRequestInfo request; |
request.method = "GET"; |
request.url = GURL("http://www.foo.com/"); |
@@ -7389,12 +7387,12 @@ |
StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
session_deps_.socket_factory->AddSocketDataProvider(&data); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
TestCompletionCallback callback; |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
@@ -7417,8 +7415,6 @@ |
// Make sure that a dropped connection while draining the body for auth |
// restart does the right thing. |
TEST_P(HttpNetworkTransactionTest, DrainResetOK) { |
- scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
- |
HttpRequestInfo request; |
request.method = "GET"; |
request.url = GURL("http://www.google.com/"); |
@@ -7442,6 +7438,7 @@ |
StaticSocketDataProvider data1(data_reads1, arraysize(data_reads1), |
data_writes1, arraysize(data_writes1)); |
session_deps_.socket_factory->AddSocketDataProvider(&data1); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
// After calling trans->RestartWithAuth(), this is the request we should |
// be issuing -- the final header line contains the credentials. |
@@ -7518,9 +7515,9 @@ |
session_deps_.socket_factory->ResetNextMockIndexes(); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
EXPECT_EQ(ERR_IO_PENDING, rv); |
@@ -7535,9 +7532,9 @@ |
request.url = GURL("http://www.google.com/"); |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockRead data_reads[] = { |
MockRead("HTTP/1.0 200 OK\r\nContent-Length:6719476739\r\n\r\n"), |
@@ -7587,9 +7584,9 @@ |
request.upload_data_stream = &upload_data_stream; |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockRead data_reads[] = { |
MockRead("HTTP/1.0 200 OK\r\n\r\n"), |
@@ -7646,9 +7643,9 @@ |
// If we try to upload an unreadable file, the network stack should report |
// the file size as zero and upload zero bytes for that file. |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockRead data_reads[] = { |
MockRead("HTTP/1.0 200 OK\r\n\r\n"), |
@@ -7704,9 +7701,9 @@ |
request.upload_data_stream = &upload_data_stream; |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockRead data_reads[] = { |
MockRead("HTTP/1.1 401 Unauthorized\r\n"), |
@@ -7808,9 +7805,9 @@ |
request.upload_data_stream = &upload_data_stream; |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
StaticSocketDataProvider data; |
session_deps_.socket_factory->AddSocketDataProvider(&data); |
@@ -7912,9 +7909,9 @@ |
TestCompletionCallback callback1; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
// Issue the first request with Authorize headers. There should be a |
// password prompt for first_realm waiting to be filled in after the |
@@ -9287,8 +9284,7 @@ |
request.load_flags = 0; |
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
- HttpNetworkTransaction trans( |
- DEFAULT_PRIORITY, CreateSession(&session_deps_)); |
+ HttpNetworkTransaction trans(DEFAULT_PRIORITY, session); |
for (int round = 0; round < test_config.num_auth_rounds; ++round) { |
const TestRound& read_write_round = test_config.rounds[round]; |
@@ -9843,9 +9839,9 @@ |
request.load_flags = 0; |
session_deps_.host_resolver->set_synchronous_mode(true); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
data.set_connect_data(mock_connect); |
@@ -11525,9 +11521,9 @@ |
request.url = GURL("http://www.google.com/"); |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockConnect mock_connect(SYNCHRONOUS, ERR_CONNECTION_REFUSED); |
StaticSocketDataProvider data; |
@@ -11555,9 +11551,9 @@ |
request.url = GURL("http://www.google.com/"); |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); |
StaticSocketDataProvider data; |
@@ -11585,9 +11581,9 @@ |
request.url = GURL("http://www.google.com/"); |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
@@ -11621,9 +11617,9 @@ |
request.url = GURL("http://www.google.com/"); |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite(ASYNC, ERR_CONNECTION_RESET), |
@@ -11657,9 +11653,9 @@ |
request.url = GURL("http://www.google.com/"); |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite("GET / HTTP/1.1\r\n" |
@@ -11695,9 +11691,9 @@ |
request.url = GURL("http://www.google.com/"); |
request.load_flags = 0; |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite("GET / HTTP/1.1\r\n" |
@@ -11734,9 +11730,9 @@ |
request.load_flags = 0; |
request.extra_headers.SetHeader("X-Foo", "bar"); |
+ scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
scoped_ptr<HttpTransaction> trans( |
- new HttpNetworkTransaction(DEFAULT_PRIORITY, |
- CreateSession(&session_deps_))); |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
MockWrite data_writes[] = { |
MockWrite("GET / HTTP/1.1\r\n" |