| OLD | NEW |
| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 const char* value = va_arg(args, const char*); | 94 const char* value = va_arg(args, const char*); |
| 95 if (value == NULL) | 95 if (value == NULL) |
| 96 break; | 96 break; |
| 97 ret.push_back(value); | 97 ret.push_back(value); |
| 98 } | 98 } |
| 99 va_end(args); | 99 va_end(args); |
| 100 | 100 |
| 101 return ret; | 101 return ret; |
| 102 } | 102 } |
| 103 | 103 |
| 104 // SpdyNextProtos returns a vector of NPN protocol strings for negotiating | |
| 105 // SPDY. | |
| 106 std::vector<std::string> SpdyNextProtos() { | |
| 107 return MakeNextProtos("http/1.1", "spdy/2", NULL); | |
| 108 } | |
| 109 | |
| 110 int GetIdleSocketCountInTransportSocketPool(net::HttpNetworkSession* session) { | 104 int GetIdleSocketCountInTransportSocketPool(net::HttpNetworkSession* session) { |
| 111 return session->GetTransportSocketPool( | 105 return session->GetTransportSocketPool( |
| 112 net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount(); | 106 net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount(); |
| 113 } | 107 } |
| 114 | 108 |
| 115 int GetIdleSocketCountInSSLSocketPool(net::HttpNetworkSession* session) { | 109 int GetIdleSocketCountInSSLSocketPool(net::HttpNetworkSession* session) { |
| 116 return session->GetSSLSocketPool( | 110 return session->GetSSLSocketPool( |
| 117 net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount(); | 111 net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount(); |
| 118 } | 112 } |
| 119 | 113 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 base::MessageLoop::current()->RunUntilIdle(); | 267 base::MessageLoop::current()->RunUntilIdle(); |
| 274 // Empty the current queue. | 268 // Empty the current queue. |
| 275 base::MessageLoop::current()->RunUntilIdle(); | 269 base::MessageLoop::current()->RunUntilIdle(); |
| 276 PlatformTest::TearDown(); | 270 PlatformTest::TearDown(); |
| 277 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); | 271 NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); |
| 278 base::MessageLoop::current()->RunUntilIdle(); | 272 base::MessageLoop::current()->RunUntilIdle(); |
| 279 HttpStreamFactory::set_use_alternate_protocols(false); | 273 HttpStreamFactory::set_use_alternate_protocols(false); |
| 280 HttpStreamFactory::SetNextProtos(std::vector<std::string>()); | 274 HttpStreamFactory::SetNextProtos(std::vector<std::string>()); |
| 281 } | 275 } |
| 282 | 276 |
| 277 // This is the expected return from a current server advertising SPDY. |
| 278 std::string GetAlternateProtocolHttpHeader() { |
| 279 return |
| 280 std::string("Alternate-Protocol: 443:") + |
| 281 AlternateProtocolToString(AlternateProtocolFromNextProto(GetParam())) + |
| 282 "\r\n\r\n"; |
| 283 } |
| 284 |
| 283 // Either |write_failure| specifies a write failure or |read_failure| | 285 // Either |write_failure| specifies a write failure or |read_failure| |
| 284 // specifies a read failure when using a reused socket. In either case, the | 286 // specifies a read failure when using a reused socket. In either case, the |
| 285 // failure should cause the network transaction to resend the request, and the | 287 // failure should cause the network transaction to resend the request, and the |
| 286 // other argument should be NULL. | 288 // other argument should be NULL. |
| 287 void KeepAliveConnectionResendRequestTest(const MockWrite* write_failure, | 289 void KeepAliveConnectionResendRequestTest(const MockWrite* write_failure, |
| 288 const MockRead* read_failure); | 290 const MockRead* read_failure); |
| 289 | 291 |
| 290 SimpleGetHelperResult SimpleGetHelperForData(StaticSocketDataProvider* data[], | 292 SimpleGetHelperResult SimpleGetHelperForData(StaticSocketDataProvider* data[], |
| 291 size_t data_count) { | 293 size_t data_count) { |
| 292 SimpleGetHelperResult out; | 294 SimpleGetHelperResult out; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 std::string(), | 523 std::string(), |
| 522 NULL, | 524 NULL, |
| 523 NULL, | 525 NULL, |
| 524 NULL, | 526 NULL, |
| 525 NULL, | 527 NULL, |
| 526 NULL, | 528 NULL, |
| 527 NULL) {} | 529 NULL) {} |
| 528 | 530 |
| 529 //----------------------------------------------------------------------------- | 531 //----------------------------------------------------------------------------- |
| 530 | 532 |
| 531 // This is the expected return from a current server advertising SPDY. | |
| 532 static const char kAlternateProtocolHttpHeader[] = | |
| 533 "Alternate-Protocol: 443:npn-spdy/2\r\n\r\n"; | |
| 534 | |
| 535 // Helper functions for validating that AuthChallengeInfo's are correctly | 533 // Helper functions for validating that AuthChallengeInfo's are correctly |
| 536 // configured for common cases. | 534 // configured for common cases. |
| 537 bool CheckBasicServerAuth(const AuthChallengeInfo* auth_challenge) { | 535 bool CheckBasicServerAuth(const AuthChallengeInfo* auth_challenge) { |
| 538 if (!auth_challenge) | 536 if (!auth_challenge) |
| 539 return false; | 537 return false; |
| 540 EXPECT_FALSE(auth_challenge->is_proxy); | 538 EXPECT_FALSE(auth_challenge->is_proxy); |
| 541 EXPECT_EQ("www.google.com:80", auth_challenge->challenger.ToString()); | 539 EXPECT_EQ("www.google.com:80", auth_challenge->challenger.ToString()); |
| 542 EXPECT_EQ("MyRealm1", auth_challenge->realm); | 540 EXPECT_EQ("MyRealm1", auth_challenge->realm); |
| 543 EXPECT_EQ("basic", auth_challenge->scheme); | 541 EXPECT_EQ("basic", auth_challenge->scheme); |
| 544 return true; | 542 return true; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 569 return false; | 567 return false; |
| 570 EXPECT_FALSE(auth_challenge->is_proxy); | 568 EXPECT_FALSE(auth_challenge->is_proxy); |
| 571 EXPECT_EQ("172.22.68.17:80", auth_challenge->challenger.ToString()); | 569 EXPECT_EQ("172.22.68.17:80", auth_challenge->challenger.ToString()); |
| 572 EXPECT_EQ(std::string(), auth_challenge->realm); | 570 EXPECT_EQ(std::string(), auth_challenge->realm); |
| 573 EXPECT_EQ("ntlm", auth_challenge->scheme); | 571 EXPECT_EQ("ntlm", auth_challenge->scheme); |
| 574 return true; | 572 return true; |
| 575 } | 573 } |
| 576 | 574 |
| 577 } // namespace | 575 } // namespace |
| 578 | 576 |
| 579 // TODO(akalin): Don't early-exit in the tests below for values > | |
| 580 // kProtoSPDY3. | |
| 581 | |
| 582 TEST_P(HttpNetworkTransactionTest, Basic) { | 577 TEST_P(HttpNetworkTransactionTest, Basic) { |
| 583 scoped_ptr<HttpTransaction> trans( | 578 scoped_ptr<HttpTransaction> trans( |
| 584 new HttpNetworkTransaction(DEFAULT_PRIORITY, | 579 new HttpNetworkTransaction(DEFAULT_PRIORITY, |
| 585 CreateSession(&session_deps_))); | 580 CreateSession(&session_deps_))); |
| 586 } | 581 } |
| 587 | 582 |
| 588 TEST_P(HttpNetworkTransactionTest, SimpleGET) { | 583 TEST_P(HttpNetworkTransactionTest, SimpleGET) { |
| 589 MockRead data_reads[] = { | 584 MockRead data_reads[] = { |
| 590 MockRead("HTTP/1.0 200 OK\r\n\r\n"), | 585 MockRead("HTTP/1.0 200 OK\r\n\r\n"), |
| 591 MockRead("hello world"), | 586 MockRead("hello world"), |
| (...skipping 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2626 EXPECT_EQ(200, response->headers->response_code()); | 2621 EXPECT_EQ(200, response->headers->response_code()); |
| 2627 EXPECT_EQ(100, response->headers->GetContentLength()); | 2622 EXPECT_EQ(100, response->headers->GetContentLength()); |
| 2628 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); | 2623 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
| 2629 | 2624 |
| 2630 // The password prompt info should not be set. | 2625 // The password prompt info should not be set. |
| 2631 EXPECT_TRUE(response->auth_challenge.get() == NULL); | 2626 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
| 2632 } | 2627 } |
| 2633 | 2628 |
| 2634 // Test a SPDY get through an HTTPS Proxy. | 2629 // Test a SPDY get through an HTTPS Proxy. |
| 2635 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGet) { | 2630 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGet) { |
| 2636 if (GetParam() > kProtoSPDY3) | |
| 2637 return; | |
| 2638 | |
| 2639 HttpRequestInfo request; | 2631 HttpRequestInfo request; |
| 2640 request.method = "GET"; | 2632 request.method = "GET"; |
| 2641 request.url = GURL("http://www.google.com/"); | 2633 request.url = GURL("http://www.google.com/"); |
| 2642 request.load_flags = 0; | 2634 request.load_flags = 0; |
| 2643 | 2635 |
| 2644 // Configure against https proxy server "proxy:70". | 2636 // Configure against https proxy server "proxy:70". |
| 2645 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 2637 session_deps_.proxy_service.reset(ProxyService::CreateFixed( |
| 2646 "https://proxy:70")); | 2638 "https://proxy:70")); |
| 2647 CapturingBoundNetLog log; | 2639 CapturingBoundNetLog log; |
| 2648 session_deps_.net_log = log.bound().net_log(); | 2640 session_deps_.net_log = log.bound().net_log(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2692 ASSERT_TRUE(response->headers.get() != NULL); | 2684 ASSERT_TRUE(response->headers.get() != NULL); |
| 2693 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 2685 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 2694 | 2686 |
| 2695 std::string response_data; | 2687 std::string response_data; |
| 2696 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 2688 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 2697 EXPECT_EQ(kUploadData, response_data); | 2689 EXPECT_EQ(kUploadData, response_data); |
| 2698 } | 2690 } |
| 2699 | 2691 |
| 2700 // Test a SPDY get through an HTTPS Proxy. | 2692 // Test a SPDY get through an HTTPS Proxy. |
| 2701 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithProxyAuth) { | 2693 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithProxyAuth) { |
| 2702 if (GetParam() > kProtoSPDY3) | |
| 2703 return; | |
| 2704 | |
| 2705 HttpRequestInfo request; | 2694 HttpRequestInfo request; |
| 2706 request.method = "GET"; | 2695 request.method = "GET"; |
| 2707 request.url = GURL("http://www.google.com/"); | 2696 request.url = GURL("http://www.google.com/"); |
| 2708 request.load_flags = 0; | 2697 request.load_flags = 0; |
| 2709 | 2698 |
| 2710 // Configure against https proxy server "myproxy:70". | 2699 // Configure against https proxy server "myproxy:70". |
| 2711 session_deps_.proxy_service.reset( | 2700 session_deps_.proxy_service.reset( |
| 2712 ProxyService::CreateFixed("https://myproxy:70")); | 2701 ProxyService::CreateFixed("https://myproxy:70")); |
| 2713 CapturingBoundNetLog log; | 2702 CapturingBoundNetLog log; |
| 2714 session_deps_.net_log = log.bound().net_log(); | 2703 session_deps_.net_log = log.bound().net_log(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2798 | 2787 |
| 2799 ASSERT_TRUE(response_restart != NULL); | 2788 ASSERT_TRUE(response_restart != NULL); |
| 2800 ASSERT_TRUE(response_restart->headers.get() != NULL); | 2789 ASSERT_TRUE(response_restart->headers.get() != NULL); |
| 2801 EXPECT_EQ(200, response_restart->headers->response_code()); | 2790 EXPECT_EQ(200, response_restart->headers->response_code()); |
| 2802 // The password prompt info should not be set. | 2791 // The password prompt info should not be set. |
| 2803 EXPECT_TRUE(response_restart->auth_challenge.get() == NULL); | 2792 EXPECT_TRUE(response_restart->auth_challenge.get() == NULL); |
| 2804 } | 2793 } |
| 2805 | 2794 |
| 2806 // Test a SPDY CONNECT through an HTTPS Proxy to an HTTPS (non-SPDY) Server. | 2795 // Test a SPDY CONNECT through an HTTPS Proxy to an HTTPS (non-SPDY) Server. |
| 2807 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectHttps) { | 2796 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectHttps) { |
| 2808 if (GetParam() > kProtoSPDY3) | |
| 2809 return; | |
| 2810 | |
| 2811 HttpRequestInfo request; | 2797 HttpRequestInfo request; |
| 2812 request.method = "GET"; | 2798 request.method = "GET"; |
| 2813 request.url = GURL("https://www.google.com/"); | 2799 request.url = GURL("https://www.google.com/"); |
| 2814 request.load_flags = 0; | 2800 request.load_flags = 0; |
| 2815 | 2801 |
| 2816 // Configure against https proxy server "proxy:70". | 2802 // Configure against https proxy server "proxy:70". |
| 2817 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 2803 session_deps_.proxy_service.reset(ProxyService::CreateFixed( |
| 2818 "https://proxy:70")); | 2804 "https://proxy:70")); |
| 2819 CapturingBoundNetLog log; | 2805 CapturingBoundNetLog log; |
| 2820 session_deps_.net_log = log.bound().net_log(); | 2806 session_deps_.net_log = log.bound().net_log(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2887 ASSERT_TRUE(response->headers.get() != NULL); | 2873 ASSERT_TRUE(response->headers.get() != NULL); |
| 2888 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 2874 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 2889 | 2875 |
| 2890 std::string response_data; | 2876 std::string response_data; |
| 2891 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 2877 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 2892 EXPECT_EQ("1234567890", response_data); | 2878 EXPECT_EQ("1234567890", response_data); |
| 2893 } | 2879 } |
| 2894 | 2880 |
| 2895 // Test a SPDY CONNECT through an HTTPS Proxy to a SPDY server. | 2881 // Test a SPDY CONNECT through an HTTPS Proxy to a SPDY server. |
| 2896 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectSpdy) { | 2882 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectSpdy) { |
| 2897 if (GetParam() > kProtoSPDY3) | |
| 2898 return; | |
| 2899 | |
| 2900 HttpRequestInfo request; | 2883 HttpRequestInfo request; |
| 2901 request.method = "GET"; | 2884 request.method = "GET"; |
| 2902 request.url = GURL("https://www.google.com/"); | 2885 request.url = GURL("https://www.google.com/"); |
| 2903 request.load_flags = 0; | 2886 request.load_flags = 0; |
| 2904 | 2887 |
| 2905 // Configure against https proxy server "proxy:70". | 2888 // Configure against https proxy server "proxy:70". |
| 2906 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 2889 session_deps_.proxy_service.reset(ProxyService::CreateFixed( |
| 2907 "https://proxy:70")); | 2890 "https://proxy:70")); |
| 2908 CapturingBoundNetLog log; | 2891 CapturingBoundNetLog log; |
| 2909 session_deps_.net_log = log.bound().net_log(); | 2892 session_deps_.net_log = log.bound().net_log(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2978 ASSERT_TRUE(response->headers.get() != NULL); | 2961 ASSERT_TRUE(response->headers.get() != NULL); |
| 2979 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 2962 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 2980 | 2963 |
| 2981 std::string response_data; | 2964 std::string response_data; |
| 2982 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 2965 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 2983 EXPECT_EQ(kUploadData, response_data); | 2966 EXPECT_EQ(kUploadData, response_data); |
| 2984 } | 2967 } |
| 2985 | 2968 |
| 2986 // Test a SPDY CONNECT failure through an HTTPS Proxy. | 2969 // Test a SPDY CONNECT failure through an HTTPS Proxy. |
| 2987 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectFailure) { | 2970 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectFailure) { |
| 2988 if (GetParam() > kProtoSPDY3) | |
| 2989 return; | |
| 2990 | |
| 2991 HttpRequestInfo request; | 2971 HttpRequestInfo request; |
| 2992 request.method = "GET"; | 2972 request.method = "GET"; |
| 2993 request.url = GURL("https://www.google.com/"); | 2973 request.url = GURL("https://www.google.com/"); |
| 2994 request.load_flags = 0; | 2974 request.load_flags = 0; |
| 2995 | 2975 |
| 2996 // Configure against https proxy server "proxy:70". | 2976 // Configure against https proxy server "proxy:70". |
| 2997 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 2977 session_deps_.proxy_service.reset(ProxyService::CreateFixed( |
| 2998 "https://proxy:70")); | 2978 "https://proxy:70")); |
| 2999 CapturingBoundNetLog log; | 2979 CapturingBoundNetLog log; |
| 3000 session_deps_.net_log = log.bound().net_log(); | 2980 session_deps_.net_log = log.bound().net_log(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3040 rv = callback1.WaitForResult(); | 3020 rv = callback1.WaitForResult(); |
| 3041 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | 3021 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
| 3042 | 3022 |
| 3043 // TODO(ttuttle): Anything else to check here? | 3023 // TODO(ttuttle): Anything else to check here? |
| 3044 } | 3024 } |
| 3045 | 3025 |
| 3046 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY | 3026 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY |
| 3047 // HTTPS Proxy to different servers. | 3027 // HTTPS Proxy to different servers. |
| 3048 TEST_P(HttpNetworkTransactionTest, | 3028 TEST_P(HttpNetworkTransactionTest, |
| 3049 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsTwoServers) { | 3029 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsTwoServers) { |
| 3050 if (GetParam() > kProtoSPDY3) | |
| 3051 return; | |
| 3052 | |
| 3053 // Configure against https proxy server "proxy:70". | 3030 // Configure against https proxy server "proxy:70". |
| 3054 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3031 session_deps_.proxy_service.reset(ProxyService::CreateFixed( |
| 3055 "https://proxy:70")); | 3032 "https://proxy:70")); |
| 3056 CapturingBoundNetLog log; | 3033 CapturingBoundNetLog log; |
| 3057 session_deps_.net_log = log.bound().net_log(); | 3034 session_deps_.net_log = log.bound().net_log(); |
| 3058 scoped_refptr<HttpNetworkSession> session( | 3035 scoped_refptr<HttpNetworkSession> session( |
| 3059 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); | 3036 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); |
| 3060 | 3037 |
| 3061 HttpRequestInfo request1; | 3038 HttpRequestInfo request1; |
| 3062 request1.method = "GET"; | 3039 request1.method = "GET"; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3201 // separate stream. | 3178 // separate stream. |
| 3202 EXPECT_NE(load_timing_info.socket_log_id, load_timing_info2.socket_log_id); | 3179 EXPECT_NE(load_timing_info.socket_log_id, load_timing_info2.socket_log_id); |
| 3203 | 3180 |
| 3204 EXPECT_EQ(2, trans2->Read(buf.get(), 256, callback.callback())); | 3181 EXPECT_EQ(2, trans2->Read(buf.get(), 256, callback.callback())); |
| 3205 } | 3182 } |
| 3206 | 3183 |
| 3207 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY | 3184 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY |
| 3208 // HTTPS Proxy to the same server. | 3185 // HTTPS Proxy to the same server. |
| 3209 TEST_P(HttpNetworkTransactionTest, | 3186 TEST_P(HttpNetworkTransactionTest, |
| 3210 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsSameServer) { | 3187 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsSameServer) { |
| 3211 if (GetParam() > kProtoSPDY3) | |
| 3212 return; | |
| 3213 | |
| 3214 // Configure against https proxy server "proxy:70". | 3188 // Configure against https proxy server "proxy:70". |
| 3215 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3189 session_deps_.proxy_service.reset(ProxyService::CreateFixed( |
| 3216 "https://proxy:70")); | 3190 "https://proxy:70")); |
| 3217 CapturingBoundNetLog log; | 3191 CapturingBoundNetLog log; |
| 3218 session_deps_.net_log = log.bound().net_log(); | 3192 session_deps_.net_log = log.bound().net_log(); |
| 3219 scoped_refptr<HttpNetworkSession> session( | 3193 scoped_refptr<HttpNetworkSession> session( |
| 3220 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); | 3194 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); |
| 3221 | 3195 |
| 3222 HttpRequestInfo request1; | 3196 HttpRequestInfo request1; |
| 3223 request1.method = "GET"; | 3197 request1.method = "GET"; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3334 // The requests should have the same ID. | 3308 // The requests should have the same ID. |
| 3335 EXPECT_EQ(load_timing_info.socket_log_id, load_timing_info2.socket_log_id); | 3309 EXPECT_EQ(load_timing_info.socket_log_id, load_timing_info2.socket_log_id); |
| 3336 | 3310 |
| 3337 EXPECT_EQ(2, trans2->Read(buf.get(), 256, callback.callback())); | 3311 EXPECT_EQ(2, trans2->Read(buf.get(), 256, callback.callback())); |
| 3338 } | 3312 } |
| 3339 | 3313 |
| 3340 // Test load timing in the case of of two HTTP requests through a SPDY HTTPS | 3314 // Test load timing in the case of of two HTTP requests through a SPDY HTTPS |
| 3341 // Proxy to different servers. | 3315 // Proxy to different servers. |
| 3342 TEST_P(HttpNetworkTransactionTest, | 3316 TEST_P(HttpNetworkTransactionTest, |
| 3343 HttpsProxySpdyLoadTimingTwoHttpRequests) { | 3317 HttpsProxySpdyLoadTimingTwoHttpRequests) { |
| 3344 if (GetParam() > kProtoSPDY3) | |
| 3345 return; | |
| 3346 | |
| 3347 // Configure against https proxy server "proxy:70". | 3318 // Configure against https proxy server "proxy:70". |
| 3348 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3319 session_deps_.proxy_service.reset(ProxyService::CreateFixed( |
| 3349 "https://proxy:70")); | 3320 "https://proxy:70")); |
| 3350 CapturingBoundNetLog log; | 3321 CapturingBoundNetLog log; |
| 3351 session_deps_.net_log = log.bound().net_log(); | 3322 session_deps_.net_log = log.bound().net_log(); |
| 3352 scoped_refptr<HttpNetworkSession> session( | 3323 scoped_refptr<HttpNetworkSession> session( |
| 3353 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); | 3324 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); |
| 3354 | 3325 |
| 3355 HttpRequestInfo request1; | 3326 HttpRequestInfo request1; |
| 3356 request1.method = "GET"; | 3327 request1.method = "GET"; |
| (...skipping 2342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5699 load_timing_info.connect_timing, | 5670 load_timing_info.connect_timing, |
| 5700 CONNECT_TIMING_HAS_DNS_TIMES | CONNECT_TIMING_HAS_SSL_TIMES); | 5671 CONNECT_TIMING_HAS_DNS_TIMES | CONNECT_TIMING_HAS_SSL_TIMES); |
| 5701 | 5672 |
| 5702 EXPECT_TRUE(load_timing_info.send_start.is_null()); | 5673 EXPECT_TRUE(load_timing_info.send_start.is_null()); |
| 5703 EXPECT_TRUE(load_timing_info.send_end.is_null()); | 5674 EXPECT_TRUE(load_timing_info.send_end.is_null()); |
| 5704 EXPECT_TRUE(load_timing_info.receive_headers_end.is_null()); | 5675 EXPECT_TRUE(load_timing_info.receive_headers_end.is_null()); |
| 5705 } | 5676 } |
| 5706 | 5677 |
| 5707 // Test an HTTPS (SPDY) Proxy's ability to redirect a CONNECT request | 5678 // Test an HTTPS (SPDY) Proxy's ability to redirect a CONNECT request |
| 5708 TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaSpdyProxy) { | 5679 TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaSpdyProxy) { |
| 5709 if (GetParam() > kProtoSPDY3) | |
| 5710 return; | |
| 5711 | |
| 5712 session_deps_.proxy_service.reset( | 5680 session_deps_.proxy_service.reset( |
| 5713 ProxyService::CreateFixed("https://proxy:70")); | 5681 ProxyService::CreateFixed("https://proxy:70")); |
| 5714 | 5682 |
| 5715 HttpRequestInfo request; | 5683 HttpRequestInfo request; |
| 5716 request.method = "GET"; | 5684 request.method = "GET"; |
| 5717 request.url = GURL("https://www.google.com/"); | 5685 request.url = GURL("https://www.google.com/"); |
| 5718 request.load_flags = 0; | 5686 request.load_flags = 0; |
| 5719 | 5687 |
| 5720 scoped_ptr<SpdyFrame> conn(spdy_util_.ConstructSpdyConnect(NULL, 0, 1)); | 5688 scoped_ptr<SpdyFrame> conn(spdy_util_.ConstructSpdyConnect(NULL, 0, 1)); |
| 5721 scoped_ptr<SpdyFrame> goaway( | 5689 scoped_ptr<SpdyFrame> goaway( |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5810 | 5778 |
| 5811 rv = callback.WaitForResult(); | 5779 rv = callback.WaitForResult(); |
| 5812 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | 5780 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
| 5813 | 5781 |
| 5814 // TODO(ttuttle): Anything else to check here? | 5782 // TODO(ttuttle): Anything else to check here? |
| 5815 } | 5783 } |
| 5816 | 5784 |
| 5817 // Test that a SPDY proxy's response to a CONNECT request is filtered. | 5785 // Test that a SPDY proxy's response to a CONNECT request is filtered. |
| 5818 TEST_P(HttpNetworkTransactionTest, | 5786 TEST_P(HttpNetworkTransactionTest, |
| 5819 ErrorResponseToHttpsConnectViaSpdyProxy) { | 5787 ErrorResponseToHttpsConnectViaSpdyProxy) { |
| 5820 if (GetParam() > kProtoSPDY3) | |
| 5821 return; | |
| 5822 | |
| 5823 session_deps_.proxy_service.reset( | 5788 session_deps_.proxy_service.reset( |
| 5824 ProxyService::CreateFixed("https://proxy:70")); | 5789 ProxyService::CreateFixed("https://proxy:70")); |
| 5825 | 5790 |
| 5826 HttpRequestInfo request; | 5791 HttpRequestInfo request; |
| 5827 request.method = "GET"; | 5792 request.method = "GET"; |
| 5828 request.url = GURL("https://www.google.com/"); | 5793 request.url = GURL("https://www.google.com/"); |
| 5829 request.load_flags = 0; | 5794 request.load_flags = 0; |
| 5830 | 5795 |
| 5831 scoped_ptr<SpdyFrame> conn(spdy_util_.ConstructSpdyConnect(NULL, 0, 1)); | 5796 scoped_ptr<SpdyFrame> conn(spdy_util_.ConstructSpdyConnect(NULL, 0, 1)); |
| 5832 scoped_ptr<SpdyFrame> rst( | 5797 scoped_ptr<SpdyFrame> rst( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5873 | 5838 |
| 5874 rv = callback.WaitForResult(); | 5839 rv = callback.WaitForResult(); |
| 5875 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | 5840 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
| 5876 | 5841 |
| 5877 // TODO(ttuttle): Anything else to check here? | 5842 // TODO(ttuttle): Anything else to check here? |
| 5878 } | 5843 } |
| 5879 | 5844 |
| 5880 // Test the request-challenge-retry sequence for basic auth, through | 5845 // Test the request-challenge-retry sequence for basic auth, through |
| 5881 // a SPDY proxy over a single SPDY session. | 5846 // a SPDY proxy over a single SPDY session. |
| 5882 TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) { | 5847 TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) { |
| 5883 if (GetParam() > kProtoSPDY3) | |
| 5884 return; | |
| 5885 | |
| 5886 HttpRequestInfo request; | 5848 HttpRequestInfo request; |
| 5887 request.method = "GET"; | 5849 request.method = "GET"; |
| 5888 request.url = GURL("https://www.google.com/"); | 5850 request.url = GURL("https://www.google.com/"); |
| 5889 // when the no authentication data flag is set. | 5851 // when the no authentication data flag is set. |
| 5890 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; | 5852 request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA; |
| 5891 | 5853 |
| 5892 // Configure against https proxy server "myproxy:70". | 5854 // Configure against https proxy server "myproxy:70". |
| 5893 session_deps_.proxy_service.reset( | 5855 session_deps_.proxy_service.reset( |
| 5894 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")); | 5856 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")); |
| 5895 CapturingBoundNetLog log; | 5857 CapturingBoundNetLog log; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6024 TestLoadTimingNotReusedWithPac(load_timing_info, | 5986 TestLoadTimingNotReusedWithPac(load_timing_info, |
| 6025 CONNECT_TIMING_HAS_SSL_TIMES); | 5987 CONNECT_TIMING_HAS_SSL_TIMES); |
| 6026 | 5988 |
| 6027 trans.reset(); | 5989 trans.reset(); |
| 6028 session->CloseAllConnections(); | 5990 session->CloseAllConnections(); |
| 6029 } | 5991 } |
| 6030 | 5992 |
| 6031 // Test that an explicitly trusted SPDY proxy can push a resource from an | 5993 // Test that an explicitly trusted SPDY proxy can push a resource from an |
| 6032 // origin that is different from that of its associated resource. | 5994 // origin that is different from that of its associated resource. |
| 6033 TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPush) { | 5995 TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPush) { |
| 6034 if (GetParam() > kProtoSPDY3) | |
| 6035 return; | |
| 6036 | |
| 6037 HttpRequestInfo request; | 5996 HttpRequestInfo request; |
| 6038 HttpRequestInfo push_request; | 5997 HttpRequestInfo push_request; |
| 6039 | 5998 |
| 6040 static const unsigned char kPushBodyFrame[] = { | |
| 6041 0x00, 0x00, 0x00, 0x02, // header, ID | |
| 6042 0x01, 0x00, 0x00, 0x06, // FIN, length | |
| 6043 'p', 'u', 's', 'h', 'e', 'd' // "pushed" | |
| 6044 }; | |
| 6045 | |
| 6046 request.method = "GET"; | 5999 request.method = "GET"; |
| 6047 request.url = GURL("http://www.google.com/"); | 6000 request.url = GURL("http://www.google.com/"); |
| 6048 push_request.method = "GET"; | 6001 push_request.method = "GET"; |
| 6049 push_request.url = GURL("http://www.another-origin.com/foo.dat"); | 6002 push_request.url = GURL("http://www.another-origin.com/foo.dat"); |
| 6050 | 6003 |
| 6051 // Configure against https proxy server "myproxy:70". | 6004 // Configure against https proxy server "myproxy:70". |
| 6052 session_deps_.proxy_service.reset( | 6005 session_deps_.proxy_service.reset( |
| 6053 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")); | 6006 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")); |
| 6054 CapturingBoundNetLog log; | 6007 CapturingBoundNetLog log; |
| 6055 session_deps_.net_log = log.bound().net_log(); | 6008 session_deps_.net_log = log.bound().net_log(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 6071 | 6024 |
| 6072 scoped_ptr<SpdyFrame> | 6025 scoped_ptr<SpdyFrame> |
| 6073 stream1_body(spdy_util_.ConstructSpdyBodyFrame(1, true)); | 6026 stream1_body(spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 6074 | 6027 |
| 6075 scoped_ptr<SpdyFrame> | 6028 scoped_ptr<SpdyFrame> |
| 6076 stream2_syn(spdy_util_.ConstructSpdyPush(NULL, | 6029 stream2_syn(spdy_util_.ConstructSpdyPush(NULL, |
| 6077 0, | 6030 0, |
| 6078 2, | 6031 2, |
| 6079 1, | 6032 1, |
| 6080 "http://www.another-origin.com/foo.dat")); | 6033 "http://www.another-origin.com/foo.dat")); |
| 6034 const char kPushedData[] = "pushed"; |
| 6035 scoped_ptr<SpdyFrame> stream2_body( |
| 6036 spdy_util_.ConstructSpdyBodyFrame( |
| 6037 2, kPushedData, strlen(kPushedData), true)); |
| 6081 | 6038 |
| 6082 MockRead spdy_reads[] = { | 6039 MockRead spdy_reads[] = { |
| 6083 CreateMockRead(*stream1_reply, 2, ASYNC), | 6040 CreateMockRead(*stream1_reply, 2, ASYNC), |
| 6084 CreateMockRead(*stream2_syn, 3, ASYNC), | 6041 CreateMockRead(*stream2_syn, 3, ASYNC), |
| 6085 CreateMockRead(*stream1_body, 4, ASYNC), | 6042 CreateMockRead(*stream1_body, 4, ASYNC), |
| 6086 MockRead(ASYNC, reinterpret_cast<const char*>(kPushBodyFrame), | 6043 CreateMockRead(*stream2_body, 5, ASYNC), |
| 6087 arraysize(kPushBodyFrame), 5), | |
| 6088 MockRead(ASYNC, ERR_IO_PENDING, 6), // Force a pause | 6044 MockRead(ASYNC, ERR_IO_PENDING, 6), // Force a pause |
| 6089 }; | 6045 }; |
| 6090 | 6046 |
| 6091 OrderedSocketData spdy_data( | 6047 OrderedSocketData spdy_data( |
| 6092 spdy_reads, arraysize(spdy_reads), | 6048 spdy_reads, arraysize(spdy_reads), |
| 6093 spdy_writes, arraysize(spdy_writes)); | 6049 spdy_writes, arraysize(spdy_writes)); |
| 6094 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); | 6050 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); |
| 6095 // Negotiate SPDY to the proxy | 6051 // Negotiate SPDY to the proxy |
| 6096 SSLSocketDataProvider proxy(ASYNC, OK); | 6052 SSLSocketDataProvider proxy(ASYNC, OK); |
| 6097 proxy.SetNextProto(GetParam()); | 6053 proxy.SetNextProto(GetParam()); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6148 EXPECT_EQ(load_timing_info.socket_log_id, | 6104 EXPECT_EQ(load_timing_info.socket_log_id, |
| 6149 push_load_timing_info.socket_log_id); | 6105 push_load_timing_info.socket_log_id); |
| 6150 | 6106 |
| 6151 trans.reset(); | 6107 trans.reset(); |
| 6152 push_trans.reset(); | 6108 push_trans.reset(); |
| 6153 session->CloseAllConnections(); | 6109 session->CloseAllConnections(); |
| 6154 } | 6110 } |
| 6155 | 6111 |
| 6156 // Test that an explicitly trusted SPDY proxy cannot push HTTPS content. | 6112 // Test that an explicitly trusted SPDY proxy cannot push HTTPS content. |
| 6157 TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPushCorrectness) { | 6113 TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPushCorrectness) { |
| 6158 if (GetParam() > kProtoSPDY3) | |
| 6159 return; | |
| 6160 | |
| 6161 HttpRequestInfo request; | 6114 HttpRequestInfo request; |
| 6162 | 6115 |
| 6163 request.method = "GET"; | 6116 request.method = "GET"; |
| 6164 request.url = GURL("http://www.google.com/"); | 6117 request.url = GURL("http://www.google.com/"); |
| 6165 | 6118 |
| 6166 // Configure against https proxy server "myproxy:70". | 6119 // Configure against https proxy server "myproxy:70". |
| 6167 session_deps_.proxy_service.reset( | 6120 session_deps_.proxy_service.reset( |
| 6168 ProxyService::CreateFixed("https://myproxy:70")); | 6121 ProxyService::CreateFixed("https://myproxy:70")); |
| 6169 CapturingBoundNetLog log; | 6122 CapturingBoundNetLog log; |
| 6170 session_deps_.net_log = log.bound().net_log(); | 6123 session_deps_.net_log = log.bound().net_log(); |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7047 // Tests that for connection endpoints the group names are correctly set. | 7000 // Tests that for connection endpoints the group names are correctly set. |
| 7048 | 7001 |
| 7049 struct GroupNameTest { | 7002 struct GroupNameTest { |
| 7050 std::string proxy_server; | 7003 std::string proxy_server; |
| 7051 std::string url; | 7004 std::string url; |
| 7052 std::string expected_group_name; | 7005 std::string expected_group_name; |
| 7053 bool ssl; | 7006 bool ssl; |
| 7054 }; | 7007 }; |
| 7055 | 7008 |
| 7056 scoped_refptr<HttpNetworkSession> SetupSessionForGroupNameTests( | 7009 scoped_refptr<HttpNetworkSession> SetupSessionForGroupNameTests( |
| 7010 NextProto next_proto, |
| 7057 SpdySessionDependencies* session_deps_) { | 7011 SpdySessionDependencies* session_deps_) { |
| 7058 scoped_refptr<HttpNetworkSession> session(CreateSession(session_deps_)); | 7012 scoped_refptr<HttpNetworkSession> session(CreateSession(session_deps_)); |
| 7059 | 7013 |
| 7060 HttpServerProperties* http_server_properties = | 7014 HttpServerProperties* http_server_properties = |
| 7061 session->http_server_properties(); | 7015 session->http_server_properties(); |
| 7062 http_server_properties->SetAlternateProtocol( | 7016 http_server_properties->SetAlternateProtocol( |
| 7063 HostPortPair("host.with.alternate", 80), 443, | 7017 HostPortPair("host.with.alternate", 80), 443, |
| 7064 NPN_SPDY_2); | 7018 AlternateProtocolFromNextProto(next_proto)); |
| 7065 | 7019 |
| 7066 return session; | 7020 return session; |
| 7067 } | 7021 } |
| 7068 | 7022 |
| 7069 int GroupNameTransactionHelper( | 7023 int GroupNameTransactionHelper( |
| 7070 const std::string& url, | 7024 const std::string& url, |
| 7071 const scoped_refptr<HttpNetworkSession>& session) { | 7025 const scoped_refptr<HttpNetworkSession>& session) { |
| 7072 HttpRequestInfo request; | 7026 HttpRequestInfo request; |
| 7073 request.method = "GET"; | 7027 request.method = "GET"; |
| 7074 request.url = GURL(url); | 7028 request.url = GURL(url); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7120 true, | 7074 true, |
| 7121 }, | 7075 }, |
| 7122 }; | 7076 }; |
| 7123 | 7077 |
| 7124 HttpStreamFactory::set_use_alternate_protocols(true); | 7078 HttpStreamFactory::set_use_alternate_protocols(true); |
| 7125 | 7079 |
| 7126 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 7080 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
| 7127 session_deps_.proxy_service.reset( | 7081 session_deps_.proxy_service.reset( |
| 7128 ProxyService::CreateFixed(tests[i].proxy_server)); | 7082 ProxyService::CreateFixed(tests[i].proxy_server)); |
| 7129 scoped_refptr<HttpNetworkSession> session( | 7083 scoped_refptr<HttpNetworkSession> session( |
| 7130 SetupSessionForGroupNameTests(&session_deps_)); | 7084 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
| 7131 | 7085 |
| 7132 HttpNetworkSessionPeer peer(session); | 7086 HttpNetworkSessionPeer peer(session); |
| 7133 CaptureGroupNameTransportSocketPool* transport_conn_pool = | 7087 CaptureGroupNameTransportSocketPool* transport_conn_pool = |
| 7134 new CaptureGroupNameTransportSocketPool(NULL, NULL); | 7088 new CaptureGroupNameTransportSocketPool(NULL, NULL); |
| 7135 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 7089 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
| 7136 new CaptureGroupNameSSLSocketPool(NULL, NULL); | 7090 new CaptureGroupNameSSLSocketPool(NULL, NULL); |
| 7137 MockClientSocketPoolManager* mock_pool_manager = | 7091 MockClientSocketPoolManager* mock_pool_manager = |
| 7138 new MockClientSocketPoolManager; | 7092 new MockClientSocketPoolManager; |
| 7139 mock_pool_manager->SetTransportSocketPool(transport_conn_pool); | 7093 mock_pool_manager->SetTransportSocketPool(transport_conn_pool); |
| 7140 mock_pool_manager->SetSSLSocketPool(ssl_conn_pool); | 7094 mock_pool_manager->SetSSLSocketPool(ssl_conn_pool); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7183 false, | 7137 false, |
| 7184 }, | 7138 }, |
| 7185 }; | 7139 }; |
| 7186 | 7140 |
| 7187 HttpStreamFactory::set_use_alternate_protocols(true); | 7141 HttpStreamFactory::set_use_alternate_protocols(true); |
| 7188 | 7142 |
| 7189 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 7143 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
| 7190 session_deps_.proxy_service.reset( | 7144 session_deps_.proxy_service.reset( |
| 7191 ProxyService::CreateFixed(tests[i].proxy_server)); | 7145 ProxyService::CreateFixed(tests[i].proxy_server)); |
| 7192 scoped_refptr<HttpNetworkSession> session( | 7146 scoped_refptr<HttpNetworkSession> session( |
| 7193 SetupSessionForGroupNameTests(&session_deps_)); | 7147 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
| 7194 | 7148 |
| 7195 HttpNetworkSessionPeer peer(session); | 7149 HttpNetworkSessionPeer peer(session); |
| 7196 | 7150 |
| 7197 HostPortPair proxy_host("http_proxy", 80); | 7151 HostPortPair proxy_host("http_proxy", 80); |
| 7198 CaptureGroupNameHttpProxySocketPool* http_proxy_pool = | 7152 CaptureGroupNameHttpProxySocketPool* http_proxy_pool = |
| 7199 new CaptureGroupNameHttpProxySocketPool(NULL, NULL); | 7153 new CaptureGroupNameHttpProxySocketPool(NULL, NULL); |
| 7200 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 7154 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
| 7201 new CaptureGroupNameSSLSocketPool(NULL, NULL); | 7155 new CaptureGroupNameSSLSocketPool(NULL, NULL); |
| 7202 | 7156 |
| 7203 MockClientSocketPoolManager* mock_pool_manager = | 7157 MockClientSocketPoolManager* mock_pool_manager = |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7253 true, | 7207 true, |
| 7254 }, | 7208 }, |
| 7255 }; | 7209 }; |
| 7256 | 7210 |
| 7257 HttpStreamFactory::set_use_alternate_protocols(true); | 7211 HttpStreamFactory::set_use_alternate_protocols(true); |
| 7258 | 7212 |
| 7259 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 7213 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
| 7260 session_deps_.proxy_service.reset( | 7214 session_deps_.proxy_service.reset( |
| 7261 ProxyService::CreateFixed(tests[i].proxy_server)); | 7215 ProxyService::CreateFixed(tests[i].proxy_server)); |
| 7262 scoped_refptr<HttpNetworkSession> session( | 7216 scoped_refptr<HttpNetworkSession> session( |
| 7263 SetupSessionForGroupNameTests(&session_deps_)); | 7217 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
| 7264 | 7218 |
| 7265 HttpNetworkSessionPeer peer(session); | 7219 HttpNetworkSessionPeer peer(session); |
| 7266 | 7220 |
| 7267 HostPortPair proxy_host("socks_proxy", 1080); | 7221 HostPortPair proxy_host("socks_proxy", 1080); |
| 7268 CaptureGroupNameSOCKSSocketPool* socks_conn_pool = | 7222 CaptureGroupNameSOCKSSocketPool* socks_conn_pool = |
| 7269 new CaptureGroupNameSOCKSSocketPool(NULL, NULL); | 7223 new CaptureGroupNameSOCKSSocketPool(NULL, NULL); |
| 7270 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 7224 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
| 7271 new CaptureGroupNameSSLSocketPool(NULL, NULL); | 7225 new CaptureGroupNameSSLSocketPool(NULL, NULL); |
| 7272 | 7226 |
| 7273 MockClientSocketPoolManager* mock_pool_manager = | 7227 MockClientSocketPoolManager* mock_pool_manager = |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7961 EXPECT_EQ(OK, rv); | 7915 EXPECT_EQ(OK, rv); |
| 7962 response = trans->GetResponseInfo(); | 7916 response = trans->GetResponseInfo(); |
| 7963 ASSERT_TRUE(response != NULL); | 7917 ASSERT_TRUE(response != NULL); |
| 7964 EXPECT_TRUE(response->auth_challenge.get() == NULL); | 7918 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
| 7965 } | 7919 } |
| 7966 | 7920 |
| 7967 TEST_P(HttpNetworkTransactionTest, HonorAlternateProtocolHeader) { | 7921 TEST_P(HttpNetworkTransactionTest, HonorAlternateProtocolHeader) { |
| 7968 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); | 7922 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); |
| 7969 HttpStreamFactory::set_use_alternate_protocols(true); | 7923 HttpStreamFactory::set_use_alternate_protocols(true); |
| 7970 | 7924 |
| 7925 std::string alternate_protocol_http_header = |
| 7926 GetAlternateProtocolHttpHeader(); |
| 7927 |
| 7971 MockRead data_reads[] = { | 7928 MockRead data_reads[] = { |
| 7972 MockRead("HTTP/1.1 200 OK\r\n"), | 7929 MockRead("HTTP/1.1 200 OK\r\n"), |
| 7973 MockRead(kAlternateProtocolHttpHeader), | 7930 MockRead(alternate_protocol_http_header.c_str()), |
| 7974 MockRead("hello world"), | 7931 MockRead("hello world"), |
| 7975 MockRead(SYNCHRONOUS, OK), | 7932 MockRead(SYNCHRONOUS, OK), |
| 7976 }; | 7933 }; |
| 7977 | 7934 |
| 7978 HttpRequestInfo request; | 7935 HttpRequestInfo request; |
| 7979 request.method = "GET"; | 7936 request.method = "GET"; |
| 7980 request.url = GURL("http://www.google.com/"); | 7937 request.url = GURL("http://www.google.com/"); |
| 7981 request.load_flags = 0; | 7938 request.load_flags = 0; |
| 7982 | 7939 |
| 7983 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 7940 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 8010 | 7967 |
| 8011 std::string response_data; | 7968 std::string response_data; |
| 8012 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 7969 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 8013 EXPECT_EQ("hello world", response_data); | 7970 EXPECT_EQ("hello world", response_data); |
| 8014 | 7971 |
| 8015 ASSERT_TRUE(http_server_properties.HasAlternateProtocol(http_host_port_pair)); | 7972 ASSERT_TRUE(http_server_properties.HasAlternateProtocol(http_host_port_pair)); |
| 8016 const PortAlternateProtocolPair alternate = | 7973 const PortAlternateProtocolPair alternate = |
| 8017 http_server_properties.GetAlternateProtocol(http_host_port_pair); | 7974 http_server_properties.GetAlternateProtocol(http_host_port_pair); |
| 8018 PortAlternateProtocolPair expected_alternate; | 7975 PortAlternateProtocolPair expected_alternate; |
| 8019 expected_alternate.port = 443; | 7976 expected_alternate.port = 443; |
| 8020 expected_alternate.protocol = NPN_SPDY_2; | 7977 expected_alternate.protocol = AlternateProtocolFromNextProto(GetParam()); |
| 8021 EXPECT_TRUE(expected_alternate.Equals(alternate)); | 7978 EXPECT_TRUE(expected_alternate.Equals(alternate)); |
| 8022 | 7979 |
| 8023 HttpStreamFactory::SetNextProtos(std::vector<std::string>()); | 7980 HttpStreamFactory::SetNextProtos(std::vector<std::string>()); |
| 8024 } | 7981 } |
| 8025 | 7982 |
| 8026 TEST_P(HttpNetworkTransactionTest, | 7983 TEST_P(HttpNetworkTransactionTest, |
| 8027 MarkBrokenAlternateProtocolAndFallback) { | 7984 MarkBrokenAlternateProtocolAndFallback) { |
| 8028 HttpStreamFactory::set_use_alternate_protocols(true); | 7985 HttpStreamFactory::set_use_alternate_protocols(true); |
| 8029 | 7986 |
| 8030 HttpRequestInfo request; | 7987 HttpRequestInfo request; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 8048 | 8005 |
| 8049 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8006 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8050 | 8007 |
| 8051 HttpServerProperties* http_server_properties = | 8008 HttpServerProperties* http_server_properties = |
| 8052 session->http_server_properties(); | 8009 session->http_server_properties(); |
| 8053 // Port must be < 1024, or the header will be ignored (since initial port was | 8010 // Port must be < 1024, or the header will be ignored (since initial port was |
| 8054 // port 80 (another restricted port). | 8011 // port 80 (another restricted port). |
| 8055 http_server_properties->SetAlternateProtocol( | 8012 http_server_properties->SetAlternateProtocol( |
| 8056 HostPortPair::FromURL(request.url), | 8013 HostPortPair::FromURL(request.url), |
| 8057 666 /* port is ignored by MockConnect anyway */, | 8014 666 /* port is ignored by MockConnect anyway */, |
| 8058 NPN_SPDY_2); | 8015 AlternateProtocolFromNextProto(GetParam())); |
| 8059 | 8016 |
| 8060 scoped_ptr<HttpTransaction> trans( | 8017 scoped_ptr<HttpTransaction> trans( |
| 8061 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8018 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8062 TestCompletionCallback callback; | 8019 TestCompletionCallback callback; |
| 8063 | 8020 |
| 8064 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8021 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8065 EXPECT_EQ(ERR_IO_PENDING, rv); | 8022 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8066 EXPECT_EQ(OK, callback.WaitForResult()); | 8023 EXPECT_EQ(OK, callback.WaitForResult()); |
| 8067 | 8024 |
| 8068 const HttpResponseInfo* response = trans->GetResponseInfo(); | 8025 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8110 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 8067 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 8111 | 8068 |
| 8112 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8069 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8113 | 8070 |
| 8114 HttpServerProperties* http_server_properties = | 8071 HttpServerProperties* http_server_properties = |
| 8115 session->http_server_properties(); | 8072 session->http_server_properties(); |
| 8116 const int kUnrestrictedAlternatePort = 1024; | 8073 const int kUnrestrictedAlternatePort = 1024; |
| 8117 http_server_properties->SetAlternateProtocol( | 8074 http_server_properties->SetAlternateProtocol( |
| 8118 HostPortPair::FromURL(restricted_port_request.url), | 8075 HostPortPair::FromURL(restricted_port_request.url), |
| 8119 kUnrestrictedAlternatePort, | 8076 kUnrestrictedAlternatePort, |
| 8120 NPN_SPDY_2); | 8077 AlternateProtocolFromNextProto(GetParam())); |
| 8121 | 8078 |
| 8122 scoped_ptr<HttpTransaction> trans( | 8079 scoped_ptr<HttpTransaction> trans( |
| 8123 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8080 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8124 TestCompletionCallback callback; | 8081 TestCompletionCallback callback; |
| 8125 | 8082 |
| 8126 int rv = trans->Start( | 8083 int rv = trans->Start( |
| 8127 &restricted_port_request, | 8084 &restricted_port_request, |
| 8128 callback.callback(), BoundNetLog()); | 8085 callback.callback(), BoundNetLog()); |
| 8129 EXPECT_EQ(ERR_IO_PENDING, rv); | 8086 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8130 // Invalid change to unrestricted port should fail. | 8087 // Invalid change to unrestricted port should fail. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 8161 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 8118 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 8162 | 8119 |
| 8163 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8120 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8164 | 8121 |
| 8165 HttpServerProperties* http_server_properties = | 8122 HttpServerProperties* http_server_properties = |
| 8166 session->http_server_properties(); | 8123 session->http_server_properties(); |
| 8167 const int kUnrestrictedAlternatePort = 1024; | 8124 const int kUnrestrictedAlternatePort = 1024; |
| 8168 http_server_properties->SetAlternateProtocol( | 8125 http_server_properties->SetAlternateProtocol( |
| 8169 HostPortPair::FromURL(restricted_port_request.url), | 8126 HostPortPair::FromURL(restricted_port_request.url), |
| 8170 kUnrestrictedAlternatePort, | 8127 kUnrestrictedAlternatePort, |
| 8171 NPN_SPDY_3); | 8128 AlternateProtocolFromNextProto(GetParam())); |
| 8172 | 8129 |
| 8173 scoped_ptr<HttpTransaction> trans( | 8130 scoped_ptr<HttpTransaction> trans( |
| 8174 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8131 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8175 TestCompletionCallback callback; | 8132 TestCompletionCallback callback; |
| 8176 | 8133 |
| 8177 EXPECT_EQ(ERR_IO_PENDING, trans->Start( | 8134 EXPECT_EQ(ERR_IO_PENDING, trans->Start( |
| 8178 &restricted_port_request, | 8135 &restricted_port_request, |
| 8179 callback.callback(), BoundNetLog())); | 8136 callback.callback(), BoundNetLog())); |
| 8180 // Change to unrestricted port should succeed. | 8137 // Change to unrestricted port should succeed. |
| 8181 EXPECT_EQ(OK, callback.WaitForResult()); | 8138 EXPECT_EQ(OK, callback.WaitForResult()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 8209 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 8166 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 8210 | 8167 |
| 8211 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8168 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8212 | 8169 |
| 8213 HttpServerProperties* http_server_properties = | 8170 HttpServerProperties* http_server_properties = |
| 8214 session->http_server_properties(); | 8171 session->http_server_properties(); |
| 8215 const int kRestrictedAlternatePort = 80; | 8172 const int kRestrictedAlternatePort = 80; |
| 8216 http_server_properties->SetAlternateProtocol( | 8173 http_server_properties->SetAlternateProtocol( |
| 8217 HostPortPair::FromURL(restricted_port_request.url), | 8174 HostPortPair::FromURL(restricted_port_request.url), |
| 8218 kRestrictedAlternatePort, | 8175 kRestrictedAlternatePort, |
| 8219 NPN_SPDY_2); | 8176 AlternateProtocolFromNextProto(GetParam())); |
| 8220 | 8177 |
| 8221 scoped_ptr<HttpTransaction> trans( | 8178 scoped_ptr<HttpTransaction> trans( |
| 8222 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8179 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8223 TestCompletionCallback callback; | 8180 TestCompletionCallback callback; |
| 8224 | 8181 |
| 8225 int rv = trans->Start( | 8182 int rv = trans->Start( |
| 8226 &restricted_port_request, | 8183 &restricted_port_request, |
| 8227 callback.callback(), BoundNetLog()); | 8184 callback.callback(), BoundNetLog()); |
| 8228 EXPECT_EQ(ERR_IO_PENDING, rv); | 8185 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8229 // Valid change to restricted port should pass. | 8186 // Valid change to restricted port should pass. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 8258 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 8215 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 8259 | 8216 |
| 8260 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8217 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8261 | 8218 |
| 8262 HttpServerProperties* http_server_properties = | 8219 HttpServerProperties* http_server_properties = |
| 8263 session->http_server_properties(); | 8220 session->http_server_properties(); |
| 8264 const int kRestrictedAlternatePort = 80; | 8221 const int kRestrictedAlternatePort = 80; |
| 8265 http_server_properties->SetAlternateProtocol( | 8222 http_server_properties->SetAlternateProtocol( |
| 8266 HostPortPair::FromURL(unrestricted_port_request.url), | 8223 HostPortPair::FromURL(unrestricted_port_request.url), |
| 8267 kRestrictedAlternatePort, | 8224 kRestrictedAlternatePort, |
| 8268 NPN_SPDY_2); | 8225 AlternateProtocolFromNextProto(GetParam())); |
| 8269 | 8226 |
| 8270 scoped_ptr<HttpTransaction> trans( | 8227 scoped_ptr<HttpTransaction> trans( |
| 8271 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8228 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8272 TestCompletionCallback callback; | 8229 TestCompletionCallback callback; |
| 8273 | 8230 |
| 8274 int rv = trans->Start( | 8231 int rv = trans->Start( |
| 8275 &unrestricted_port_request, callback.callback(), BoundNetLog()); | 8232 &unrestricted_port_request, callback.callback(), BoundNetLog()); |
| 8276 EXPECT_EQ(ERR_IO_PENDING, rv); | 8233 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8277 // Valid change to restricted port should pass. | 8234 // Valid change to restricted port should pass. |
| 8278 EXPECT_EQ(OK, callback.WaitForResult()); | 8235 EXPECT_EQ(OK, callback.WaitForResult()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 8306 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 8263 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 8307 | 8264 |
| 8308 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8265 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8309 | 8266 |
| 8310 HttpServerProperties* http_server_properties = | 8267 HttpServerProperties* http_server_properties = |
| 8311 session->http_server_properties(); | 8268 session->http_server_properties(); |
| 8312 const int kUnrestrictedAlternatePort = 1024; | 8269 const int kUnrestrictedAlternatePort = 1024; |
| 8313 http_server_properties->SetAlternateProtocol( | 8270 http_server_properties->SetAlternateProtocol( |
| 8314 HostPortPair::FromURL(unrestricted_port_request.url), | 8271 HostPortPair::FromURL(unrestricted_port_request.url), |
| 8315 kUnrestrictedAlternatePort, | 8272 kUnrestrictedAlternatePort, |
| 8316 NPN_SPDY_2); | 8273 AlternateProtocolFromNextProto(GetParam())); |
| 8317 | 8274 |
| 8318 scoped_ptr<HttpTransaction> trans( | 8275 scoped_ptr<HttpTransaction> trans( |
| 8319 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8276 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8320 TestCompletionCallback callback; | 8277 TestCompletionCallback callback; |
| 8321 | 8278 |
| 8322 int rv = trans->Start( | 8279 int rv = trans->Start( |
| 8323 &unrestricted_port_request, callback.callback(), BoundNetLog()); | 8280 &unrestricted_port_request, callback.callback(), BoundNetLog()); |
| 8324 EXPECT_EQ(ERR_IO_PENDING, rv); | 8281 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8325 // Valid change to an unrestricted port should pass. | 8282 // Valid change to an unrestricted port should pass. |
| 8326 EXPECT_EQ(OK, callback.WaitForResult()); | 8283 EXPECT_EQ(OK, callback.WaitForResult()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 8350 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8307 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8351 | 8308 |
| 8352 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8309 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8353 | 8310 |
| 8354 HttpServerProperties* http_server_properties = | 8311 HttpServerProperties* http_server_properties = |
| 8355 session->http_server_properties(); | 8312 session->http_server_properties(); |
| 8356 const int kUnsafePort = 7; | 8313 const int kUnsafePort = 7; |
| 8357 http_server_properties->SetAlternateProtocol( | 8314 http_server_properties->SetAlternateProtocol( |
| 8358 HostPortPair::FromURL(request.url), | 8315 HostPortPair::FromURL(request.url), |
| 8359 kUnsafePort, | 8316 kUnsafePort, |
| 8360 NPN_SPDY_2); | 8317 AlternateProtocolFromNextProto(GetParam())); |
| 8361 | 8318 |
| 8362 scoped_ptr<HttpTransaction> trans( | 8319 scoped_ptr<HttpTransaction> trans( |
| 8363 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8320 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8364 TestCompletionCallback callback; | 8321 TestCompletionCallback callback; |
| 8365 | 8322 |
| 8366 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8323 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8367 EXPECT_EQ(ERR_IO_PENDING, rv); | 8324 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8368 // The HTTP request should succeed. | 8325 // The HTTP request should succeed. |
| 8369 EXPECT_EQ(OK, callback.WaitForResult()); | 8326 EXPECT_EQ(OK, callback.WaitForResult()); |
| 8370 | 8327 |
| 8371 // Disable alternate protocol before the asserts. | 8328 // Disable alternate protocol before the asserts. |
| 8372 HttpStreamFactory::set_use_alternate_protocols(false); | 8329 HttpStreamFactory::set_use_alternate_protocols(false); |
| 8373 | 8330 |
| 8374 const HttpResponseInfo* response = trans->GetResponseInfo(); | 8331 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 8375 ASSERT_TRUE(response != NULL); | 8332 ASSERT_TRUE(response != NULL); |
| 8376 ASSERT_TRUE(response->headers.get() != NULL); | 8333 ASSERT_TRUE(response->headers.get() != NULL); |
| 8377 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 8334 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 8378 | 8335 |
| 8379 std::string response_data; | 8336 std::string response_data; |
| 8380 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 8337 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 8381 EXPECT_EQ("hello world", response_data); | 8338 EXPECT_EQ("hello world", response_data); |
| 8382 } | 8339 } |
| 8383 | 8340 |
| 8384 TEST_P(HttpNetworkTransactionTest, UseAlternateProtocolForNpnSpdy) { | 8341 TEST_P(HttpNetworkTransactionTest, UseAlternateProtocolForNpnSpdy) { |
| 8385 if (GetParam() > kProtoSPDY3) | |
| 8386 return; | |
| 8387 | |
| 8388 HttpStreamFactory::set_use_alternate_protocols(true); | 8342 HttpStreamFactory::set_use_alternate_protocols(true); |
| 8389 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); | 8343 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); |
| 8390 | 8344 |
| 8391 HttpRequestInfo request; | 8345 HttpRequestInfo request; |
| 8392 request.method = "GET"; | 8346 request.method = "GET"; |
| 8393 request.url = GURL("http://www.google.com/"); | 8347 request.url = GURL("http://www.google.com/"); |
| 8394 request.load_flags = 0; | 8348 request.load_flags = 0; |
| 8395 | 8349 |
| 8350 std::string alternate_protocol_http_header = |
| 8351 GetAlternateProtocolHttpHeader(); |
| 8352 |
| 8396 MockRead data_reads[] = { | 8353 MockRead data_reads[] = { |
| 8397 MockRead("HTTP/1.1 200 OK\r\n"), | 8354 MockRead("HTTP/1.1 200 OK\r\n"), |
| 8398 MockRead(kAlternateProtocolHttpHeader), | 8355 MockRead(alternate_protocol_http_header.c_str()), |
| 8399 MockRead("hello world"), | 8356 MockRead("hello world"), |
| 8400 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), | 8357 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), |
| 8401 MockRead(ASYNC, OK) | 8358 MockRead(ASYNC, OK) |
| 8402 }; | 8359 }; |
| 8403 | 8360 |
| 8404 StaticSocketDataProvider first_transaction( | 8361 StaticSocketDataProvider first_transaction( |
| 8405 data_reads, arraysize(data_reads), NULL, 0); | 8362 data_reads, arraysize(data_reads), NULL, 0); |
| 8406 session_deps_.socket_factory->AddSocketDataProvider(&first_transaction); | 8363 session_deps_.socket_factory->AddSocketDataProvider(&first_transaction); |
| 8407 | 8364 |
| 8408 SSLSocketDataProvider ssl(ASYNC, OK); | 8365 SSLSocketDataProvider ssl(ASYNC, OK); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8465 ASSERT_TRUE(response->headers.get() != NULL); | 8422 ASSERT_TRUE(response->headers.get() != NULL); |
| 8466 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 8423 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 8467 EXPECT_TRUE(response->was_fetched_via_spdy); | 8424 EXPECT_TRUE(response->was_fetched_via_spdy); |
| 8468 EXPECT_TRUE(response->was_npn_negotiated); | 8425 EXPECT_TRUE(response->was_npn_negotiated); |
| 8469 | 8426 |
| 8470 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 8427 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 8471 EXPECT_EQ("hello!", response_data); | 8428 EXPECT_EQ("hello!", response_data); |
| 8472 } | 8429 } |
| 8473 | 8430 |
| 8474 TEST_P(HttpNetworkTransactionTest, AlternateProtocolWithSpdyLateBinding) { | 8431 TEST_P(HttpNetworkTransactionTest, AlternateProtocolWithSpdyLateBinding) { |
| 8475 if (GetParam() > kProtoSPDY3) | |
| 8476 return; | |
| 8477 | |
| 8478 HttpStreamFactory::set_use_alternate_protocols(true); | 8432 HttpStreamFactory::set_use_alternate_protocols(true); |
| 8479 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); | 8433 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); |
| 8480 | 8434 |
| 8481 HttpRequestInfo request; | 8435 HttpRequestInfo request; |
| 8482 request.method = "GET"; | 8436 request.method = "GET"; |
| 8483 request.url = GURL("http://www.google.com/"); | 8437 request.url = GURL("http://www.google.com/"); |
| 8484 request.load_flags = 0; | 8438 request.load_flags = 0; |
| 8485 | 8439 |
| 8440 std::string alternate_protocol_http_header = |
| 8441 GetAlternateProtocolHttpHeader(); |
| 8442 |
| 8486 MockRead data_reads[] = { | 8443 MockRead data_reads[] = { |
| 8487 MockRead("HTTP/1.1 200 OK\r\n"), | 8444 MockRead("HTTP/1.1 200 OK\r\n"), |
| 8488 MockRead(kAlternateProtocolHttpHeader), | 8445 MockRead(alternate_protocol_http_header.c_str()), |
| 8489 MockRead("hello world"), | 8446 MockRead("hello world"), |
| 8490 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), | 8447 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), |
| 8491 MockRead(ASYNC, OK), | 8448 MockRead(ASYNC, OK), |
| 8492 }; | 8449 }; |
| 8493 | 8450 |
| 8494 StaticSocketDataProvider first_transaction( | 8451 StaticSocketDataProvider first_transaction( |
| 8495 data_reads, arraysize(data_reads), NULL, 0); | 8452 data_reads, arraysize(data_reads), NULL, 0); |
| 8496 // Socket 1 is the HTTP transaction with the Alternate-Protocol header. | 8453 // Socket 1 is the HTTP transaction with the Alternate-Protocol header. |
| 8497 session_deps_.socket_factory->AddSocketDataProvider(&first_transaction); | 8454 session_deps_.socket_factory->AddSocketDataProvider(&first_transaction); |
| 8498 | 8455 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8590 | 8547 |
| 8591 TEST_P(HttpNetworkTransactionTest, StallAlternateProtocolForNpnSpdy) { | 8548 TEST_P(HttpNetworkTransactionTest, StallAlternateProtocolForNpnSpdy) { |
| 8592 HttpStreamFactory::set_use_alternate_protocols(true); | 8549 HttpStreamFactory::set_use_alternate_protocols(true); |
| 8593 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); | 8550 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); |
| 8594 | 8551 |
| 8595 HttpRequestInfo request; | 8552 HttpRequestInfo request; |
| 8596 request.method = "GET"; | 8553 request.method = "GET"; |
| 8597 request.url = GURL("http://www.google.com/"); | 8554 request.url = GURL("http://www.google.com/"); |
| 8598 request.load_flags = 0; | 8555 request.load_flags = 0; |
| 8599 | 8556 |
| 8557 std::string alternate_protocol_http_header = |
| 8558 GetAlternateProtocolHttpHeader(); |
| 8559 |
| 8600 MockRead data_reads[] = { | 8560 MockRead data_reads[] = { |
| 8601 MockRead("HTTP/1.1 200 OK\r\n"), | 8561 MockRead("HTTP/1.1 200 OK\r\n"), |
| 8602 MockRead(kAlternateProtocolHttpHeader), | 8562 MockRead(alternate_protocol_http_header.c_str()), |
| 8603 MockRead("hello world"), | 8563 MockRead("hello world"), |
| 8604 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), | 8564 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), |
| 8605 MockRead(ASYNC, OK), | 8565 MockRead(ASYNC, OK), |
| 8606 }; | 8566 }; |
| 8607 | 8567 |
| 8608 StaticSocketDataProvider first_transaction( | 8568 StaticSocketDataProvider first_transaction( |
| 8609 data_reads, arraysize(data_reads), NULL, 0); | 8569 data_reads, arraysize(data_reads), NULL, 0); |
| 8610 session_deps_.socket_factory->AddSocketDataProvider(&first_transaction); | 8570 session_deps_.socket_factory->AddSocketDataProvider(&first_transaction); |
| 8611 | 8571 |
| 8612 SSLSocketDataProvider ssl(ASYNC, OK); | 8572 SSLSocketDataProvider ssl(ASYNC, OK); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8698 const std::vector<GURL>& resolved() const { return resolved_; } | 8658 const std::vector<GURL>& resolved() const { return resolved_; } |
| 8699 | 8659 |
| 8700 private: | 8660 private: |
| 8701 std::vector<GURL> resolved_; | 8661 std::vector<GURL> resolved_; |
| 8702 | 8662 |
| 8703 DISALLOW_COPY_AND_ASSIGN(CapturingProxyResolver); | 8663 DISALLOW_COPY_AND_ASSIGN(CapturingProxyResolver); |
| 8704 }; | 8664 }; |
| 8705 | 8665 |
| 8706 TEST_P(HttpNetworkTransactionTest, | 8666 TEST_P(HttpNetworkTransactionTest, |
| 8707 UseAlternateProtocolForTunneledNpnSpdy) { | 8667 UseAlternateProtocolForTunneledNpnSpdy) { |
| 8708 if (GetParam() > kProtoSPDY3) | |
| 8709 return; | |
| 8710 | |
| 8711 HttpStreamFactory::set_use_alternate_protocols(true); | 8668 HttpStreamFactory::set_use_alternate_protocols(true); |
| 8712 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); | 8669 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); |
| 8713 | 8670 |
| 8714 ProxyConfig proxy_config; | 8671 ProxyConfig proxy_config; |
| 8715 proxy_config.set_auto_detect(true); | 8672 proxy_config.set_auto_detect(true); |
| 8716 proxy_config.set_pac_url(GURL("http://fooproxyurl")); | 8673 proxy_config.set_pac_url(GURL("http://fooproxyurl")); |
| 8717 | 8674 |
| 8718 CapturingProxyResolver* capturing_proxy_resolver = | 8675 CapturingProxyResolver* capturing_proxy_resolver = |
| 8719 new CapturingProxyResolver(); | 8676 new CapturingProxyResolver(); |
| 8720 session_deps_.proxy_service.reset(new ProxyService( | 8677 session_deps_.proxy_service.reset(new ProxyService( |
| 8721 new ProxyConfigServiceFixed(proxy_config), capturing_proxy_resolver, | 8678 new ProxyConfigServiceFixed(proxy_config), capturing_proxy_resolver, |
| 8722 NULL)); | 8679 NULL)); |
| 8723 CapturingNetLog net_log; | 8680 CapturingNetLog net_log; |
| 8724 session_deps_.net_log = &net_log; | 8681 session_deps_.net_log = &net_log; |
| 8725 | 8682 |
| 8726 HttpRequestInfo request; | 8683 HttpRequestInfo request; |
| 8727 request.method = "GET"; | 8684 request.method = "GET"; |
| 8728 request.url = GURL("http://www.google.com/"); | 8685 request.url = GURL("http://www.google.com/"); |
| 8729 request.load_flags = 0; | 8686 request.load_flags = 0; |
| 8730 | 8687 |
| 8688 std::string alternate_protocol_http_header = |
| 8689 GetAlternateProtocolHttpHeader(); |
| 8690 |
| 8731 MockRead data_reads[] = { | 8691 MockRead data_reads[] = { |
| 8732 MockRead("HTTP/1.1 200 OK\r\n"), | 8692 MockRead("HTTP/1.1 200 OK\r\n"), |
| 8733 MockRead(kAlternateProtocolHttpHeader), | 8693 MockRead(alternate_protocol_http_header.c_str()), |
| 8734 MockRead("hello world"), | 8694 MockRead("hello world"), |
| 8735 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), | 8695 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), |
| 8736 MockRead(ASYNC, OK), | 8696 MockRead(ASYNC, OK), |
| 8737 }; | 8697 }; |
| 8738 | 8698 |
| 8739 StaticSocketDataProvider first_transaction( | 8699 StaticSocketDataProvider first_transaction( |
| 8740 data_reads, arraysize(data_reads), NULL, 0); | 8700 data_reads, arraysize(data_reads), NULL, 0); |
| 8741 session_deps_.socket_factory->AddSocketDataProvider(&first_transaction); | 8701 session_deps_.socket_factory->AddSocketDataProvider(&first_transaction); |
| 8742 | 8702 |
| 8743 SSLSocketDataProvider ssl(ASYNC, OK); | 8703 SSLSocketDataProvider ssl(ASYNC, OK); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8820 capturing_proxy_resolver->resolved()[1].spec()); | 8780 capturing_proxy_resolver->resolved()[1].spec()); |
| 8821 | 8781 |
| 8822 LoadTimingInfo load_timing_info; | 8782 LoadTimingInfo load_timing_info; |
| 8823 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); | 8783 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); |
| 8824 TestLoadTimingNotReusedWithPac(load_timing_info, | 8784 TestLoadTimingNotReusedWithPac(load_timing_info, |
| 8825 CONNECT_TIMING_HAS_SSL_TIMES); | 8785 CONNECT_TIMING_HAS_SSL_TIMES); |
| 8826 } | 8786 } |
| 8827 | 8787 |
| 8828 TEST_P(HttpNetworkTransactionTest, | 8788 TEST_P(HttpNetworkTransactionTest, |
| 8829 UseAlternateProtocolForNpnSpdyWithExistingSpdySession) { | 8789 UseAlternateProtocolForNpnSpdyWithExistingSpdySession) { |
| 8830 if (GetParam() > kProtoSPDY3) | |
| 8831 return; | |
| 8832 | |
| 8833 HttpStreamFactory::set_use_alternate_protocols(true); | 8790 HttpStreamFactory::set_use_alternate_protocols(true); |
| 8834 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); | 8791 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); |
| 8835 | 8792 |
| 8836 HttpRequestInfo request; | 8793 HttpRequestInfo request; |
| 8837 request.method = "GET"; | 8794 request.method = "GET"; |
| 8838 request.url = GURL("http://www.google.com/"); | 8795 request.url = GURL("http://www.google.com/"); |
| 8839 request.load_flags = 0; | 8796 request.load_flags = 0; |
| 8840 | 8797 |
| 8798 std::string alternate_protocol_http_header = |
| 8799 GetAlternateProtocolHttpHeader(); |
| 8800 |
| 8841 MockRead data_reads[] = { | 8801 MockRead data_reads[] = { |
| 8842 MockRead("HTTP/1.1 200 OK\r\n"), | 8802 MockRead("HTTP/1.1 200 OK\r\n"), |
| 8843 MockRead(kAlternateProtocolHttpHeader), | 8803 MockRead(alternate_protocol_http_header.c_str()), |
| 8844 MockRead("hello world"), | 8804 MockRead("hello world"), |
| 8845 MockRead(ASYNC, OK), | 8805 MockRead(ASYNC, OK), |
| 8846 }; | 8806 }; |
| 8847 | 8807 |
| 8848 StaticSocketDataProvider first_transaction( | 8808 StaticSocketDataProvider first_transaction( |
| 8849 data_reads, arraysize(data_reads), NULL, 0); | 8809 data_reads, arraysize(data_reads), NULL, 0); |
| 8850 session_deps_.socket_factory->AddSocketDataProvider(&first_transaction); | 8810 session_deps_.socket_factory->AddSocketDataProvider(&first_transaction); |
| 8851 | 8811 |
| 8852 SSLSocketDataProvider ssl(ASYNC, OK); | 8812 SSLSocketDataProvider ssl(ASYNC, OK); |
| 8853 ssl.SetNextProto(GetParam()); | 8813 ssl.SetNextProto(GetParam()); |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9559 request.method = "GET"; | 9519 request.method = "GET"; |
| 9560 request.url = GURL("https://www.google.com/"); | 9520 request.url = GURL("https://www.google.com/"); |
| 9561 request.load_flags = 0; | 9521 request.load_flags = 0; |
| 9562 | 9522 |
| 9563 MockWrite data_writes[] = { | 9523 MockWrite data_writes[] = { |
| 9564 MockWrite("GET / HTTP/1.1\r\n" | 9524 MockWrite("GET / HTTP/1.1\r\n" |
| 9565 "Host: www.google.com\r\n" | 9525 "Host: www.google.com\r\n" |
| 9566 "Connection: keep-alive\r\n\r\n"), | 9526 "Connection: keep-alive\r\n\r\n"), |
| 9567 }; | 9527 }; |
| 9568 | 9528 |
| 9529 std::string alternate_protocol_http_header = |
| 9530 GetAlternateProtocolHttpHeader(); |
| 9531 |
| 9569 MockRead data_reads[] = { | 9532 MockRead data_reads[] = { |
| 9570 MockRead("HTTP/1.1 200 OK\r\n"), | 9533 MockRead("HTTP/1.1 200 OK\r\n"), |
| 9571 MockRead(kAlternateProtocolHttpHeader), | 9534 MockRead(alternate_protocol_http_header.c_str()), |
| 9572 MockRead("hello world"), | 9535 MockRead("hello world"), |
| 9573 MockRead(SYNCHRONOUS, OK), | 9536 MockRead(SYNCHRONOUS, OK), |
| 9574 }; | 9537 }; |
| 9575 | 9538 |
| 9576 SSLSocketDataProvider ssl(ASYNC, OK); | 9539 SSLSocketDataProvider ssl(ASYNC, OK); |
| 9577 ssl.next_proto_status = SSLClientSocket::kNextProtoNegotiated; | 9540 ssl.next_proto_status = SSLClientSocket::kNextProtoNegotiated; |
| 9578 ssl.next_proto = "http/1.1"; | 9541 ssl.next_proto = "http/1.1"; |
| 9579 ssl.protocol_negotiated = kProtoHTTP11; | 9542 ssl.protocol_negotiated = kProtoHTTP11; |
| 9580 | 9543 |
| 9581 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 9544 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9643 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9606 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9644 scoped_ptr<HttpTransaction> trans( | 9607 scoped_ptr<HttpTransaction> trans( |
| 9645 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 9608 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 9646 | 9609 |
| 9647 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 9610 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 9648 EXPECT_EQ(ERR_IO_PENDING, rv); | 9611 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 9649 EXPECT_EQ(ERR_CONNECTION_CLOSED, callback.WaitForResult()); | 9612 EXPECT_EQ(ERR_CONNECTION_CLOSED, callback.WaitForResult()); |
| 9650 } | 9613 } |
| 9651 | 9614 |
| 9652 TEST_P(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) { | 9615 TEST_P(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) { |
| 9653 if (GetParam() > kProtoSPDY3) | |
| 9654 return; | |
| 9655 | |
| 9656 // This test ensures that the URL passed into the proxy is upgraded | 9616 // This test ensures that the URL passed into the proxy is upgraded |
| 9657 // to https when doing an Alternate Protocol upgrade. | 9617 // to https when doing an Alternate Protocol upgrade. |
| 9658 HttpStreamFactory::set_use_alternate_protocols(true); | 9618 HttpStreamFactory::set_use_alternate_protocols(true); |
| 9659 HttpStreamFactory::SetNextProtos( | 9619 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); |
| 9660 MakeNextProtos( | |
| 9661 "http/1.1", "http1.1", "spdy/2", "spdy", NULL)); | |
| 9662 | 9620 |
| 9663 session_deps_.proxy_service.reset( | 9621 session_deps_.proxy_service.reset( |
| 9664 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 9622 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); |
| 9665 CapturingNetLog net_log; | 9623 CapturingNetLog net_log; |
| 9666 session_deps_.net_log = &net_log; | 9624 session_deps_.net_log = &net_log; |
| 9667 HttpAuthHandlerMock::Factory* auth_factory = | 9625 HttpAuthHandlerMock::Factory* auth_factory = |
| 9668 new HttpAuthHandlerMock::Factory(); | 9626 new HttpAuthHandlerMock::Factory(); |
| 9669 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock(); | 9627 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock(); |
| 9670 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); | 9628 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); |
| 9671 auth_factory->set_do_init_from_challenge(true); | 9629 auth_factory->set_do_init_from_challenge(true); |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10028 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, | 9986 entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
| 10029 NetLog::PHASE_NONE); | 9987 NetLog::PHASE_NONE); |
| 10030 ExpectLogContainsSomewhere( | 9988 ExpectLogContainsSomewhere( |
| 10031 entries, pos, | 9989 entries, pos, |
| 10032 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, | 9990 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
| 10033 NetLog::PHASE_NONE); | 9991 NetLog::PHASE_NONE); |
| 10034 } | 9992 } |
| 10035 | 9993 |
| 10036 // Test for crbug.com/55424. | 9994 // Test for crbug.com/55424. |
| 10037 TEST_P(HttpNetworkTransactionTest, PreconnectWithExistingSpdySession) { | 9995 TEST_P(HttpNetworkTransactionTest, PreconnectWithExistingSpdySession) { |
| 10038 if (GetParam() > kProtoSPDY3) | |
| 10039 return; | |
| 10040 | |
| 10041 scoped_ptr<SpdyFrame> req( | 9996 scoped_ptr<SpdyFrame> req( |
| 10042 spdy_util_.ConstructSpdyGet("https://www.google.com", false, 1, LOWEST)); | 9997 spdy_util_.ConstructSpdyGet("https://www.google.com", false, 1, LOWEST)); |
| 10043 MockWrite spdy_writes[] = { CreateMockWrite(*req) }; | 9998 MockWrite spdy_writes[] = { CreateMockWrite(*req) }; |
| 10044 | 9999 |
| 10045 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 10000 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 10046 scoped_ptr<SpdyFrame> data(spdy_util_.ConstructSpdyBodyFrame(1, true)); | 10001 scoped_ptr<SpdyFrame> data(spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 10047 MockRead spdy_reads[] = { | 10002 MockRead spdy_reads[] = { |
| 10048 CreateMockRead(*resp), | 10003 CreateMockRead(*resp), |
| 10049 CreateMockRead(*data), | 10004 CreateMockRead(*data), |
| 10050 MockRead(ASYNC, 0, 0), | 10005 MockRead(ASYNC, 0, 0), |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10485 #define WRAPPED_TEST_P(test_case_name, test_name) \ | 10440 #define WRAPPED_TEST_P(test_case_name, test_name) \ |
| 10486 TEST_P(test_case_name, test_name) | 10441 TEST_P(test_case_name, test_name) |
| 10487 | 10442 |
| 10488 // Times out on Win7 dbg(2) bot. http://crbug.com/124776 | 10443 // Times out on Win7 dbg(2) bot. http://crbug.com/124776 |
| 10489 #if defined(OS_WIN) | 10444 #if defined(OS_WIN) |
| 10490 #define MAYBE_UseIPConnectionPooling DISABLED_UseIPConnectionPooling | 10445 #define MAYBE_UseIPConnectionPooling DISABLED_UseIPConnectionPooling |
| 10491 #else | 10446 #else |
| 10492 #define MAYBE_UseIPConnectionPooling UseIPConnectionPooling | 10447 #define MAYBE_UseIPConnectionPooling UseIPConnectionPooling |
| 10493 #endif | 10448 #endif |
| 10494 WRAPPED_TEST_P(HttpNetworkTransactionTest, MAYBE_UseIPConnectionPooling) { | 10449 WRAPPED_TEST_P(HttpNetworkTransactionTest, MAYBE_UseIPConnectionPooling) { |
| 10495 if (GetParam() > kProtoSPDY3) | |
| 10496 return; | |
| 10497 | |
| 10498 HttpStreamFactory::set_use_alternate_protocols(true); | 10450 HttpStreamFactory::set_use_alternate_protocols(true); |
| 10499 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); | 10451 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); |
| 10500 | 10452 |
| 10501 // Set up a special HttpNetworkSession with a MockCachingHostResolver. | 10453 // Set up a special HttpNetworkSession with a MockCachingHostResolver. |
| 10502 session_deps_.host_resolver.reset(new MockCachingHostResolver()); | 10454 session_deps_.host_resolver.reset(new MockCachingHostResolver()); |
| 10503 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10455 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10504 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); | 10456 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); |
| 10505 pool_peer.DisableDomainAuthenticationVerification(); | 10457 pool_peer.DisableDomainAuthenticationVerification(); |
| 10506 | 10458 |
| 10507 SSLSocketDataProvider ssl(ASYNC, OK); | 10459 SSLSocketDataProvider ssl(ASYNC, OK); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10588 ASSERT_TRUE(response->headers.get() != NULL); | 10540 ASSERT_TRUE(response->headers.get() != NULL); |
| 10589 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 10541 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 10590 EXPECT_TRUE(response->was_fetched_via_spdy); | 10542 EXPECT_TRUE(response->was_fetched_via_spdy); |
| 10591 EXPECT_TRUE(response->was_npn_negotiated); | 10543 EXPECT_TRUE(response->was_npn_negotiated); |
| 10592 ASSERT_EQ(OK, ReadTransaction(&trans2, &response_data)); | 10544 ASSERT_EQ(OK, ReadTransaction(&trans2, &response_data)); |
| 10593 EXPECT_EQ("hello!", response_data); | 10545 EXPECT_EQ("hello!", response_data); |
| 10594 } | 10546 } |
| 10595 #undef MAYBE_UseIPConnectionPooling | 10547 #undef MAYBE_UseIPConnectionPooling |
| 10596 | 10548 |
| 10597 TEST_P(HttpNetworkTransactionTest, UseIPConnectionPoolingAfterResolution) { | 10549 TEST_P(HttpNetworkTransactionTest, UseIPConnectionPoolingAfterResolution) { |
| 10598 if (GetParam() > kProtoSPDY3) | |
| 10599 return; | |
| 10600 | |
| 10601 HttpStreamFactory::set_use_alternate_protocols(true); | 10550 HttpStreamFactory::set_use_alternate_protocols(true); |
| 10602 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); | 10551 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); |
| 10603 | 10552 |
| 10604 // Set up a special HttpNetworkSession with a MockCachingHostResolver. | 10553 // Set up a special HttpNetworkSession with a MockCachingHostResolver. |
| 10605 session_deps_.host_resolver.reset(new MockCachingHostResolver()); | 10554 session_deps_.host_resolver.reset(new MockCachingHostResolver()); |
| 10606 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10555 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10607 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); | 10556 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); |
| 10608 pool_peer.DisableDomainAuthenticationVerification(); | 10557 pool_peer.DisableDomainAuthenticationVerification(); |
| 10609 | 10558 |
| 10610 SSLSocketDataProvider ssl(ASYNC, OK); | 10559 SSLSocketDataProvider ssl(ASYNC, OK); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10728 // Times out on Win7 dbg(2) bot. http://crbug.com/124776 | 10677 // Times out on Win7 dbg(2) bot. http://crbug.com/124776 |
| 10729 #if defined(OS_WIN) | 10678 #if defined(OS_WIN) |
| 10730 #define MAYBE_UseIPConnectionPoolingWithHostCacheExpiration \ | 10679 #define MAYBE_UseIPConnectionPoolingWithHostCacheExpiration \ |
| 10731 DISABLED_UseIPConnectionPoolingWithHostCacheExpiration | 10680 DISABLED_UseIPConnectionPoolingWithHostCacheExpiration |
| 10732 #else | 10681 #else |
| 10733 #define MAYBE_UseIPConnectionPoolingWithHostCacheExpiration \ | 10682 #define MAYBE_UseIPConnectionPoolingWithHostCacheExpiration \ |
| 10734 UseIPConnectionPoolingWithHostCacheExpiration | 10683 UseIPConnectionPoolingWithHostCacheExpiration |
| 10735 #endif | 10684 #endif |
| 10736 WRAPPED_TEST_P(HttpNetworkTransactionTest, | 10685 WRAPPED_TEST_P(HttpNetworkTransactionTest, |
| 10737 MAYBE_UseIPConnectionPoolingWithHostCacheExpiration) { | 10686 MAYBE_UseIPConnectionPoolingWithHostCacheExpiration) { |
| 10738 if (GetParam() > kProtoSPDY3) | |
| 10739 return; | |
| 10740 | |
| 10741 // Times out on Win7 dbg(2) bot. http://crbug.com/124776 . (MAYBE_ | 10687 // Times out on Win7 dbg(2) bot. http://crbug.com/124776 . (MAYBE_ |
| 10742 // prefix doesn't work with parametrized tests). | 10688 // prefix doesn't work with parametrized tests). |
| 10743 #if defined(OS_WIN) | 10689 #if defined(OS_WIN) |
| 10744 return; | 10690 return; |
| 10745 #endif | 10691 #endif |
| 10746 | 10692 |
| 10747 HttpStreamFactory::set_use_alternate_protocols(true); | 10693 HttpStreamFactory::set_use_alternate_protocols(true); |
| 10748 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); | 10694 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); |
| 10749 | 10695 |
| 10750 // Set up a special HttpNetworkSession with a OneTimeCachingHostResolver. | 10696 // Set up a special HttpNetworkSession with a OneTimeCachingHostResolver. |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10885 StaticSocketDataProvider* data[] = { &data1, &data2 }; | 10831 StaticSocketDataProvider* data[] = { &data1, &data2 }; |
| 10886 | 10832 |
| 10887 SimpleGetHelperResult out = SimpleGetHelperForData(data, arraysize(data)); | 10833 SimpleGetHelperResult out = SimpleGetHelperForData(data, arraysize(data)); |
| 10888 | 10834 |
| 10889 EXPECT_EQ(OK, out.rv); | 10835 EXPECT_EQ(OK, out.rv); |
| 10890 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); | 10836 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); |
| 10891 EXPECT_EQ("hello world", out.response_data); | 10837 EXPECT_EQ("hello world", out.response_data); |
| 10892 } | 10838 } |
| 10893 | 10839 |
| 10894 TEST_P(HttpNetworkTransactionTest, DoNotUseSpdySessionForHttp) { | 10840 TEST_P(HttpNetworkTransactionTest, DoNotUseSpdySessionForHttp) { |
| 10895 if (GetParam() > kProtoSPDY3) | |
| 10896 return; | |
| 10897 | |
| 10898 const std::string https_url = "https://www.google.com/"; | 10841 const std::string https_url = "https://www.google.com/"; |
| 10899 const std::string http_url = "http://www.google.com:443/"; | 10842 const std::string http_url = "http://www.google.com:443/"; |
| 10900 | 10843 |
| 10901 // SPDY GET for HTTPS URL | 10844 // SPDY GET for HTTPS URL |
| 10902 scoped_ptr<SpdyFrame> req1( | 10845 scoped_ptr<SpdyFrame> req1( |
| 10903 spdy_util_.ConstructSpdyGet(https_url.c_str(), false, 1, LOWEST)); | 10846 spdy_util_.ConstructSpdyGet(https_url.c_str(), false, 1, LOWEST)); |
| 10904 | 10847 |
| 10905 MockWrite writes1[] = { | 10848 MockWrite writes1[] = { |
| 10906 CreateMockWrite(*req1, 0), | 10849 CreateMockWrite(*req1, 0), |
| 10907 }; | 10850 }; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10969 TestCompletionCallback callback2; | 10912 TestCompletionCallback callback2; |
| 10970 EXPECT_EQ(ERR_IO_PENDING, | 10913 EXPECT_EQ(ERR_IO_PENDING, |
| 10971 trans2.Start(&request2, callback2.callback(), BoundNetLog())); | 10914 trans2.Start(&request2, callback2.callback(), BoundNetLog())); |
| 10972 base::MessageLoop::current()->RunUntilIdle(); | 10915 base::MessageLoop::current()->RunUntilIdle(); |
| 10973 | 10916 |
| 10974 EXPECT_EQ(OK, callback2.WaitForResult()); | 10917 EXPECT_EQ(OK, callback2.WaitForResult()); |
| 10975 EXPECT_FALSE(trans2.GetResponseInfo()->was_fetched_via_spdy); | 10918 EXPECT_FALSE(trans2.GetResponseInfo()->was_fetched_via_spdy); |
| 10976 } | 10919 } |
| 10977 | 10920 |
| 10978 TEST_P(HttpNetworkTransactionTest, DoNotUseSpdySessionForHttpOverTunnel) { | 10921 TEST_P(HttpNetworkTransactionTest, DoNotUseSpdySessionForHttpOverTunnel) { |
| 10979 if (GetParam() > kProtoSPDY3) | |
| 10980 return; | |
| 10981 | |
| 10982 const std::string https_url = "https://www.google.com/"; | 10922 const std::string https_url = "https://www.google.com/"; |
| 10983 const std::string http_url = "http://www.google.com:443/"; | 10923 const std::string http_url = "http://www.google.com:443/"; |
| 10984 | 10924 |
| 10985 // SPDY GET for HTTPS URL (through CONNECT tunnel) | 10925 // SPDY GET for HTTPS URL (through CONNECT tunnel) |
| 10986 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect(NULL, 0, 1)); | 10926 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect(NULL, 0, 1)); |
| 10987 scoped_ptr<SpdyFrame> req1( | 10927 scoped_ptr<SpdyFrame> req1( |
| 10988 spdy_util_.ConstructSpdyGet(https_url.c_str(), false, 1, LOWEST)); | 10928 spdy_util_.ConstructSpdyGet(https_url.c_str(), false, 1, LOWEST)); |
| 10989 | 10929 |
| 10990 // SPDY GET for HTTP URL (through the proxy, but not the tunnel) | 10930 // SPDY GET for HTTP URL (through the proxy, but not the tunnel) |
| 10991 scoped_ptr<SpdyFrame> wrapped_req1( | 10931 scoped_ptr<SpdyFrame> wrapped_req1( |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11084 LoadTimingInfo load_timing_info2; | 11024 LoadTimingInfo load_timing_info2; |
| 11085 EXPECT_TRUE(trans2.GetLoadTimingInfo(&load_timing_info2)); | 11025 EXPECT_TRUE(trans2.GetLoadTimingInfo(&load_timing_info2)); |
| 11086 // The established SPDY sessions is considered reused by the HTTP request. | 11026 // The established SPDY sessions is considered reused by the HTTP request. |
| 11087 TestLoadTimingReusedWithPac(load_timing_info2); | 11027 TestLoadTimingReusedWithPac(load_timing_info2); |
| 11088 // HTTP requests over a SPDY session should have a different connection | 11028 // HTTP requests over a SPDY session should have a different connection |
| 11089 // socket_log_id than requests over a tunnel. | 11029 // socket_log_id than requests over a tunnel. |
| 11090 EXPECT_NE(load_timing_info1.socket_log_id, load_timing_info2.socket_log_id); | 11030 EXPECT_NE(load_timing_info1.socket_log_id, load_timing_info2.socket_log_id); |
| 11091 } | 11031 } |
| 11092 | 11032 |
| 11093 TEST_P(HttpNetworkTransactionTest, UseSpdySessionForHttpWhenForced) { | 11033 TEST_P(HttpNetworkTransactionTest, UseSpdySessionForHttpWhenForced) { |
| 11094 if (GetParam() > kProtoSPDY3) | |
| 11095 return; | |
| 11096 | |
| 11097 HttpStreamFactory::set_force_spdy_always(true); | 11034 HttpStreamFactory::set_force_spdy_always(true); |
| 11098 const std::string https_url = "https://www.google.com/"; | 11035 const std::string https_url = "https://www.google.com/"; |
| 11099 const std::string http_url = "http://www.google.com:443/"; | 11036 const std::string http_url = "http://www.google.com:443/"; |
| 11100 | 11037 |
| 11101 // SPDY GET for HTTPS URL | 11038 // SPDY GET for HTTPS URL |
| 11102 scoped_ptr<SpdyFrame> req1( | 11039 scoped_ptr<SpdyFrame> req1( |
| 11103 spdy_util_.ConstructSpdyGet(https_url.c_str(), false, 1, LOWEST)); | 11040 spdy_util_.ConstructSpdyGet(https_url.c_str(), false, 1, LOWEST)); |
| 11104 // SPDY GET for the HTTP URL | 11041 // SPDY GET for the HTTP URL |
| 11105 scoped_ptr<SpdyFrame> req2( | 11042 scoped_ptr<SpdyFrame> req2( |
| 11106 spdy_util_.ConstructSpdyGet(http_url.c_str(), false, 3, MEDIUM)); | 11043 spdy_util_.ConstructSpdyGet(http_url.c_str(), false, 3, MEDIUM)); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11159 | 11096 |
| 11160 EXPECT_EQ(OK, callback2.WaitForResult()); | 11097 EXPECT_EQ(OK, callback2.WaitForResult()); |
| 11161 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); | 11098 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); |
| 11162 } | 11099 } |
| 11163 | 11100 |
| 11164 // Test that in the case where we have a SPDY session to a SPDY proxy | 11101 // Test that in the case where we have a SPDY session to a SPDY proxy |
| 11165 // that we do not pool other origins that resolve to the same IP when | 11102 // that we do not pool other origins that resolve to the same IP when |
| 11166 // the certificate does not match the new origin. | 11103 // the certificate does not match the new origin. |
| 11167 // http://crbug.com/134690 | 11104 // http://crbug.com/134690 |
| 11168 TEST_P(HttpNetworkTransactionTest, DoNotUseSpdySessionIfCertDoesNotMatch) { | 11105 TEST_P(HttpNetworkTransactionTest, DoNotUseSpdySessionIfCertDoesNotMatch) { |
| 11169 if (GetParam() > kProtoSPDY3) | |
| 11170 return; | |
| 11171 | |
| 11172 const std::string url1 = "http://www.google.com/"; | 11106 const std::string url1 = "http://www.google.com/"; |
| 11173 const std::string url2 = "https://mail.google.com/"; | 11107 const std::string url2 = "https://mail.google.com/"; |
| 11174 const std::string ip_addr = "1.2.3.4"; | 11108 const std::string ip_addr = "1.2.3.4"; |
| 11175 | 11109 |
| 11176 // SPDY GET for HTTP URL (through SPDY proxy) | 11110 // SPDY GET for HTTP URL (through SPDY proxy) |
| 11177 scoped_ptr<SpdyHeaderBlock> headers( | 11111 scoped_ptr<SpdyHeaderBlock> headers( |
| 11178 spdy_util_.ConstructGetHeaderBlockForProxy("http://www.google.com/")); | 11112 spdy_util_.ConstructGetHeaderBlockForProxy("http://www.google.com/")); |
| 11179 scoped_ptr<SpdyFrame> req1(spdy_util_.ConstructSpdyControlFrame( | 11113 scoped_ptr<SpdyFrame> req1(spdy_util_.ConstructSpdyControlFrame( |
| 11180 headers.Pass(), false, 1, LOWEST, SYN_STREAM, CONTROL_FLAG_FIN, 0)); | 11114 headers.Pass(), false, 1, LOWEST, SYN_STREAM, CONTROL_FLAG_FIN, 0)); |
| 11181 | 11115 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11291 ASSERT_TRUE(callback2.have_result()); | 11225 ASSERT_TRUE(callback2.have_result()); |
| 11292 EXPECT_EQ(OK, callback2.WaitForResult()); | 11226 EXPECT_EQ(OK, callback2.WaitForResult()); |
| 11293 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); | 11227 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); |
| 11294 } | 11228 } |
| 11295 | 11229 |
| 11296 // Test to verify that a failed socket read (due to an ERR_CONNECTION_CLOSED | 11230 // Test to verify that a failed socket read (due to an ERR_CONNECTION_CLOSED |
| 11297 // error) in SPDY session, removes the socket from pool and closes the SPDY | 11231 // error) in SPDY session, removes the socket from pool and closes the SPDY |
| 11298 // session. Verify that new url's from the same HttpNetworkSession (and a new | 11232 // session. Verify that new url's from the same HttpNetworkSession (and a new |
| 11299 // SpdySession) do work. http://crbug.com/224701 | 11233 // SpdySession) do work. http://crbug.com/224701 |
| 11300 TEST_P(HttpNetworkTransactionTest, ErrorSocketNotConnected) { | 11234 TEST_P(HttpNetworkTransactionTest, ErrorSocketNotConnected) { |
| 11301 if (GetParam() > kProtoSPDY3) | |
| 11302 return; | |
| 11303 | |
| 11304 const std::string https_url = "https://www.google.com/"; | 11235 const std::string https_url = "https://www.google.com/"; |
| 11305 | 11236 |
| 11306 MockRead reads1[] = { | 11237 MockRead reads1[] = { |
| 11307 MockRead(SYNCHRONOUS, ERR_CONNECTION_CLOSED, 0) | 11238 MockRead(SYNCHRONOUS, ERR_CONNECTION_CLOSED, 0) |
| 11308 }; | 11239 }; |
| 11309 | 11240 |
| 11310 scoped_ptr<DeterministicSocketData> data1( | 11241 scoped_ptr<DeterministicSocketData> data1( |
| 11311 new DeterministicSocketData(reads1, arraysize(reads1), NULL, 0)); | 11242 new DeterministicSocketData(reads1, arraysize(reads1), NULL, 0)); |
| 11312 data1->SetStop(1); | 11243 data1->SetStop(1); |
| 11313 | 11244 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11368 trans2.Start(&request2, callback2.callback(), BoundNetLog())); | 11299 trans2.Start(&request2, callback2.callback(), BoundNetLog())); |
| 11369 base::MessageLoop::current()->RunUntilIdle(); | 11300 base::MessageLoop::current()->RunUntilIdle(); |
| 11370 data2->RunFor(3); | 11301 data2->RunFor(3); |
| 11371 | 11302 |
| 11372 ASSERT_TRUE(callback2.have_result()); | 11303 ASSERT_TRUE(callback2.have_result()); |
| 11373 EXPECT_EQ(OK, callback2.WaitForResult()); | 11304 EXPECT_EQ(OK, callback2.WaitForResult()); |
| 11374 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); | 11305 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); |
| 11375 } | 11306 } |
| 11376 | 11307 |
| 11377 TEST_P(HttpNetworkTransactionTest, CloseIdleSpdySessionToOpenNewOne) { | 11308 TEST_P(HttpNetworkTransactionTest, CloseIdleSpdySessionToOpenNewOne) { |
| 11378 if (GetParam() > kProtoSPDY3) | |
| 11379 return; | |
| 11380 | |
| 11381 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); | 11309 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); |
| 11382 ClientSocketPoolManager::set_max_sockets_per_group( | 11310 ClientSocketPoolManager::set_max_sockets_per_group( |
| 11383 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); | 11311 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); |
| 11384 ClientSocketPoolManager::set_max_sockets_per_pool( | 11312 ClientSocketPoolManager::set_max_sockets_per_pool( |
| 11385 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); | 11313 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); |
| 11386 | 11314 |
| 11387 // Use two different hosts with different IPs so they don't get pooled. | 11315 // Use two different hosts with different IPs so they don't get pooled. |
| 11388 session_deps_.host_resolver->rules()->AddRule("www.a.com", "10.0.0.1"); | 11316 session_deps_.host_resolver->rules()->AddRule("www.a.com", "10.0.0.1"); |
| 11389 session_deps_.host_resolver->rules()->AddRule("www.b.com", "10.0.0.2"); | 11317 session_deps_.host_resolver->rules()->AddRule("www.b.com", "10.0.0.2"); |
| 11390 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11318 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11790 EXPECT_EQ(OK, rv); | 11718 EXPECT_EQ(OK, rv); |
| 11791 | 11719 |
| 11792 HttpRequestHeaders request_headers; | 11720 HttpRequestHeaders request_headers; |
| 11793 EXPECT_TRUE(trans->GetFullRequestHeaders(&request_headers)); | 11721 EXPECT_TRUE(trans->GetFullRequestHeaders(&request_headers)); |
| 11794 std::string foo; | 11722 std::string foo; |
| 11795 EXPECT_TRUE(request_headers.GetHeader("X-Foo", &foo)); | 11723 EXPECT_TRUE(request_headers.GetHeader("X-Foo", &foo)); |
| 11796 EXPECT_EQ("bar", foo); | 11724 EXPECT_EQ("bar", foo); |
| 11797 } | 11725 } |
| 11798 | 11726 |
| 11799 } // namespace net | 11727 } // namespace net |
| OLD | NEW |