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 10952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10963 #else | 10963 #else |
10964 #define MAYBE_UseIPConnectionPoolingWithHostCacheExpiration \ | 10964 #define MAYBE_UseIPConnectionPoolingWithHostCacheExpiration \ |
10965 UseIPConnectionPoolingWithHostCacheExpiration | 10965 UseIPConnectionPoolingWithHostCacheExpiration |
10966 #endif | 10966 #endif |
10967 WRAPPED_TEST_P(HttpNetworkTransactionTest, | 10967 WRAPPED_TEST_P(HttpNetworkTransactionTest, |
10968 MAYBE_UseIPConnectionPoolingWithHostCacheExpiration) { | 10968 MAYBE_UseIPConnectionPoolingWithHostCacheExpiration) { |
10969 // Times out on Win7 dbg(2) bot. http://crbug.com/124776 . (MAYBE_ | 10969 // Times out on Win7 dbg(2) bot. http://crbug.com/124776 . (MAYBE_ |
10970 // prefix doesn't work with parametrized tests). | 10970 // prefix doesn't work with parametrized tests). |
10971 #if defined(OS_WIN) | 10971 #if defined(OS_WIN) |
10972 return; | 10972 return; |
10973 #endif | 10973 #else |
10974 | |
10975 HttpStreamFactory::set_use_alternate_protocols(true); | 10974 HttpStreamFactory::set_use_alternate_protocols(true); |
10976 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); | 10975 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); |
10977 | 10976 |
10978 // Set up a special HttpNetworkSession with a OneTimeCachingHostResolver. | 10977 // Set up a special HttpNetworkSession with a OneTimeCachingHostResolver. |
10979 OneTimeCachingHostResolver host_resolver(HostPortPair("www.gmail.com", 443)); | 10978 OneTimeCachingHostResolver host_resolver(HostPortPair("www.gmail.com", 443)); |
10980 HttpNetworkSession::Params params = | 10979 HttpNetworkSession::Params params = |
10981 SpdySessionDependencies::CreateSessionParams(&session_deps_); | 10980 SpdySessionDependencies::CreateSessionParams(&session_deps_); |
10982 params.host_resolver = &host_resolver; | 10981 params.host_resolver = &host_resolver; |
10983 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10982 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
10984 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); | 10983 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11066 EXPECT_EQ(OK, callback.WaitForResult()); | 11065 EXPECT_EQ(OK, callback.WaitForResult()); |
11067 | 11066 |
11068 response = trans2.GetResponseInfo(); | 11067 response = trans2.GetResponseInfo(); |
11069 ASSERT_TRUE(response != NULL); | 11068 ASSERT_TRUE(response != NULL); |
11070 ASSERT_TRUE(response->headers.get() != NULL); | 11069 ASSERT_TRUE(response->headers.get() != NULL); |
11071 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 11070 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
11072 EXPECT_TRUE(response->was_fetched_via_spdy); | 11071 EXPECT_TRUE(response->was_fetched_via_spdy); |
11073 EXPECT_TRUE(response->was_npn_negotiated); | 11072 EXPECT_TRUE(response->was_npn_negotiated); |
11074 ASSERT_EQ(OK, ReadTransaction(&trans2, &response_data)); | 11073 ASSERT_EQ(OK, ReadTransaction(&trans2, &response_data)); |
11075 EXPECT_EQ("hello!", response_data); | 11074 EXPECT_EQ("hello!", response_data); |
| 11075 #endif |
11076 } | 11076 } |
11077 #undef MAYBE_UseIPConnectionPoolingWithHostCacheExpiration | 11077 #undef MAYBE_UseIPConnectionPoolingWithHostCacheExpiration |
11078 | 11078 |
11079 TEST_P(HttpNetworkTransactionTest, ReadPipelineEvictionFallback) { | 11079 TEST_P(HttpNetworkTransactionTest, ReadPipelineEvictionFallback) { |
11080 MockRead data_reads1[] = { | 11080 MockRead data_reads1[] = { |
11081 MockRead(SYNCHRONOUS, ERR_PIPELINE_EVICTION), | 11081 MockRead(SYNCHRONOUS, ERR_PIPELINE_EVICTION), |
11082 }; | 11082 }; |
11083 MockRead data_reads2[] = { | 11083 MockRead data_reads2[] = { |
11084 MockRead("HTTP/1.0 200 OK\r\n\r\n"), | 11084 MockRead("HTTP/1.0 200 OK\r\n\r\n"), |
11085 MockRead("hello world"), | 11085 MockRead("hello world"), |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12543 // established, to let the HTTP request start. | 12543 // established, to let the HTTP request start. |
12544 ASSERT_EQ(OK, http_callback.WaitForResult()); | 12544 ASSERT_EQ(OK, http_callback.WaitForResult()); |
12545 std::string response_data; | 12545 std::string response_data; |
12546 ASSERT_EQ(OK, ReadTransaction(http_trans.get(), &response_data)); | 12546 ASSERT_EQ(OK, ReadTransaction(http_trans.get(), &response_data)); |
12547 EXPECT_EQ("falafel", response_data); | 12547 EXPECT_EQ("falafel", response_data); |
12548 | 12548 |
12549 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session)); | 12549 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session)); |
12550 } | 12550 } |
12551 | 12551 |
12552 } // namespace net | 12552 } // namespace net |
OLD | NEW |