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 10844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10855 #else | 10855 #else |
10856 #define MAYBE_UseIPConnectionPoolingWithHostCacheExpiration \ | 10856 #define MAYBE_UseIPConnectionPoolingWithHostCacheExpiration \ |
10857 UseIPConnectionPoolingWithHostCacheExpiration | 10857 UseIPConnectionPoolingWithHostCacheExpiration |
10858 #endif | 10858 #endif |
10859 WRAPPED_TEST_P(HttpNetworkTransactionTest, | 10859 WRAPPED_TEST_P(HttpNetworkTransactionTest, |
10860 MAYBE_UseIPConnectionPoolingWithHostCacheExpiration) { | 10860 MAYBE_UseIPConnectionPoolingWithHostCacheExpiration) { |
10861 // Times out on Win7 dbg(2) bot. http://crbug.com/124776 . (MAYBE_ | 10861 // Times out on Win7 dbg(2) bot. http://crbug.com/124776 . (MAYBE_ |
10862 // prefix doesn't work with parametrized tests). | 10862 // prefix doesn't work with parametrized tests). |
10863 #if defined(OS_WIN) | 10863 #if defined(OS_WIN) |
10864 return; | 10864 return; |
10865 #endif | 10865 #else |
10866 | |
10867 HttpStreamFactory::set_use_alternate_protocols(true); | 10866 HttpStreamFactory::set_use_alternate_protocols(true); |
10868 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); | 10867 HttpStreamFactory::SetNextProtos(SpdyNextProtos()); |
10869 | 10868 |
10870 // Set up a special HttpNetworkSession with a OneTimeCachingHostResolver. | 10869 // Set up a special HttpNetworkSession with a OneTimeCachingHostResolver. |
10871 OneTimeCachingHostResolver host_resolver(HostPortPair("www.gmail.com", 443)); | 10870 OneTimeCachingHostResolver host_resolver(HostPortPair("www.gmail.com", 443)); |
10872 HttpNetworkSession::Params params = | 10871 HttpNetworkSession::Params params = |
10873 SpdySessionDependencies::CreateSessionParams(&session_deps_); | 10872 SpdySessionDependencies::CreateSessionParams(&session_deps_); |
10874 params.host_resolver = &host_resolver; | 10873 params.host_resolver = &host_resolver; |
10875 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10874 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
10876 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); | 10875 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10958 EXPECT_EQ(OK, callback.WaitForResult()); | 10957 EXPECT_EQ(OK, callback.WaitForResult()); |
10959 | 10958 |
10960 response = trans2.GetResponseInfo(); | 10959 response = trans2.GetResponseInfo(); |
10961 ASSERT_TRUE(response != NULL); | 10960 ASSERT_TRUE(response != NULL); |
10962 ASSERT_TRUE(response->headers.get() != NULL); | 10961 ASSERT_TRUE(response->headers.get() != NULL); |
10963 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 10962 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
10964 EXPECT_TRUE(response->was_fetched_via_spdy); | 10963 EXPECT_TRUE(response->was_fetched_via_spdy); |
10965 EXPECT_TRUE(response->was_npn_negotiated); | 10964 EXPECT_TRUE(response->was_npn_negotiated); |
10966 ASSERT_EQ(OK, ReadTransaction(&trans2, &response_data)); | 10965 ASSERT_EQ(OK, ReadTransaction(&trans2, &response_data)); |
10967 EXPECT_EQ("hello!", response_data); | 10966 EXPECT_EQ("hello!", response_data); |
| 10967 #endif |
10968 } | 10968 } |
10969 #undef MAYBE_UseIPConnectionPoolingWithHostCacheExpiration | 10969 #undef MAYBE_UseIPConnectionPoolingWithHostCacheExpiration |
10970 | 10970 |
10971 TEST_P(HttpNetworkTransactionTest, ReadPipelineEvictionFallback) { | 10971 TEST_P(HttpNetworkTransactionTest, ReadPipelineEvictionFallback) { |
10972 MockRead data_reads1[] = { | 10972 MockRead data_reads1[] = { |
10973 MockRead(SYNCHRONOUS, ERR_PIPELINE_EVICTION), | 10973 MockRead(SYNCHRONOUS, ERR_PIPELINE_EVICTION), |
10974 }; | 10974 }; |
10975 MockRead data_reads2[] = { | 10975 MockRead data_reads2[] = { |
10976 MockRead("HTTP/1.0 200 OK\r\n\r\n"), | 10976 MockRead("HTTP/1.0 200 OK\r\n\r\n"), |
10977 MockRead("hello world"), | 10977 MockRead("hello world"), |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12435 // established, to let the HTTP request start. | 12435 // established, to let the HTTP request start. |
12436 ASSERT_EQ(OK, http_callback.WaitForResult()); | 12436 ASSERT_EQ(OK, http_callback.WaitForResult()); |
12437 std::string response_data; | 12437 std::string response_data; |
12438 ASSERT_EQ(OK, ReadTransaction(http_trans.get(), &response_data)); | 12438 ASSERT_EQ(OK, ReadTransaction(http_trans.get(), &response_data)); |
12439 EXPECT_EQ("falafel", response_data); | 12439 EXPECT_EQ("falafel", response_data); |
12440 | 12440 |
12441 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session)); | 12441 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session)); |
12442 } | 12442 } |
12443 | 12443 |
12444 } // namespace net | 12444 } // namespace net |
OLD | NEW |