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

Side by Side Diff: net/http/http_network_transaction_unittest.cc

Issue 1084533002: Rename NetLogLogger and CapturingNetLog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename NetLogLogger and CapturingNetLog(removed compiler error for chromeOS) Created 5 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/http/http_cache_unittest.cc ('k') | net/log/capturing_net_log.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <math.h> // ceil 7 #include <math.h> // ceil
8 #include <stdarg.h> 8 #include <stdarg.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "net/http/http_basic_state.h" 43 #include "net/http/http_basic_state.h"
44 #include "net/http/http_basic_stream.h" 44 #include "net/http/http_basic_stream.h"
45 #include "net/http/http_network_session.h" 45 #include "net/http/http_network_session.h"
46 #include "net/http/http_network_session_peer.h" 46 #include "net/http/http_network_session_peer.h"
47 #include "net/http/http_request_headers.h" 47 #include "net/http/http_request_headers.h"
48 #include "net/http/http_server_properties_impl.h" 48 #include "net/http/http_server_properties_impl.h"
49 #include "net/http/http_stream.h" 49 #include "net/http/http_stream.h"
50 #include "net/http/http_stream_factory.h" 50 #include "net/http/http_stream_factory.h"
51 #include "net/http/http_stream_parser.h" 51 #include "net/http/http_stream_parser.h"
52 #include "net/http/http_transaction_test_util.h" 52 #include "net/http/http_transaction_test_util.h"
53 #include "net/log/capturing_net_log.h"
54 #include "net/log/net_log.h" 53 #include "net/log/net_log.h"
55 #include "net/log/net_log_unittest.h" 54 #include "net/log/net_log_unittest.h"
55 #include "net/log/test_net_log.h"
56 #include "net/proxy/mock_proxy_resolver.h" 56 #include "net/proxy/mock_proxy_resolver.h"
57 #include "net/proxy/proxy_config_service_fixed.h" 57 #include "net/proxy/proxy_config_service_fixed.h"
58 #include "net/proxy/proxy_info.h" 58 #include "net/proxy/proxy_info.h"
59 #include "net/proxy/proxy_resolver.h" 59 #include "net/proxy/proxy_resolver.h"
60 #include "net/proxy/proxy_service.h" 60 #include "net/proxy/proxy_service.h"
61 #include "net/socket/client_socket_factory.h" 61 #include "net/socket/client_socket_factory.h"
62 #include "net/socket/client_socket_pool_manager.h" 62 #include "net/socket/client_socket_pool_manager.h"
63 #include "net/socket/mock_client_socket_pool_manager.h" 63 #include "net/socket/mock_client_socket_pool_manager.h"
64 #include "net/socket/next_proto.h" 64 #include "net/socket/next_proto.h"
65 #include "net/socket/socket_test_util.h" 65 #include "net/socket/socket_test_util.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 310
311 SimpleGetHelperResult SimpleGetHelperForData(StaticSocketDataProvider* data[], 311 SimpleGetHelperResult SimpleGetHelperForData(StaticSocketDataProvider* data[],
312 size_t data_count) { 312 size_t data_count) {
313 SimpleGetHelperResult out; 313 SimpleGetHelperResult out;
314 314
315 HttpRequestInfo request; 315 HttpRequestInfo request;
316 request.method = "GET"; 316 request.method = "GET";
317 request.url = GURL("http://www.google.com/"); 317 request.url = GURL("http://www.google.com/");
318 request.load_flags = 0; 318 request.load_flags = 0;
319 319
320 CapturingBoundNetLog log; 320 BoundTestNetLog log;
321 session_deps_.net_log = log.bound().net_log(); 321 session_deps_.net_log = log.bound().net_log();
322 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 322 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
323 scoped_ptr<HttpTransaction> trans( 323 scoped_ptr<HttpTransaction> trans(
324 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 324 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
325 325
326 for (size_t i = 0; i < data_count; ++i) { 326 for (size_t i = 0; i < data_count; ++i) {
327 session_deps_.socket_factory->AddSocketDataProvider(data[i]); 327 session_deps_.socket_factory->AddSocketDataProvider(data[i]);
328 } 328 }
329 329
330 TestCompletionCallback callback; 330 TestCompletionCallback callback;
(...skipping 20 matching lines...) Expand all
351 return out; 351 return out;
352 } 352 }
353 out.status_line = response->headers->GetStatusLine(); 353 out.status_line = response->headers->GetStatusLine();
354 354
355 EXPECT_EQ("127.0.0.1", response->socket_address.host()); 355 EXPECT_EQ("127.0.0.1", response->socket_address.host());
356 EXPECT_EQ(80, response->socket_address.port()); 356 EXPECT_EQ(80, response->socket_address.port());
357 357
358 rv = ReadTransaction(trans.get(), &out.response_data); 358 rv = ReadTransaction(trans.get(), &out.response_data);
359 EXPECT_EQ(OK, rv); 359 EXPECT_EQ(OK, rv);
360 360
361 net::CapturingNetLog::CapturedEntryList entries; 361 net::TestNetLog::CapturedEntryList entries;
362 log.GetEntries(&entries); 362 log.GetEntries(&entries);
363 size_t pos = ExpectLogContainsSomewhere( 363 size_t pos = ExpectLogContainsSomewhere(
364 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, 364 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS,
365 NetLog::PHASE_NONE); 365 NetLog::PHASE_NONE);
366 ExpectLogContainsSomewhere( 366 ExpectLogContainsSomewhere(
367 entries, pos, 367 entries, pos,
368 NetLog::TYPE_HTTP_TRANSACTION_READ_RESPONSE_HEADERS, 368 NetLog::TYPE_HTTP_TRANSACTION_READ_RESPONSE_HEADERS,
369 NetLog::PHASE_NONE); 369 NetLog::PHASE_NONE);
370 370
371 std::string line; 371 std::string line;
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 } 1266 }
1267 1267
1268 void HttpNetworkTransactionTest::KeepAliveConnectionResendRequestTest( 1268 void HttpNetworkTransactionTest::KeepAliveConnectionResendRequestTest(
1269 const MockWrite* write_failure, 1269 const MockWrite* write_failure,
1270 const MockRead* read_failure) { 1270 const MockRead* read_failure) {
1271 HttpRequestInfo request; 1271 HttpRequestInfo request;
1272 request.method = "GET"; 1272 request.method = "GET";
1273 request.url = GURL("http://www.foo.com/"); 1273 request.url = GURL("http://www.foo.com/");
1274 request.load_flags = 0; 1274 request.load_flags = 0;
1275 1275
1276 CapturingNetLog net_log; 1276 TestNetLog net_log;
1277 session_deps_.net_log = &net_log; 1277 session_deps_.net_log = &net_log;
1278 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 1278 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
1279 1279
1280 // Written data for successfully sending both requests. 1280 // Written data for successfully sending both requests.
1281 MockWrite data1_writes[] = { 1281 MockWrite data1_writes[] = {
1282 MockWrite("GET / HTTP/1.1\r\n" 1282 MockWrite("GET / HTTP/1.1\r\n"
1283 "Host: www.foo.com\r\n" 1283 "Host: www.foo.com\r\n"
1284 "Connection: keep-alive\r\n\r\n"), 1284 "Connection: keep-alive\r\n\r\n"),
1285 MockWrite("GET / HTTP/1.1\r\n" 1285 MockWrite("GET / HTTP/1.1\r\n"
1286 "Host: www.foo.com\r\n" 1286 "Host: www.foo.com\r\n"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 1356
1357 void HttpNetworkTransactionTest::PreconnectErrorResendRequestTest( 1357 void HttpNetworkTransactionTest::PreconnectErrorResendRequestTest(
1358 const MockWrite* write_failure, 1358 const MockWrite* write_failure,
1359 const MockRead* read_failure, 1359 const MockRead* read_failure,
1360 bool use_spdy) { 1360 bool use_spdy) {
1361 HttpRequestInfo request; 1361 HttpRequestInfo request;
1362 request.method = "GET"; 1362 request.method = "GET";
1363 request.url = GURL("https://www.foo.com/"); 1363 request.url = GURL("https://www.foo.com/");
1364 request.load_flags = 0; 1364 request.load_flags = 0;
1365 1365
1366 CapturingNetLog net_log; 1366 TestNetLog net_log;
1367 session_deps_.net_log = &net_log; 1367 session_deps_.net_log = &net_log;
1368 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 1368 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
1369 1369
1370 SSLSocketDataProvider ssl1(ASYNC, OK); 1370 SSLSocketDataProvider ssl1(ASYNC, OK);
1371 SSLSocketDataProvider ssl2(ASYNC, OK); 1371 SSLSocketDataProvider ssl2(ASYNC, OK);
1372 if (use_spdy) { 1372 if (use_spdy) {
1373 ssl1.SetNextProto(GetParam()); 1373 ssl1.SetNextProto(GetParam());
1374 ssl2.SetNextProto(GetParam()); 1374 ssl2.SetNextProto(GetParam());
1375 } 1375 }
1376 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1); 1376 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1);
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 } 1770 }
1771 1771
1772 // Test that we correctly reuse a keep-alive connection after not explicitly 1772 // Test that we correctly reuse a keep-alive connection after not explicitly
1773 // reading the body. 1773 // reading the body.
1774 TEST_P(HttpNetworkTransactionTest, KeepAliveAfterUnreadBody) { 1774 TEST_P(HttpNetworkTransactionTest, KeepAliveAfterUnreadBody) {
1775 HttpRequestInfo request; 1775 HttpRequestInfo request;
1776 request.method = "GET"; 1776 request.method = "GET";
1777 request.url = GURL("http://www.foo.com/"); 1777 request.url = GURL("http://www.foo.com/");
1778 request.load_flags = 0; 1778 request.load_flags = 0;
1779 1779
1780 CapturingNetLog net_log; 1780 TestNetLog net_log;
1781 session_deps_.net_log = &net_log; 1781 session_deps_.net_log = &net_log;
1782 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 1782 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
1783 1783
1784 // Note that because all these reads happen in the same 1784 // Note that because all these reads happen in the same
1785 // StaticSocketDataProvider, it shows that the same socket is being reused for 1785 // StaticSocketDataProvider, it shows that the same socket is being reused for
1786 // all transactions. 1786 // all transactions.
1787 MockRead data1_reads[] = { 1787 MockRead data1_reads[] = {
1788 MockRead("HTTP/1.1 204 No Content\r\n\r\n"), 1788 MockRead("HTTP/1.1 204 No Content\r\n\r\n"),
1789 MockRead("HTTP/1.1 205 Reset Content\r\n\r\n"), 1789 MockRead("HTTP/1.1 205 Reset Content\r\n\r\n"),
1790 MockRead("HTTP/1.1 304 Not Modified\r\n\r\n"), 1790 MockRead("HTTP/1.1 304 Not Modified\r\n\r\n"),
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 } 1879 }
1880 1880
1881 // Test the request-challenge-retry sequence for basic auth. 1881 // Test the request-challenge-retry sequence for basic auth.
1882 // (basic auth is the easiest to mock, because it has no randomness). 1882 // (basic auth is the easiest to mock, because it has no randomness).
1883 TEST_P(HttpNetworkTransactionTest, BasicAuth) { 1883 TEST_P(HttpNetworkTransactionTest, BasicAuth) {
1884 HttpRequestInfo request; 1884 HttpRequestInfo request;
1885 request.method = "GET"; 1885 request.method = "GET";
1886 request.url = GURL("http://www.google.com/"); 1886 request.url = GURL("http://www.google.com/");
1887 request.load_flags = 0; 1887 request.load_flags = 0;
1888 1888
1889 CapturingNetLog log; 1889 TestNetLog log;
1890 session_deps_.net_log = &log; 1890 session_deps_.net_log = &log;
1891 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 1891 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
1892 scoped_ptr<HttpTransaction> trans( 1892 scoped_ptr<HttpTransaction> trans(
1893 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 1893 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
1894 1894
1895 MockWrite data_writes1[] = { 1895 MockWrite data_writes1[] = {
1896 MockWrite("GET / HTTP/1.1\r\n" 1896 MockWrite("GET / HTTP/1.1\r\n"
1897 "Host: www.google.com\r\n" 1897 "Host: www.google.com\r\n"
1898 "Connection: keep-alive\r\n\r\n"), 1898 "Connection: keep-alive\r\n\r\n"),
1899 }; 1899 };
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2026 } 2026 }
2027 2027
2028 // Test the request-challenge-retry sequence for basic auth, over a keep-alive 2028 // Test the request-challenge-retry sequence for basic auth, over a keep-alive
2029 // connection. 2029 // connection.
2030 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAlive) { 2030 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAlive) {
2031 HttpRequestInfo request; 2031 HttpRequestInfo request;
2032 request.method = "GET"; 2032 request.method = "GET";
2033 request.url = GURL("http://www.google.com/"); 2033 request.url = GURL("http://www.google.com/");
2034 request.load_flags = 0; 2034 request.load_flags = 0;
2035 2035
2036 CapturingNetLog log; 2036 TestNetLog log;
2037 session_deps_.net_log = &log; 2037 session_deps_.net_log = &log;
2038 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 2038 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
2039 2039
2040 MockWrite data_writes1[] = { 2040 MockWrite data_writes1[] = {
2041 MockWrite("GET / HTTP/1.1\r\n" 2041 MockWrite("GET / HTTP/1.1\r\n"
2042 "Host: www.google.com\r\n" 2042 "Host: www.google.com\r\n"
2043 "Connection: keep-alive\r\n\r\n"), 2043 "Connection: keep-alive\r\n\r\n"),
2044 2044
2045 // After calling trans->RestartWithAuth(), this is the request we should 2045 // After calling trans->RestartWithAuth(), this is the request we should
2046 // be issuing -- the final header line contains the credentials. 2046 // be issuing -- the final header line contains the credentials.
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
2376 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp10) { 2376 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp10) {
2377 HttpRequestInfo request; 2377 HttpRequestInfo request;
2378 request.method = "GET"; 2378 request.method = "GET";
2379 request.url = GURL("https://www.google.com/"); 2379 request.url = GURL("https://www.google.com/");
2380 // when the no authentication data flag is set. 2380 // when the no authentication data flag is set.
2381 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; 2381 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA;
2382 2382
2383 // Configure against proxy server "myproxy:70". 2383 // Configure against proxy server "myproxy:70".
2384 session_deps_.proxy_service.reset( 2384 session_deps_.proxy_service.reset(
2385 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); 2385 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
2386 CapturingBoundNetLog log; 2386 BoundTestNetLog log;
2387 session_deps_.net_log = log.bound().net_log(); 2387 session_deps_.net_log = log.bound().net_log();
2388 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 2388 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
2389 2389
2390 // Since we have proxy, should try to establish tunnel. 2390 // Since we have proxy, should try to establish tunnel.
2391 MockWrite data_writes1[] = { 2391 MockWrite data_writes1[] = {
2392 MockWrite( 2392 MockWrite(
2393 "CONNECT www.google.com:443 HTTP/1.1\r\n" 2393 "CONNECT www.google.com:443 HTTP/1.1\r\n"
2394 "Host: www.google.com\r\n" 2394 "Host: www.google.com\r\n"
2395 "Proxy-Connection: keep-alive\r\n\r\n"), 2395 "Proxy-Connection: keep-alive\r\n\r\n"),
2396 2396
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2432 TestCompletionCallback callback1; 2432 TestCompletionCallback callback1;
2433 2433
2434 scoped_ptr<HttpTransaction> trans( 2434 scoped_ptr<HttpTransaction> trans(
2435 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 2435 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
2436 2436
2437 int rv = trans->Start(&request, callback1.callback(), log.bound()); 2437 int rv = trans->Start(&request, callback1.callback(), log.bound());
2438 EXPECT_EQ(ERR_IO_PENDING, rv); 2438 EXPECT_EQ(ERR_IO_PENDING, rv);
2439 2439
2440 rv = callback1.WaitForResult(); 2440 rv = callback1.WaitForResult();
2441 EXPECT_EQ(OK, rv); 2441 EXPECT_EQ(OK, rv);
2442 net::CapturingNetLog::CapturedEntryList entries; 2442 net::TestNetLog::CapturedEntryList entries;
2443 log.GetEntries(&entries); 2443 log.GetEntries(&entries);
2444 size_t pos = ExpectLogContainsSomewhere( 2444 size_t pos = ExpectLogContainsSomewhere(
2445 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 2445 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
2446 NetLog::PHASE_NONE); 2446 NetLog::PHASE_NONE);
2447 ExpectLogContainsSomewhere( 2447 ExpectLogContainsSomewhere(
2448 entries, pos, NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 2448 entries, pos, NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
2449 NetLog::PHASE_NONE); 2449 NetLog::PHASE_NONE);
2450 2450
2451 const HttpResponseInfo* response = trans->GetResponseInfo(); 2451 const HttpResponseInfo* response = trans->GetResponseInfo();
2452 ASSERT_TRUE(response != NULL); 2452 ASSERT_TRUE(response != NULL);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp11) { 2494 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp11) {
2495 HttpRequestInfo request; 2495 HttpRequestInfo request;
2496 request.method = "GET"; 2496 request.method = "GET";
2497 request.url = GURL("https://www.google.com/"); 2497 request.url = GURL("https://www.google.com/");
2498 // when the no authentication data flag is set. 2498 // when the no authentication data flag is set.
2499 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; 2499 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA;
2500 2500
2501 // Configure against proxy server "myproxy:70". 2501 // Configure against proxy server "myproxy:70".
2502 session_deps_.proxy_service.reset( 2502 session_deps_.proxy_service.reset(
2503 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); 2503 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
2504 CapturingBoundNetLog log; 2504 BoundTestNetLog log;
2505 session_deps_.net_log = log.bound().net_log(); 2505 session_deps_.net_log = log.bound().net_log();
2506 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 2506 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
2507 2507
2508 // Since we have proxy, should try to establish tunnel. 2508 // Since we have proxy, should try to establish tunnel.
2509 MockWrite data_writes1[] = { 2509 MockWrite data_writes1[] = {
2510 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" 2510 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n"
2511 "Host: www.google.com\r\n" 2511 "Host: www.google.com\r\n"
2512 "Proxy-Connection: keep-alive\r\n\r\n"), 2512 "Proxy-Connection: keep-alive\r\n\r\n"),
2513 2513
2514 // After calling trans->RestartWithAuth(), this is the request we should 2514 // After calling trans->RestartWithAuth(), this is the request we should
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2548 TestCompletionCallback callback1; 2548 TestCompletionCallback callback1;
2549 2549
2550 scoped_ptr<HttpTransaction> trans( 2550 scoped_ptr<HttpTransaction> trans(
2551 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 2551 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
2552 2552
2553 int rv = trans->Start(&request, callback1.callback(), log.bound()); 2553 int rv = trans->Start(&request, callback1.callback(), log.bound());
2554 EXPECT_EQ(ERR_IO_PENDING, rv); 2554 EXPECT_EQ(ERR_IO_PENDING, rv);
2555 2555
2556 rv = callback1.WaitForResult(); 2556 rv = callback1.WaitForResult();
2557 EXPECT_EQ(OK, rv); 2557 EXPECT_EQ(OK, rv);
2558 net::CapturingNetLog::CapturedEntryList entries; 2558 net::TestNetLog::CapturedEntryList entries;
2559 log.GetEntries(&entries); 2559 log.GetEntries(&entries);
2560 size_t pos = ExpectLogContainsSomewhere( 2560 size_t pos = ExpectLogContainsSomewhere(
2561 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 2561 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
2562 NetLog::PHASE_NONE); 2562 NetLog::PHASE_NONE);
2563 ExpectLogContainsSomewhere( 2563 ExpectLogContainsSomewhere(
2564 entries, pos, 2564 entries, pos,
2565 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 2565 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
2566 NetLog::PHASE_NONE); 2566 NetLog::PHASE_NONE);
2567 2567
2568 const HttpResponseInfo* response = trans->GetResponseInfo(); 2568 const HttpResponseInfo* response = trans->GetResponseInfo();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2611 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp10) { 2611 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp10) {
2612 HttpRequestInfo request; 2612 HttpRequestInfo request;
2613 request.method = "GET"; 2613 request.method = "GET";
2614 request.url = GURL("https://www.google.com/"); 2614 request.url = GURL("https://www.google.com/");
2615 // Ensure that proxy authentication is attempted even 2615 // Ensure that proxy authentication is attempted even
2616 // when the no authentication data flag is set. 2616 // when the no authentication data flag is set.
2617 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; 2617 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA;
2618 2618
2619 // Configure against proxy server "myproxy:70". 2619 // Configure against proxy server "myproxy:70".
2620 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); 2620 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
2621 CapturingBoundNetLog log; 2621 BoundTestNetLog log;
2622 session_deps_.net_log = log.bound().net_log(); 2622 session_deps_.net_log = log.bound().net_log();
2623 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 2623 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
2624 2624
2625 scoped_ptr<HttpTransaction> trans( 2625 scoped_ptr<HttpTransaction> trans(
2626 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 2626 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
2627 2627
2628 // Since we have proxy, should try to establish tunnel. 2628 // Since we have proxy, should try to establish tunnel.
2629 MockWrite data_writes1[] = { 2629 MockWrite data_writes1[] = {
2630 MockWrite( 2630 MockWrite(
2631 "CONNECT www.google.com:443 HTTP/1.1\r\n" 2631 "CONNECT www.google.com:443 HTTP/1.1\r\n"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2664 data_writes1, arraysize(data_writes1)); 2664 data_writes1, arraysize(data_writes1));
2665 session_deps_.socket_factory->AddSocketDataProvider(&data1); 2665 session_deps_.socket_factory->AddSocketDataProvider(&data1);
2666 2666
2667 TestCompletionCallback callback1; 2667 TestCompletionCallback callback1;
2668 2668
2669 int rv = trans->Start(&request, callback1.callback(), log.bound()); 2669 int rv = trans->Start(&request, callback1.callback(), log.bound());
2670 EXPECT_EQ(ERR_IO_PENDING, rv); 2670 EXPECT_EQ(ERR_IO_PENDING, rv);
2671 2671
2672 rv = callback1.WaitForResult(); 2672 rv = callback1.WaitForResult();
2673 EXPECT_EQ(OK, rv); 2673 EXPECT_EQ(OK, rv);
2674 net::CapturingNetLog::CapturedEntryList entries; 2674 net::TestNetLog::CapturedEntryList entries;
2675 log.GetEntries(&entries); 2675 log.GetEntries(&entries);
2676 size_t pos = ExpectLogContainsSomewhere( 2676 size_t pos = ExpectLogContainsSomewhere(
2677 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 2677 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
2678 NetLog::PHASE_NONE); 2678 NetLog::PHASE_NONE);
2679 ExpectLogContainsSomewhere( 2679 ExpectLogContainsSomewhere(
2680 entries, pos, NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 2680 entries, pos, NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
2681 NetLog::PHASE_NONE); 2681 NetLog::PHASE_NONE);
2682 2682
2683 const HttpResponseInfo* response = trans->GetResponseInfo(); 2683 const HttpResponseInfo* response = trans->GetResponseInfo();
2684 ASSERT_TRUE(response); 2684 ASSERT_TRUE(response);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2718 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp11) { 2718 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp11) {
2719 HttpRequestInfo request; 2719 HttpRequestInfo request;
2720 request.method = "GET"; 2720 request.method = "GET";
2721 request.url = GURL("https://www.google.com/"); 2721 request.url = GURL("https://www.google.com/");
2722 // Ensure that proxy authentication is attempted even 2722 // Ensure that proxy authentication is attempted even
2723 // when the no authentication data flag is set. 2723 // when the no authentication data flag is set.
2724 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; 2724 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA;
2725 2725
2726 // Configure against proxy server "myproxy:70". 2726 // Configure against proxy server "myproxy:70".
2727 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); 2727 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
2728 CapturingBoundNetLog log; 2728 BoundTestNetLog log;
2729 session_deps_.net_log = log.bound().net_log(); 2729 session_deps_.net_log = log.bound().net_log();
2730 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 2730 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
2731 2731
2732 scoped_ptr<HttpTransaction> trans( 2732 scoped_ptr<HttpTransaction> trans(
2733 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 2733 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
2734 2734
2735 // Since we have proxy, should try to establish tunnel. 2735 // Since we have proxy, should try to establish tunnel.
2736 MockWrite data_writes1[] = { 2736 MockWrite data_writes1[] = {
2737 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" 2737 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n"
2738 "Host: www.google.com\r\n" 2738 "Host: www.google.com\r\n"
(...skipping 28 matching lines...) Expand all
2767 data_writes1, arraysize(data_writes1)); 2767 data_writes1, arraysize(data_writes1));
2768 session_deps_.socket_factory->AddSocketDataProvider(&data1); 2768 session_deps_.socket_factory->AddSocketDataProvider(&data1);
2769 2769
2770 TestCompletionCallback callback1; 2770 TestCompletionCallback callback1;
2771 2771
2772 int rv = trans->Start(&request, callback1.callback(), log.bound()); 2772 int rv = trans->Start(&request, callback1.callback(), log.bound());
2773 EXPECT_EQ(ERR_IO_PENDING, rv); 2773 EXPECT_EQ(ERR_IO_PENDING, rv);
2774 2774
2775 rv = callback1.WaitForResult(); 2775 rv = callback1.WaitForResult();
2776 EXPECT_EQ(OK, rv); 2776 EXPECT_EQ(OK, rv);
2777 net::CapturingNetLog::CapturedEntryList entries; 2777 net::TestNetLog::CapturedEntryList entries;
2778 log.GetEntries(&entries); 2778 log.GetEntries(&entries);
2779 size_t pos = ExpectLogContainsSomewhere( 2779 size_t pos = ExpectLogContainsSomewhere(
2780 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 2780 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
2781 NetLog::PHASE_NONE); 2781 NetLog::PHASE_NONE);
2782 ExpectLogContainsSomewhere( 2782 ExpectLogContainsSomewhere(
2783 entries, pos, 2783 entries, pos,
2784 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 2784 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
2785 NetLog::PHASE_NONE); 2785 NetLog::PHASE_NONE);
2786 2786
2787 const HttpResponseInfo* response = trans->GetResponseInfo(); 2787 const HttpResponseInfo* response = trans->GetResponseInfo();
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
2986 // a non-authenticating proxy - there is nothing to indicate whether the 2986 // a non-authenticating proxy - there is nothing to indicate whether the
2987 // response came from the proxy or the server, so it is treated as if the proxy 2987 // response came from the proxy or the server, so it is treated as if the proxy
2988 // issued the challenge. 2988 // issued the challenge.
2989 TEST_P(HttpNetworkTransactionTest, 2989 TEST_P(HttpNetworkTransactionTest,
2990 HttpsServerRequestsProxyAuthThroughProxy) { 2990 HttpsServerRequestsProxyAuthThroughProxy) {
2991 HttpRequestInfo request; 2991 HttpRequestInfo request;
2992 request.method = "GET"; 2992 request.method = "GET";
2993 request.url = GURL("https://www.google.com/"); 2993 request.url = GURL("https://www.google.com/");
2994 2994
2995 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); 2995 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
2996 CapturingBoundNetLog log; 2996 BoundTestNetLog log;
2997 session_deps_.net_log = log.bound().net_log(); 2997 session_deps_.net_log = log.bound().net_log();
2998 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 2998 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
2999 2999
3000 // Since we have proxy, should try to establish tunnel. 3000 // Since we have proxy, should try to establish tunnel.
3001 MockWrite data_writes1[] = { 3001 MockWrite data_writes1[] = {
3002 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" 3002 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n"
3003 "Host: www.google.com\r\n" 3003 "Host: www.google.com\r\n"
3004 "Proxy-Connection: keep-alive\r\n\r\n"), 3004 "Proxy-Connection: keep-alive\r\n\r\n"),
3005 3005
3006 MockWrite("GET / HTTP/1.1\r\n" 3006 MockWrite("GET / HTTP/1.1\r\n"
(...skipping 19 matching lines...) Expand all
3026 TestCompletionCallback callback1; 3026 TestCompletionCallback callback1;
3027 3027
3028 scoped_ptr<HttpTransaction> trans( 3028 scoped_ptr<HttpTransaction> trans(
3029 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 3029 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
3030 3030
3031 int rv = trans->Start(&request, callback1.callback(), log.bound()); 3031 int rv = trans->Start(&request, callback1.callback(), log.bound());
3032 EXPECT_EQ(ERR_IO_PENDING, rv); 3032 EXPECT_EQ(ERR_IO_PENDING, rv);
3033 3033
3034 rv = callback1.WaitForResult(); 3034 rv = callback1.WaitForResult();
3035 EXPECT_EQ(ERR_UNEXPECTED_PROXY_AUTH, rv); 3035 EXPECT_EQ(ERR_UNEXPECTED_PROXY_AUTH, rv);
3036 net::CapturingNetLog::CapturedEntryList entries; 3036 net::TestNetLog::CapturedEntryList entries;
3037 log.GetEntries(&entries); 3037 log.GetEntries(&entries);
3038 size_t pos = ExpectLogContainsSomewhere( 3038 size_t pos = ExpectLogContainsSomewhere(
3039 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 3039 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
3040 NetLog::PHASE_NONE); 3040 NetLog::PHASE_NONE);
3041 ExpectLogContainsSomewhere( 3041 ExpectLogContainsSomewhere(
3042 entries, pos, 3042 entries, pos,
3043 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 3043 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
3044 NetLog::PHASE_NONE); 3044 NetLog::PHASE_NONE);
3045 } 3045 }
3046 3046
3047 // Test the load timing for HTTPS requests with an HTTP proxy. 3047 // Test the load timing for HTTPS requests with an HTTP proxy.
3048 TEST_P(HttpNetworkTransactionTest, HttpProxyLoadTimingNoPacTwoRequests) { 3048 TEST_P(HttpNetworkTransactionTest, HttpProxyLoadTimingNoPacTwoRequests) {
3049 HttpRequestInfo request1; 3049 HttpRequestInfo request1;
3050 request1.method = "GET"; 3050 request1.method = "GET";
3051 request1.url = GURL("https://www.google.com/1"); 3051 request1.url = GURL("https://www.google.com/1");
3052 3052
3053 HttpRequestInfo request2; 3053 HttpRequestInfo request2;
3054 request2.method = "GET"; 3054 request2.method = "GET";
3055 request2.url = GURL("https://www.google.com/2"); 3055 request2.url = GURL("https://www.google.com/2");
3056 3056
3057 // Configure against proxy server "myproxy:70". 3057 // Configure against proxy server "myproxy:70".
3058 session_deps_.proxy_service.reset( 3058 session_deps_.proxy_service.reset(
3059 ProxyService::CreateFixed("PROXY myproxy:70")); 3059 ProxyService::CreateFixed("PROXY myproxy:70"));
3060 CapturingBoundNetLog log; 3060 BoundTestNetLog log;
3061 session_deps_.net_log = log.bound().net_log(); 3061 session_deps_.net_log = log.bound().net_log();
3062 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 3062 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
3063 3063
3064 // Since we have proxy, should try to establish tunnel. 3064 // Since we have proxy, should try to establish tunnel.
3065 MockWrite data_writes1[] = { 3065 MockWrite data_writes1[] = {
3066 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" 3066 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n"
3067 "Host: www.google.com\r\n" 3067 "Host: www.google.com\r\n"
3068 "Proxy-Connection: keep-alive\r\n\r\n"), 3068 "Proxy-Connection: keep-alive\r\n\r\n"),
3069 3069
3070 MockWrite("GET /1 HTTP/1.1\r\n" 3070 MockWrite("GET /1 HTTP/1.1\r\n"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
3148 request1.method = "GET"; 3148 request1.method = "GET";
3149 request1.url = GURL("https://www.google.com/1"); 3149 request1.url = GURL("https://www.google.com/1");
3150 3150
3151 HttpRequestInfo request2; 3151 HttpRequestInfo request2;
3152 request2.method = "GET"; 3152 request2.method = "GET";
3153 request2.url = GURL("https://www.google.com/2"); 3153 request2.url = GURL("https://www.google.com/2");
3154 3154
3155 // Configure against proxy server "myproxy:70". 3155 // Configure against proxy server "myproxy:70".
3156 session_deps_.proxy_service.reset( 3156 session_deps_.proxy_service.reset(
3157 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); 3157 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
3158 CapturingBoundNetLog log; 3158 BoundTestNetLog log;
3159 session_deps_.net_log = log.bound().net_log(); 3159 session_deps_.net_log = log.bound().net_log();
3160 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 3160 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
3161 3161
3162 // Since we have proxy, should try to establish tunnel. 3162 // Since we have proxy, should try to establish tunnel.
3163 MockWrite data_writes1[] = { 3163 MockWrite data_writes1[] = {
3164 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" 3164 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n"
3165 "Host: www.google.com\r\n" 3165 "Host: www.google.com\r\n"
3166 "Proxy-Connection: keep-alive\r\n\r\n"), 3166 "Proxy-Connection: keep-alive\r\n\r\n"),
3167 3167
3168 MockWrite("GET /1 HTTP/1.1\r\n" 3168 MockWrite("GET /1 HTTP/1.1\r\n"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
3243 3243
3244 // Test a simple get through an HTTPS Proxy. 3244 // Test a simple get through an HTTPS Proxy.
3245 TEST_P(HttpNetworkTransactionTest, HttpsProxyGet) { 3245 TEST_P(HttpNetworkTransactionTest, HttpsProxyGet) {
3246 HttpRequestInfo request; 3246 HttpRequestInfo request;
3247 request.method = "GET"; 3247 request.method = "GET";
3248 request.url = GURL("http://www.google.com/"); 3248 request.url = GURL("http://www.google.com/");
3249 3249
3250 // Configure against https proxy server "proxy:70". 3250 // Configure against https proxy server "proxy:70".
3251 session_deps_.proxy_service.reset(ProxyService::CreateFixed( 3251 session_deps_.proxy_service.reset(ProxyService::CreateFixed(
3252 "https://proxy:70")); 3252 "https://proxy:70"));
3253 CapturingBoundNetLog log; 3253 BoundTestNetLog log;
3254 session_deps_.net_log = log.bound().net_log(); 3254 session_deps_.net_log = log.bound().net_log();
3255 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 3255 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
3256 3256
3257 // Since we have proxy, should use full url 3257 // Since we have proxy, should use full url
3258 MockWrite data_writes1[] = { 3258 MockWrite data_writes1[] = {
3259 MockWrite("GET http://www.google.com/ HTTP/1.1\r\n" 3259 MockWrite("GET http://www.google.com/ HTTP/1.1\r\n"
3260 "Host: www.google.com\r\n" 3260 "Host: www.google.com\r\n"
3261 "Proxy-Connection: keep-alive\r\n\r\n"), 3261 "Proxy-Connection: keep-alive\r\n\r\n"),
3262 }; 3262 };
3263 3263
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3305 // Test a SPDY get through an HTTPS Proxy. 3305 // Test a SPDY get through an HTTPS Proxy.
3306 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGet) { 3306 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGet) {
3307 HttpRequestInfo request; 3307 HttpRequestInfo request;
3308 request.method = "GET"; 3308 request.method = "GET";
3309 request.url = GURL("http://www.google.com/"); 3309 request.url = GURL("http://www.google.com/");
3310 request.load_flags = 0; 3310 request.load_flags = 0;
3311 3311
3312 // Configure against https proxy server "proxy:70". 3312 // Configure against https proxy server "proxy:70".
3313 session_deps_.proxy_service.reset(ProxyService::CreateFixed( 3313 session_deps_.proxy_service.reset(ProxyService::CreateFixed(
3314 "https://proxy:70")); 3314 "https://proxy:70"));
3315 CapturingBoundNetLog log; 3315 BoundTestNetLog log;
3316 session_deps_.net_log = log.bound().net_log(); 3316 session_deps_.net_log = log.bound().net_log();
3317 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 3317 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
3318 3318
3319 // fetch http://www.google.com/ via SPDY 3319 // fetch http://www.google.com/ via SPDY
3320 scoped_ptr<SpdyFrame> req( 3320 scoped_ptr<SpdyFrame> req(
3321 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); 3321 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false));
3322 MockWrite spdy_writes[] = { CreateMockWrite(*req) }; 3322 MockWrite spdy_writes[] = { CreateMockWrite(*req) };
3323 3323
3324 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); 3324 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1));
3325 scoped_ptr<SpdyFrame> data(spdy_util_.ConstructSpdyBodyFrame(1, true)); 3325 scoped_ptr<SpdyFrame> data(spdy_util_.ConstructSpdyBodyFrame(1, true));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3370 // Regression test for crbug.com/334413. 3370 // Regression test for crbug.com/334413.
3371 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithSessionRace) { 3371 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithSessionRace) {
3372 HttpRequestInfo request; 3372 HttpRequestInfo request;
3373 request.method = "GET"; 3373 request.method = "GET";
3374 request.url = GURL("http://www.google.com/"); 3374 request.url = GURL("http://www.google.com/");
3375 request.load_flags = 0; 3375 request.load_flags = 0;
3376 3376
3377 // Configure SPDY proxy server "proxy:70". 3377 // Configure SPDY proxy server "proxy:70".
3378 session_deps_.proxy_service.reset( 3378 session_deps_.proxy_service.reset(
3379 ProxyService::CreateFixed("https://proxy:70")); 3379 ProxyService::CreateFixed("https://proxy:70"));
3380 CapturingBoundNetLog log; 3380 BoundTestNetLog log;
3381 session_deps_.net_log = log.bound().net_log(); 3381 session_deps_.net_log = log.bound().net_log();
3382 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 3382 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
3383 3383
3384 // Fetch http://www.google.com/ through the SPDY proxy. 3384 // Fetch http://www.google.com/ through the SPDY proxy.
3385 scoped_ptr<SpdyFrame> req( 3385 scoped_ptr<SpdyFrame> req(
3386 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); 3386 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false));
3387 MockWrite spdy_writes[] = {CreateMockWrite(*req)}; 3387 MockWrite spdy_writes[] = {CreateMockWrite(*req)};
3388 3388
3389 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); 3389 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1));
3390 scoped_ptr<SpdyFrame> data(spdy_util_.ConstructSpdyBodyFrame(1, true)); 3390 scoped_ptr<SpdyFrame> data(spdy_util_.ConstructSpdyBodyFrame(1, true));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
3444 // Test a SPDY get through an HTTPS Proxy. 3444 // Test a SPDY get through an HTTPS Proxy.
3445 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithProxyAuth) { 3445 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithProxyAuth) {
3446 HttpRequestInfo request; 3446 HttpRequestInfo request;
3447 request.method = "GET"; 3447 request.method = "GET";
3448 request.url = GURL("http://www.google.com/"); 3448 request.url = GURL("http://www.google.com/");
3449 request.load_flags = 0; 3449 request.load_flags = 0;
3450 3450
3451 // Configure against https proxy server "myproxy:70". 3451 // Configure against https proxy server "myproxy:70".
3452 session_deps_.proxy_service.reset( 3452 session_deps_.proxy_service.reset(
3453 ProxyService::CreateFixed("https://myproxy:70")); 3453 ProxyService::CreateFixed("https://myproxy:70"));
3454 CapturingBoundNetLog log; 3454 BoundTestNetLog log;
3455 session_deps_.net_log = log.bound().net_log(); 3455 session_deps_.net_log = log.bound().net_log();
3456 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 3456 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
3457 3457
3458 // The first request will be a bare GET, the second request will be a 3458 // The first request will be a bare GET, the second request will be a
3459 // GET with a Proxy-Authorization header. 3459 // GET with a Proxy-Authorization header.
3460 scoped_ptr<SpdyFrame> req_get( 3460 scoped_ptr<SpdyFrame> req_get(
3461 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); 3461 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false));
3462 const char* const kExtraAuthorizationHeaders[] = { 3462 const char* const kExtraAuthorizationHeaders[] = {
3463 "proxy-authorization", "Basic Zm9vOmJhcg==" 3463 "proxy-authorization", "Basic Zm9vOmJhcg=="
3464 }; 3464 };
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3547 // Test a SPDY CONNECT through an HTTPS Proxy to an HTTPS (non-SPDY) Server. 3547 // Test a SPDY CONNECT through an HTTPS Proxy to an HTTPS (non-SPDY) Server.
3548 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectHttps) { 3548 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectHttps) {
3549 HttpRequestInfo request; 3549 HttpRequestInfo request;
3550 request.method = "GET"; 3550 request.method = "GET";
3551 request.url = GURL("https://www.google.com/"); 3551 request.url = GURL("https://www.google.com/");
3552 request.load_flags = 0; 3552 request.load_flags = 0;
3553 3553
3554 // Configure against https proxy server "proxy:70". 3554 // Configure against https proxy server "proxy:70".
3555 session_deps_.proxy_service.reset(ProxyService::CreateFixed( 3555 session_deps_.proxy_service.reset(ProxyService::CreateFixed(
3556 "https://proxy:70")); 3556 "https://proxy:70"));
3557 CapturingBoundNetLog log; 3557 BoundTestNetLog log;
3558 session_deps_.net_log = log.bound().net_log(); 3558 session_deps_.net_log = log.bound().net_log();
3559 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 3559 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
3560 3560
3561 scoped_ptr<HttpTransaction> trans( 3561 scoped_ptr<HttpTransaction> trans(
3562 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 3562 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
3563 3563
3564 // CONNECT to www.google.com:443 via SPDY 3564 // CONNECT to www.google.com:443 via SPDY
3565 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( 3565 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect(
3566 NULL, 0, 1, LOWEST, HostPortPair("www.google.com", 443))); 3566 NULL, 0, 1, LOWEST, HostPortPair("www.google.com", 443)));
3567 // fetch https://www.google.com/ via HTTP 3567 // fetch https://www.google.com/ via HTTP
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3634 // Test a SPDY CONNECT through an HTTPS Proxy to a SPDY server. 3634 // Test a SPDY CONNECT through an HTTPS Proxy to a SPDY server.
3635 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectSpdy) { 3635 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectSpdy) {
3636 HttpRequestInfo request; 3636 HttpRequestInfo request;
3637 request.method = "GET"; 3637 request.method = "GET";
3638 request.url = GURL("https://www.google.com/"); 3638 request.url = GURL("https://www.google.com/");
3639 request.load_flags = 0; 3639 request.load_flags = 0;
3640 3640
3641 // Configure against https proxy server "proxy:70". 3641 // Configure against https proxy server "proxy:70".
3642 session_deps_.proxy_service.reset(ProxyService::CreateFixed( 3642 session_deps_.proxy_service.reset(ProxyService::CreateFixed(
3643 "https://proxy:70")); 3643 "https://proxy:70"));
3644 CapturingBoundNetLog log; 3644 BoundTestNetLog log;
3645 session_deps_.net_log = log.bound().net_log(); 3645 session_deps_.net_log = log.bound().net_log();
3646 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 3646 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
3647 3647
3648 scoped_ptr<HttpTransaction> trans( 3648 scoped_ptr<HttpTransaction> trans(
3649 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 3649 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
3650 3650
3651 // CONNECT to www.google.com:443 via SPDY 3651 // CONNECT to www.google.com:443 via SPDY
3652 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( 3652 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect(
3653 NULL, 0, 1, LOWEST, HostPortPair("www.google.com", 443))); 3653 NULL, 0, 1, LOWEST, HostPortPair("www.google.com", 443)));
3654 // fetch https://www.google.com/ via SPDY 3654 // fetch https://www.google.com/ via SPDY
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
3723 // Test a SPDY CONNECT failure through an HTTPS Proxy. 3723 // Test a SPDY CONNECT failure through an HTTPS Proxy.
3724 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectFailure) { 3724 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectFailure) {
3725 HttpRequestInfo request; 3725 HttpRequestInfo request;
3726 request.method = "GET"; 3726 request.method = "GET";
3727 request.url = GURL("https://www.google.com/"); 3727 request.url = GURL("https://www.google.com/");
3728 request.load_flags = 0; 3728 request.load_flags = 0;
3729 3729
3730 // Configure against https proxy server "proxy:70". 3730 // Configure against https proxy server "proxy:70".
3731 session_deps_.proxy_service.reset(ProxyService::CreateFixed( 3731 session_deps_.proxy_service.reset(ProxyService::CreateFixed(
3732 "https://proxy:70")); 3732 "https://proxy:70"));
3733 CapturingBoundNetLog log; 3733 BoundTestNetLog log;
3734 session_deps_.net_log = log.bound().net_log(); 3734 session_deps_.net_log = log.bound().net_log();
3735 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 3735 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
3736 3736
3737 scoped_ptr<HttpTransaction> trans( 3737 scoped_ptr<HttpTransaction> trans(
3738 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 3738 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
3739 3739
3740 // CONNECT to www.google.com:443 via SPDY 3740 // CONNECT to www.google.com:443 via SPDY
3741 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( 3741 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect(
3742 NULL, 0, 1, LOWEST, HostPortPair("www.google.com", 443))); 3742 NULL, 0, 1, LOWEST, HostPortPair("www.google.com", 443)));
3743 scoped_ptr<SpdyFrame> get( 3743 scoped_ptr<SpdyFrame> get(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3778 // TODO(ttuttle): Anything else to check here? 3778 // TODO(ttuttle): Anything else to check here?
3779 } 3779 }
3780 3780
3781 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY 3781 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY
3782 // HTTPS Proxy to different servers. 3782 // HTTPS Proxy to different servers.
3783 TEST_P(HttpNetworkTransactionTest, 3783 TEST_P(HttpNetworkTransactionTest,
3784 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsTwoServers) { 3784 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsTwoServers) {
3785 // Configure against https proxy server "proxy:70". 3785 // Configure against https proxy server "proxy:70".
3786 session_deps_.proxy_service.reset(ProxyService::CreateFixed( 3786 session_deps_.proxy_service.reset(ProxyService::CreateFixed(
3787 "https://proxy:70")); 3787 "https://proxy:70"));
3788 CapturingBoundNetLog log; 3788 BoundTestNetLog log;
3789 session_deps_.net_log = log.bound().net_log(); 3789 session_deps_.net_log = log.bound().net_log();
3790 scoped_refptr<HttpNetworkSession> session( 3790 scoped_refptr<HttpNetworkSession> session(
3791 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); 3791 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_));
3792 3792
3793 HttpRequestInfo request1; 3793 HttpRequestInfo request1;
3794 request1.method = "GET"; 3794 request1.method = "GET";
3795 request1.url = GURL("https://www.google.com/"); 3795 request1.url = GURL("https://www.google.com/");
3796 request1.load_flags = 0; 3796 request1.load_flags = 0;
3797 3797
3798 HttpRequestInfo request2; 3798 HttpRequestInfo request2;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
3928 EXPECT_EQ(2, trans2->Read(buf.get(), 256, callback.callback())); 3928 EXPECT_EQ(2, trans2->Read(buf.get(), 256, callback.callback()));
3929 } 3929 }
3930 3930
3931 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY 3931 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY
3932 // HTTPS Proxy to the same server. 3932 // HTTPS Proxy to the same server.
3933 TEST_P(HttpNetworkTransactionTest, 3933 TEST_P(HttpNetworkTransactionTest,
3934 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsSameServer) { 3934 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsSameServer) {
3935 // Configure against https proxy server "proxy:70". 3935 // Configure against https proxy server "proxy:70".
3936 session_deps_.proxy_service.reset(ProxyService::CreateFixed( 3936 session_deps_.proxy_service.reset(ProxyService::CreateFixed(
3937 "https://proxy:70")); 3937 "https://proxy:70"));
3938 CapturingBoundNetLog log; 3938 BoundTestNetLog log;
3939 session_deps_.net_log = log.bound().net_log(); 3939 session_deps_.net_log = log.bound().net_log();
3940 scoped_refptr<HttpNetworkSession> session( 3940 scoped_refptr<HttpNetworkSession> session(
3941 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); 3941 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_));
3942 3942
3943 HttpRequestInfo request1; 3943 HttpRequestInfo request1;
3944 request1.method = "GET"; 3944 request1.method = "GET";
3945 request1.url = GURL("https://www.google.com/"); 3945 request1.url = GURL("https://www.google.com/");
3946 request1.load_flags = 0; 3946 request1.load_flags = 0;
3947 3947
3948 HttpRequestInfo request2; 3948 HttpRequestInfo request2;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
4059 EXPECT_EQ(2, trans2->Read(buf.get(), 256, callback.callback())); 4059 EXPECT_EQ(2, trans2->Read(buf.get(), 256, callback.callback()));
4060 } 4060 }
4061 4061
4062 // Test load timing in the case of of two HTTP requests through a SPDY HTTPS 4062 // Test load timing in the case of of two HTTP requests through a SPDY HTTPS
4063 // Proxy to different servers. 4063 // Proxy to different servers.
4064 TEST_P(HttpNetworkTransactionTest, 4064 TEST_P(HttpNetworkTransactionTest,
4065 HttpsProxySpdyLoadTimingTwoHttpRequests) { 4065 HttpsProxySpdyLoadTimingTwoHttpRequests) {
4066 // Configure against https proxy server "proxy:70". 4066 // Configure against https proxy server "proxy:70".
4067 session_deps_.proxy_service.reset(ProxyService::CreateFixed( 4067 session_deps_.proxy_service.reset(ProxyService::CreateFixed(
4068 "https://proxy:70")); 4068 "https://proxy:70"));
4069 CapturingBoundNetLog log; 4069 BoundTestNetLog log;
4070 session_deps_.net_log = log.bound().net_log(); 4070 session_deps_.net_log = log.bound().net_log();
4071 scoped_refptr<HttpNetworkSession> session( 4071 scoped_refptr<HttpNetworkSession> session(
4072 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); 4072 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_));
4073 4073
4074 HttpRequestInfo request1; 4074 HttpRequestInfo request1;
4075 request1.method = "GET"; 4075 request1.method = "GET";
4076 request1.url = GURL("http://www.google.com/"); 4076 request1.url = GURL("http://www.google.com/");
4077 request1.load_flags = 0; 4077 request1.load_flags = 0;
4078 4078
4079 HttpRequestInfo request2; 4079 HttpRequestInfo request2;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
4177 TEST_P(HttpNetworkTransactionTest, HttpsProxyAuthRetry) { 4177 TEST_P(HttpNetworkTransactionTest, HttpsProxyAuthRetry) {
4178 HttpRequestInfo request; 4178 HttpRequestInfo request;
4179 request.method = "GET"; 4179 request.method = "GET";
4180 request.url = GURL("http://www.google.com/"); 4180 request.url = GURL("http://www.google.com/");
4181 // when the no authentication data flag is set. 4181 // when the no authentication data flag is set.
4182 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; 4182 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA;
4183 4183
4184 // Configure against https proxy server "myproxy:70". 4184 // Configure against https proxy server "myproxy:70".
4185 session_deps_.proxy_service.reset( 4185 session_deps_.proxy_service.reset(
4186 ProxyService::CreateFixed("https://myproxy:70")); 4186 ProxyService::CreateFixed("https://myproxy:70"));
4187 CapturingBoundNetLog log; 4187 BoundTestNetLog log;
4188 session_deps_.net_log = log.bound().net_log(); 4188 session_deps_.net_log = log.bound().net_log();
4189 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 4189 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
4190 4190
4191 // Since we have proxy, should use full url 4191 // Since we have proxy, should use full url
4192 MockWrite data_writes1[] = { 4192 MockWrite data_writes1[] = {
4193 MockWrite("GET http://www.google.com/ HTTP/1.1\r\n" 4193 MockWrite("GET http://www.google.com/ HTTP/1.1\r\n"
4194 "Host: www.google.com\r\n" 4194 "Host: www.google.com\r\n"
4195 "Proxy-Connection: keep-alive\r\n\r\n"), 4195 "Proxy-Connection: keep-alive\r\n\r\n"),
4196 4196
4197 // After calling trans->RestartWithAuth(), this is the request we should 4197 // After calling trans->RestartWithAuth(), this is the request we should
(...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after
6367 ASSERT_TRUE(response != NULL); 6367 ASSERT_TRUE(response != NULL);
6368 EXPECT_EQ(100, response->headers->GetContentLength()); 6368 EXPECT_EQ(100, response->headers->GetContentLength());
6369 } 6369 }
6370 } 6370 }
6371 6371
6372 6372
6373 // Test HTTPS connections to a site, going through an HTTPS proxy 6373 // Test HTTPS connections to a site, going through an HTTPS proxy
6374 TEST_P(HttpNetworkTransactionTest, HTTPSViaHttpsProxy) { 6374 TEST_P(HttpNetworkTransactionTest, HTTPSViaHttpsProxy) {
6375 session_deps_.proxy_service.reset( 6375 session_deps_.proxy_service.reset(
6376 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); 6376 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70"));
6377 CapturingNetLog net_log; 6377 TestNetLog net_log;
6378 session_deps_.net_log = &net_log; 6378 session_deps_.net_log = &net_log;
6379 6379
6380 HttpRequestInfo request; 6380 HttpRequestInfo request;
6381 request.method = "GET"; 6381 request.method = "GET";
6382 request.url = GURL("https://www.google.com/"); 6382 request.url = GURL("https://www.google.com/");
6383 request.load_flags = 0; 6383 request.load_flags = 0;
6384 6384
6385 MockWrite data_writes[] = { 6385 MockWrite data_writes[] = {
6386 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" 6386 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n"
6387 "Host: www.google.com\r\n" 6387 "Host: www.google.com\r\n"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
6431 LoadTimingInfo load_timing_info; 6431 LoadTimingInfo load_timing_info;
6432 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); 6432 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info));
6433 TestLoadTimingNotReusedWithPac(load_timing_info, 6433 TestLoadTimingNotReusedWithPac(load_timing_info,
6434 CONNECT_TIMING_HAS_SSL_TIMES); 6434 CONNECT_TIMING_HAS_SSL_TIMES);
6435 } 6435 }
6436 6436
6437 // Test an HTTPS Proxy's ability to redirect a CONNECT request 6437 // Test an HTTPS Proxy's ability to redirect a CONNECT request
6438 TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaHttpsProxy) { 6438 TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaHttpsProxy) {
6439 session_deps_.proxy_service.reset( 6439 session_deps_.proxy_service.reset(
6440 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); 6440 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70"));
6441 CapturingNetLog net_log; 6441 TestNetLog net_log;
6442 session_deps_.net_log = &net_log; 6442 session_deps_.net_log = &net_log;
6443 6443
6444 HttpRequestInfo request; 6444 HttpRequestInfo request;
6445 request.method = "GET"; 6445 request.method = "GET";
6446 request.url = GURL("https://www.google.com/"); 6446 request.url = GURL("https://www.google.com/");
6447 request.load_flags = 0; 6447 request.load_flags = 0;
6448 6448
6449 MockWrite data_writes[] = { 6449 MockWrite data_writes[] = {
6450 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" 6450 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n"
6451 "Host: www.google.com\r\n" 6451 "Host: www.google.com\r\n"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
6684 TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) { 6684 TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) {
6685 HttpRequestInfo request; 6685 HttpRequestInfo request;
6686 request.method = "GET"; 6686 request.method = "GET";
6687 request.url = GURL("https://www.google.com/"); 6687 request.url = GURL("https://www.google.com/");
6688 // when the no authentication data flag is set. 6688 // when the no authentication data flag is set.
6689 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; 6689 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA;
6690 6690
6691 // Configure against https proxy server "myproxy:70". 6691 // Configure against https proxy server "myproxy:70".
6692 session_deps_.proxy_service.reset( 6692 session_deps_.proxy_service.reset(
6693 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")); 6693 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70"));
6694 CapturingBoundNetLog log; 6694 BoundTestNetLog log;
6695 session_deps_.net_log = log.bound().net_log(); 6695 session_deps_.net_log = log.bound().net_log();
6696 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 6696 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
6697 6697
6698 // Since we have proxy, should try to establish tunnel. 6698 // Since we have proxy, should try to establish tunnel.
6699 scoped_ptr<SpdyFrame> req(spdy_util_.ConstructSpdyConnect( 6699 scoped_ptr<SpdyFrame> req(spdy_util_.ConstructSpdyConnect(
6700 NULL, 0, 1, LOWEST, HostPortPair("www.google.com", 443))); 6700 NULL, 0, 1, LOWEST, HostPortPair("www.google.com", 443)));
6701 scoped_ptr<SpdyFrame> rst( 6701 scoped_ptr<SpdyFrame> rst(
6702 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); 6702 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL));
6703 6703
6704 // After calling trans->RestartWithAuth(), this is the request we should 6704 // After calling trans->RestartWithAuth(), this is the request we should
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6764 TestCompletionCallback callback1; 6764 TestCompletionCallback callback1;
6765 6765
6766 scoped_ptr<HttpTransaction> trans( 6766 scoped_ptr<HttpTransaction> trans(
6767 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 6767 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
6768 6768
6769 int rv = trans->Start(&request, callback1.callback(), log.bound()); 6769 int rv = trans->Start(&request, callback1.callback(), log.bound());
6770 EXPECT_EQ(ERR_IO_PENDING, rv); 6770 EXPECT_EQ(ERR_IO_PENDING, rv);
6771 6771
6772 rv = callback1.WaitForResult(); 6772 rv = callback1.WaitForResult();
6773 EXPECT_EQ(OK, rv); 6773 EXPECT_EQ(OK, rv);
6774 net::CapturingNetLog::CapturedEntryList entries; 6774 net::TestNetLog::CapturedEntryList entries;
6775 log.GetEntries(&entries); 6775 log.GetEntries(&entries);
6776 size_t pos = ExpectLogContainsSomewhere( 6776 size_t pos = ExpectLogContainsSomewhere(
6777 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 6777 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
6778 NetLog::PHASE_NONE); 6778 NetLog::PHASE_NONE);
6779 ExpectLogContainsSomewhere( 6779 ExpectLogContainsSomewhere(
6780 entries, pos, 6780 entries, pos,
6781 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 6781 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
6782 NetLog::PHASE_NONE); 6782 NetLog::PHASE_NONE);
6783 6783
6784 const HttpResponseInfo* response = trans->GetResponseInfo(); 6784 const HttpResponseInfo* response = trans->GetResponseInfo();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
6825 HttpRequestInfo push_request; 6825 HttpRequestInfo push_request;
6826 6826
6827 request.method = "GET"; 6827 request.method = "GET";
6828 request.url = GURL("http://www.google.com/"); 6828 request.url = GURL("http://www.google.com/");
6829 push_request.method = "GET"; 6829 push_request.method = "GET";
6830 push_request.url = GURL("http://www.another-origin.com/foo.dat"); 6830 push_request.url = GURL("http://www.another-origin.com/foo.dat");
6831 6831
6832 // Configure against https proxy server "myproxy:70". 6832 // Configure against https proxy server "myproxy:70".
6833 session_deps_.proxy_service.reset( 6833 session_deps_.proxy_service.reset(
6834 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")); 6834 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70"));
6835 CapturingBoundNetLog log; 6835 BoundTestNetLog log;
6836 session_deps_.net_log = log.bound().net_log(); 6836 session_deps_.net_log = log.bound().net_log();
6837 6837
6838 // Enable cross-origin push. 6838 // Enable cross-origin push.
6839 session_deps_.trusted_spdy_proxy = "myproxy:70"; 6839 session_deps_.trusted_spdy_proxy = "myproxy:70";
6840 6840
6841 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 6841 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
6842 6842
6843 scoped_ptr<SpdyFrame> stream1_syn( 6843 scoped_ptr<SpdyFrame> stream1_syn(
6844 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); 6844 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false));
6845 6845
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
6940 // Test that an explicitly trusted SPDY proxy cannot push HTTPS content. 6940 // Test that an explicitly trusted SPDY proxy cannot push HTTPS content.
6941 TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPushCorrectness) { 6941 TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPushCorrectness) {
6942 HttpRequestInfo request; 6942 HttpRequestInfo request;
6943 6943
6944 request.method = "GET"; 6944 request.method = "GET";
6945 request.url = GURL("http://www.google.com/"); 6945 request.url = GURL("http://www.google.com/");
6946 6946
6947 // Configure against https proxy server "myproxy:70". 6947 // Configure against https proxy server "myproxy:70".
6948 session_deps_.proxy_service.reset( 6948 session_deps_.proxy_service.reset(
6949 ProxyService::CreateFixed("https://myproxy:70")); 6949 ProxyService::CreateFixed("https://myproxy:70"));
6950 CapturingBoundNetLog log; 6950 BoundTestNetLog log;
6951 session_deps_.net_log = log.bound().net_log(); 6951 session_deps_.net_log = log.bound().net_log();
6952 6952
6953 // Enable cross-origin push. 6953 // Enable cross-origin push.
6954 session_deps_.trusted_spdy_proxy = "myproxy:70"; 6954 session_deps_.trusted_spdy_proxy = "myproxy:70";
6955 6955
6956 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 6956 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
6957 6957
6958 scoped_ptr<SpdyFrame> stream1_syn( 6958 scoped_ptr<SpdyFrame> stream1_syn(
6959 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); 6959 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false));
6960 6960
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
7491 } 7491 }
7492 7492
7493 TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET) { 7493 TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET) {
7494 HttpRequestInfo request; 7494 HttpRequestInfo request;
7495 request.method = "GET"; 7495 request.method = "GET";
7496 request.url = GURL("http://www.google.com/"); 7496 request.url = GURL("http://www.google.com/");
7497 request.load_flags = 0; 7497 request.load_flags = 0;
7498 7498
7499 session_deps_.proxy_service.reset( 7499 session_deps_.proxy_service.reset(
7500 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080")); 7500 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080"));
7501 CapturingNetLog net_log; 7501 TestNetLog net_log;
7502 session_deps_.net_log = &net_log; 7502 session_deps_.net_log = &net_log;
7503 7503
7504 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 7504 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
7505 scoped_ptr<HttpTransaction> trans( 7505 scoped_ptr<HttpTransaction> trans(
7506 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 7506 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
7507 7507
7508 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; 7508 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 };
7509 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; 7509 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 };
7510 7510
7511 MockWrite data_writes[] = { 7511 MockWrite data_writes[] = {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
7550 } 7550 }
7551 7551
7552 TEST_P(HttpNetworkTransactionTest, SOCKS4_SSL_GET) { 7552 TEST_P(HttpNetworkTransactionTest, SOCKS4_SSL_GET) {
7553 HttpRequestInfo request; 7553 HttpRequestInfo request;
7554 request.method = "GET"; 7554 request.method = "GET";
7555 request.url = GURL("https://www.google.com/"); 7555 request.url = GURL("https://www.google.com/");
7556 request.load_flags = 0; 7556 request.load_flags = 0;
7557 7557
7558 session_deps_.proxy_service.reset( 7558 session_deps_.proxy_service.reset(
7559 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080")); 7559 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080"));
7560 CapturingNetLog net_log; 7560 TestNetLog net_log;
7561 session_deps_.net_log = &net_log; 7561 session_deps_.net_log = &net_log;
7562 7562
7563 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 7563 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
7564 scoped_ptr<HttpTransaction> trans( 7564 scoped_ptr<HttpTransaction> trans(
7565 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 7565 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
7566 7566
7567 unsigned char write_buffer[] = { 0x04, 0x01, 0x01, 0xBB, 127, 0, 0, 1, 0 }; 7567 unsigned char write_buffer[] = { 0x04, 0x01, 0x01, 0xBB, 127, 0, 0, 1, 0 };
7568 unsigned char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; 7568 unsigned char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 };
7569 7569
7570 MockWrite data_writes[] = { 7570 MockWrite data_writes[] = {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
7614 } 7614 }
7615 7615
7616 TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET_no_PAC) { 7616 TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET_no_PAC) {
7617 HttpRequestInfo request; 7617 HttpRequestInfo request;
7618 request.method = "GET"; 7618 request.method = "GET";
7619 request.url = GURL("http://www.google.com/"); 7619 request.url = GURL("http://www.google.com/");
7620 request.load_flags = 0; 7620 request.load_flags = 0;
7621 7621
7622 session_deps_.proxy_service.reset( 7622 session_deps_.proxy_service.reset(
7623 ProxyService::CreateFixed("socks4://myproxy:1080")); 7623 ProxyService::CreateFixed("socks4://myproxy:1080"));
7624 CapturingNetLog net_log; 7624 TestNetLog net_log;
7625 session_deps_.net_log = &net_log; 7625 session_deps_.net_log = &net_log;
7626 7626
7627 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 7627 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
7628 scoped_ptr<HttpTransaction> trans( 7628 scoped_ptr<HttpTransaction> trans(
7629 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 7629 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
7630 7630
7631 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; 7631 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 };
7632 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; 7632 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 };
7633 7633
7634 MockWrite data_writes[] = { 7634 MockWrite data_writes[] = {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
7673 } 7673 }
7674 7674
7675 TEST_P(HttpNetworkTransactionTest, SOCKS5_HTTP_GET) { 7675 TEST_P(HttpNetworkTransactionTest, SOCKS5_HTTP_GET) {
7676 HttpRequestInfo request; 7676 HttpRequestInfo request;
7677 request.method = "GET"; 7677 request.method = "GET";
7678 request.url = GURL("http://www.google.com/"); 7678 request.url = GURL("http://www.google.com/");
7679 request.load_flags = 0; 7679 request.load_flags = 0;
7680 7680
7681 session_deps_.proxy_service.reset( 7681 session_deps_.proxy_service.reset(
7682 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080")); 7682 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080"));
7683 CapturingNetLog net_log; 7683 TestNetLog net_log;
7684 session_deps_.net_log = &net_log; 7684 session_deps_.net_log = &net_log;
7685 7685
7686 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 7686 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
7687 scoped_ptr<HttpTransaction> trans( 7687 scoped_ptr<HttpTransaction> trans(
7688 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 7688 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
7689 7689
7690 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; 7690 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 };
7691 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; 7691 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 };
7692 const char kSOCKS5OkRequest[] = { 7692 const char kSOCKS5OkRequest[] = {
7693 0x05, // Version 7693 0x05, // Version
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
7746 } 7746 }
7747 7747
7748 TEST_P(HttpNetworkTransactionTest, SOCKS5_SSL_GET) { 7748 TEST_P(HttpNetworkTransactionTest, SOCKS5_SSL_GET) {
7749 HttpRequestInfo request; 7749 HttpRequestInfo request;
7750 request.method = "GET"; 7750 request.method = "GET";
7751 request.url = GURL("https://www.google.com/"); 7751 request.url = GURL("https://www.google.com/");
7752 request.load_flags = 0; 7752 request.load_flags = 0;
7753 7753
7754 session_deps_.proxy_service.reset( 7754 session_deps_.proxy_service.reset(
7755 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080")); 7755 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080"));
7756 CapturingNetLog net_log; 7756 TestNetLog net_log;
7757 session_deps_.net_log = &net_log; 7757 session_deps_.net_log = &net_log;
7758 7758
7759 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 7759 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
7760 scoped_ptr<HttpTransaction> trans( 7760 scoped_ptr<HttpTransaction> trans(
7761 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 7761 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
7762 7762
7763 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; 7763 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 };
7764 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; 7764 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 };
7765 const unsigned char kSOCKS5OkRequest[] = { 7765 const unsigned char kSOCKS5OkRequest[] = {
7766 0x05, // Version 7766 0x05, // Version
(...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after
9517 ProxyConfig proxy_config; 9517 ProxyConfig proxy_config;
9518 proxy_config.set_auto_detect(true); 9518 proxy_config.set_auto_detect(true);
9519 proxy_config.set_pac_url(GURL("http://fooproxyurl")); 9519 proxy_config.set_pac_url(GURL("http://fooproxyurl"));
9520 9520
9521 CapturingProxyResolver capturing_proxy_resolver; 9521 CapturingProxyResolver capturing_proxy_resolver;
9522 session_deps_.proxy_service.reset(new ProxyService( 9522 session_deps_.proxy_service.reset(new ProxyService(
9523 new ProxyConfigServiceFixed(proxy_config), 9523 new ProxyConfigServiceFixed(proxy_config),
9524 make_scoped_ptr( 9524 make_scoped_ptr(
9525 new ForwardingProxyResolverFactory(&capturing_proxy_resolver)), 9525 new ForwardingProxyResolverFactory(&capturing_proxy_resolver)),
9526 NULL)); 9526 NULL));
9527 CapturingNetLog net_log; 9527 TestNetLog net_log;
9528 session_deps_.net_log = &net_log; 9528 session_deps_.net_log = &net_log;
9529 9529
9530 HttpRequestInfo request; 9530 HttpRequestInfo request;
9531 request.method = "GET"; 9531 request.method = "GET";
9532 request.url = GURL("http://www.google.com/"); 9532 request.url = GURL("http://www.google.com/");
9533 request.load_flags = 0; 9533 request.load_flags = 0;
9534 9534
9535 std::string alternate_protocol_http_header = 9535 std::string alternate_protocol_http_header =
9536 GetAlternateProtocolHttpHeader(); 9536 GetAlternateProtocolHttpHeader();
9537 9537
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
10448 }; 10448 };
10449 10449
10450 TEST_P(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) { 10450 TEST_P(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) {
10451 // This test ensures that the URL passed into the proxy is upgraded 10451 // This test ensures that the URL passed into the proxy is upgraded
10452 // to https when doing an Alternate Protocol upgrade. 10452 // to https when doing an Alternate Protocol upgrade.
10453 session_deps_.use_alternate_protocols = true; 10453 session_deps_.use_alternate_protocols = true;
10454 session_deps_.next_protos = SpdyNextProtos(); 10454 session_deps_.next_protos = SpdyNextProtos();
10455 10455
10456 session_deps_.proxy_service.reset( 10456 session_deps_.proxy_service.reset(
10457 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); 10457 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
10458 CapturingNetLog net_log; 10458 TestNetLog net_log;
10459 session_deps_.net_log = &net_log; 10459 session_deps_.net_log = &net_log;
10460 GURL request_url; 10460 GURL request_url;
10461 { 10461 {
10462 HttpAuthHandlerMock::Factory* auth_factory = 10462 HttpAuthHandlerMock::Factory* auth_factory =
10463 new HttpAuthHandlerMock::Factory(); 10463 new HttpAuthHandlerMock::Factory();
10464 UrlRecordingHttpAuthHandlerMock* auth_handler = 10464 UrlRecordingHttpAuthHandlerMock* auth_handler =
10465 new UrlRecordingHttpAuthHandlerMock(&request_url); 10465 new UrlRecordingHttpAuthHandlerMock(&request_url);
10466 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); 10466 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY);
10467 auth_factory->set_do_init_from_challenge(true); 10467 auth_factory->set_do_init_from_challenge(true);
10468 session_deps_.http_auth_handler_factory.reset(auth_factory); 10468 session_deps_.http_auth_handler_factory.reset(auth_factory);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
10632 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 10632 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
10633 scoped_ptr<HttpTransaction> trans( 10633 scoped_ptr<HttpTransaction> trans(
10634 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 10634 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
10635 10635
10636 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); 10636 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0);
10637 data.set_connect_data(mock_connect); 10637 data.set_connect_data(mock_connect);
10638 session_deps_.socket_factory->AddSocketDataProvider(&data); 10638 session_deps_.socket_factory->AddSocketDataProvider(&data);
10639 10639
10640 TestCompletionCallback callback; 10640 TestCompletionCallback callback;
10641 10641
10642 CapturingBoundNetLog log; 10642 BoundTestNetLog log;
10643 int rv = trans->Start(&request, callback.callback(), log.bound()); 10643 int rv = trans->Start(&request, callback.callback(), log.bound());
10644 EXPECT_EQ(ERR_IO_PENDING, rv); 10644 EXPECT_EQ(ERR_IO_PENDING, rv);
10645 trans.reset(); // Cancel the transaction here. 10645 trans.reset(); // Cancel the transaction here.
10646 10646
10647 base::MessageLoop::current()->RunUntilIdle(); 10647 base::MessageLoop::current()->RunUntilIdle();
10648 } 10648 }
10649 10649
10650 // Test that if a transaction is cancelled after receiving the headers, the 10650 // Test that if a transaction is cancelled after receiving the headers, the
10651 // stream is drained properly and added back to the socket pool. The main 10651 // stream is drained properly and added back to the socket pool. The main
10652 // purpose of this test is to make sure that an HttpStreamParser can be read 10652 // purpose of this test is to make sure that an HttpStreamParser can be read
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
10694 base::MessageLoop::current()->RunUntilIdle(); 10694 base::MessageLoop::current()->RunUntilIdle();
10695 10695
10696 // Socket should now be idle, waiting to be reused. 10696 // Socket should now be idle, waiting to be reused.
10697 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session.get())); 10697 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session.get()));
10698 } 10698 }
10699 10699
10700 // Test a basic GET request through a proxy. 10700 // Test a basic GET request through a proxy.
10701 TEST_P(HttpNetworkTransactionTest, ProxyGet) { 10701 TEST_P(HttpNetworkTransactionTest, ProxyGet) {
10702 session_deps_.proxy_service.reset( 10702 session_deps_.proxy_service.reset(
10703 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); 10703 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
10704 CapturingBoundNetLog log; 10704 BoundTestNetLog log;
10705 session_deps_.net_log = log.bound().net_log(); 10705 session_deps_.net_log = log.bound().net_log();
10706 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 10706 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
10707 10707
10708 HttpRequestInfo request; 10708 HttpRequestInfo request;
10709 request.method = "GET"; 10709 request.method = "GET";
10710 request.url = GURL("http://www.google.com/"); 10710 request.url = GURL("http://www.google.com/");
10711 10711
10712 MockWrite data_writes1[] = { 10712 MockWrite data_writes1[] = {
10713 MockWrite("GET http://www.google.com/ HTTP/1.1\r\n" 10713 MockWrite("GET http://www.google.com/ HTTP/1.1\r\n"
10714 "Host: www.google.com\r\n" 10714 "Host: www.google.com\r\n"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
10757 LoadTimingInfo load_timing_info; 10757 LoadTimingInfo load_timing_info;
10758 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); 10758 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info));
10759 TestLoadTimingNotReusedWithPac(load_timing_info, 10759 TestLoadTimingNotReusedWithPac(load_timing_info,
10760 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY); 10760 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY);
10761 } 10761 }
10762 10762
10763 // Test a basic HTTPS GET request through a proxy. 10763 // Test a basic HTTPS GET request through a proxy.
10764 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGet) { 10764 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGet) {
10765 session_deps_.proxy_service.reset( 10765 session_deps_.proxy_service.reset(
10766 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); 10766 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
10767 CapturingBoundNetLog log; 10767 BoundTestNetLog log;
10768 session_deps_.net_log = log.bound().net_log(); 10768 session_deps_.net_log = log.bound().net_log();
10769 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 10769 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
10770 10770
10771 HttpRequestInfo request; 10771 HttpRequestInfo request;
10772 request.method = "GET"; 10772 request.method = "GET";
10773 request.url = GURL("https://www.google.com/"); 10773 request.url = GURL("https://www.google.com/");
10774 10774
10775 // Since we have proxy, should try to establish tunnel. 10775 // Since we have proxy, should try to establish tunnel.
10776 MockWrite data_writes1[] = { 10776 MockWrite data_writes1[] = {
10777 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" 10777 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n"
(...skipping 23 matching lines...) Expand all
10801 TestCompletionCallback callback1; 10801 TestCompletionCallback callback1;
10802 10802
10803 scoped_ptr<HttpTransaction> trans( 10803 scoped_ptr<HttpTransaction> trans(
10804 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 10804 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
10805 10805
10806 int rv = trans->Start(&request, callback1.callback(), log.bound()); 10806 int rv = trans->Start(&request, callback1.callback(), log.bound());
10807 EXPECT_EQ(ERR_IO_PENDING, rv); 10807 EXPECT_EQ(ERR_IO_PENDING, rv);
10808 10808
10809 rv = callback1.WaitForResult(); 10809 rv = callback1.WaitForResult();
10810 EXPECT_EQ(OK, rv); 10810 EXPECT_EQ(OK, rv);
10811 net::CapturingNetLog::CapturedEntryList entries; 10811 net::TestNetLog::CapturedEntryList entries;
10812 log.GetEntries(&entries); 10812 log.GetEntries(&entries);
10813 size_t pos = ExpectLogContainsSomewhere( 10813 size_t pos = ExpectLogContainsSomewhere(
10814 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 10814 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
10815 NetLog::PHASE_NONE); 10815 NetLog::PHASE_NONE);
10816 ExpectLogContainsSomewhere( 10816 ExpectLogContainsSomewhere(
10817 entries, pos, 10817 entries, pos,
10818 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 10818 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
10819 NetLog::PHASE_NONE); 10819 NetLog::PHASE_NONE);
10820 10820
10821 const HttpResponseInfo* response = trans->GetResponseInfo(); 10821 const HttpResponseInfo* response = trans->GetResponseInfo();
(...skipping 10 matching lines...) Expand all
10832 LoadTimingInfo load_timing_info; 10832 LoadTimingInfo load_timing_info;
10833 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); 10833 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info));
10834 TestLoadTimingNotReusedWithPac(load_timing_info, 10834 TestLoadTimingNotReusedWithPac(load_timing_info,
10835 CONNECT_TIMING_HAS_SSL_TIMES); 10835 CONNECT_TIMING_HAS_SSL_TIMES);
10836 } 10836 }
10837 10837
10838 // Test a basic HTTPS GET request through a proxy, but the server hangs up 10838 // Test a basic HTTPS GET request through a proxy, but the server hangs up
10839 // while establishing the tunnel. 10839 // while establishing the tunnel.
10840 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGetHangup) { 10840 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGetHangup) {
10841 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); 10841 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
10842 CapturingBoundNetLog log; 10842 BoundTestNetLog log;
10843 session_deps_.net_log = log.bound().net_log(); 10843 session_deps_.net_log = log.bound().net_log();
10844 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); 10844 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
10845 10845
10846 HttpRequestInfo request; 10846 HttpRequestInfo request;
10847 request.method = "GET"; 10847 request.method = "GET";
10848 request.url = GURL("https://www.google.com/"); 10848 request.url = GURL("https://www.google.com/");
10849 10849
10850 // Since we have proxy, should try to establish tunnel. 10850 // Since we have proxy, should try to establish tunnel.
10851 MockWrite data_writes1[] = { 10851 MockWrite data_writes1[] = {
10852 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" 10852 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n"
(...skipping 20 matching lines...) Expand all
10873 TestCompletionCallback callback1; 10873 TestCompletionCallback callback1;
10874 10874
10875 scoped_ptr<HttpTransaction> trans( 10875 scoped_ptr<HttpTransaction> trans(
10876 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); 10876 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
10877 10877
10878 int rv = trans->Start(&request, callback1.callback(), log.bound()); 10878 int rv = trans->Start(&request, callback1.callback(), log.bound());
10879 EXPECT_EQ(ERR_IO_PENDING, rv); 10879 EXPECT_EQ(ERR_IO_PENDING, rv);
10880 10880
10881 rv = callback1.WaitForResult(); 10881 rv = callback1.WaitForResult();
10882 EXPECT_EQ(ERR_EMPTY_RESPONSE, rv); 10882 EXPECT_EQ(ERR_EMPTY_RESPONSE, rv);
10883 net::CapturingNetLog::CapturedEntryList entries; 10883 net::TestNetLog::CapturedEntryList entries;
10884 log.GetEntries(&entries); 10884 log.GetEntries(&entries);
10885 size_t pos = ExpectLogContainsSomewhere( 10885 size_t pos = ExpectLogContainsSomewhere(
10886 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 10886 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
10887 NetLog::PHASE_NONE); 10887 NetLog::PHASE_NONE);
10888 ExpectLogContainsSomewhere( 10888 ExpectLogContainsSomewhere(
10889 entries, pos, 10889 entries, pos,
10890 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 10890 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
10891 NetLog::PHASE_NONE); 10891 NetLog::PHASE_NONE);
10892 } 10892 }
10893 10893
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
11218 // cache when: 11218 // cache when:
11219 // 1) An HTTPS proxy is involved. 11219 // 1) An HTTPS proxy is involved.
11220 // 3) The HTTPS proxy requests a client certificate. 11220 // 3) The HTTPS proxy requests a client certificate.
11221 // 4) The client supplies an invalid/unacceptable certificate for the 11221 // 4) The client supplies an invalid/unacceptable certificate for the
11222 // proxy. 11222 // proxy.
11223 // The test is repeated twice, first for connecting to an HTTPS endpoint, 11223 // The test is repeated twice, first for connecting to an HTTPS endpoint,
11224 // then for connecting to an HTTP endpoint. 11224 // then for connecting to an HTTP endpoint.
11225 TEST_P(HttpNetworkTransactionTest, ClientAuthCertCache_Proxy_Fail) { 11225 TEST_P(HttpNetworkTransactionTest, ClientAuthCertCache_Proxy_Fail) {
11226 session_deps_.proxy_service.reset( 11226 session_deps_.proxy_service.reset(
11227 ProxyService::CreateFixed("https://proxy:70")); 11227 ProxyService::CreateFixed("https://proxy:70"));
11228 CapturingBoundNetLog log; 11228 BoundTestNetLog log;
11229 session_deps_.net_log = log.bound().net_log(); 11229 session_deps_.net_log = log.bound().net_log();
11230 11230
11231 scoped_refptr<SSLCertRequestInfo> cert_request(new SSLCertRequestInfo()); 11231 scoped_refptr<SSLCertRequestInfo> cert_request(new SSLCertRequestInfo());
11232 cert_request->host_and_port = HostPortPair("proxy", 70); 11232 cert_request->host_and_port = HostPortPair("proxy", 70);
11233 11233
11234 // See ClientAuthCertCache_Direct_NoFalseStart for the explanation of 11234 // See ClientAuthCertCache_Direct_NoFalseStart for the explanation of
11235 // [ssl_]data[1-3]. Rather than represending the endpoint 11235 // [ssl_]data[1-3]. Rather than represending the endpoint
11236 // (www.example.com:443), they represent failures with the HTTPS proxy 11236 // (www.example.com:443), they represent failures with the HTTPS proxy
11237 // (proxy:70). 11237 // (proxy:70).
11238 SSLSocketDataProvider ssl_data1(ASYNC, net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED); 11238 SSLSocketDataProvider ssl_data1(ASYNC, net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED);
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
11812 MockRead(ASYNC, ERR_IO_PENDING, 8) 11812 MockRead(ASYNC, ERR_IO_PENDING, 8)
11813 }; 11813 };
11814 11814
11815 DeterministicSocketData data1(reads1, arraysize(reads1), 11815 DeterministicSocketData data1(reads1, arraysize(reads1),
11816 writes1, arraysize(writes1)); 11816 writes1, arraysize(writes1));
11817 MockConnect connect_data1(ASYNC, OK); 11817 MockConnect connect_data1(ASYNC, OK);
11818 data1.set_connect_data(connect_data1); 11818 data1.set_connect_data(connect_data1);
11819 11819
11820 session_deps_.proxy_service.reset( 11820 session_deps_.proxy_service.reset(
11821 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70")); 11821 ProxyService::CreateFixedFromPacResult("HTTPS proxy:70"));
11822 CapturingNetLog log; 11822 TestNetLog log;
11823 session_deps_.net_log = &log; 11823 session_deps_.net_log = &log;
11824 SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy 11824 SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy
11825 ssl1.SetNextProto(GetParam()); 11825 ssl1.SetNextProto(GetParam());
11826 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl1); 11826 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl1);
11827 SSLSocketDataProvider ssl2(ASYNC, OK); // to the server 11827 SSLSocketDataProvider ssl2(ASYNC, OK); // to the server
11828 ssl2.SetNextProto(GetParam()); 11828 ssl2.SetNextProto(GetParam());
11829 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl2); 11829 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl2);
11830 session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data1); 11830 session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data1);
11831 11831
11832 scoped_refptr<HttpNetworkSession> session( 11832 scoped_refptr<HttpNetworkSession> session(
(...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after
13783 ASSERT_TRUE(response); 13783 ASSERT_TRUE(response);
13784 ASSERT_TRUE(response->headers.get()); 13784 ASSERT_TRUE(response->headers.get());
13785 13785
13786 EXPECT_EQ(101, response->headers->response_code()); 13786 EXPECT_EQ(101, response->headers->response_code());
13787 13787
13788 trans.reset(); 13788 trans.reset();
13789 session->CloseAllConnections(); 13789 session->CloseAllConnections();
13790 } 13790 }
13791 13791
13792 } // namespace net 13792 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_cache_unittest.cc ('k') | net/log/capturing_net_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698