| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 return ProxyService::CreateFixed(proxy_config); | 107 return ProxyService::CreateFixed(proxy_config); |
| 108 } | 108 } |
| 109 | 109 |
| 110 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { | 110 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { |
| 111 return new HttpNetworkSession(NULL, | 111 return new HttpNetworkSession(NULL, |
| 112 session_deps->host_resolver, | 112 session_deps->host_resolver, |
| 113 session_deps->proxy_service, | 113 session_deps->proxy_service, |
| 114 &session_deps->socket_factory, | 114 &session_deps->socket_factory, |
| 115 session_deps->ssl_config_service, | 115 session_deps->ssl_config_service, |
| 116 session_deps->spdy_session_pool, | 116 session_deps->spdy_session_pool, |
| 117 session_deps->http_auth_handler_factory.get()); | 117 session_deps->http_auth_handler_factory.get(), |
| 118 NULL); |
| 118 } | 119 } |
| 119 | 120 |
| 120 class HttpNetworkTransactionTest : public PlatformTest { | 121 class HttpNetworkTransactionTest : public PlatformTest { |
| 121 public: | 122 public: |
| 122 virtual void SetUp() { | 123 virtual void SetUp() { |
| 123 spdy::SpdyFramer::set_enable_compression_default(false); | 124 spdy::SpdyFramer::set_enable_compression_default(false); |
| 124 } | 125 } |
| 125 | 126 |
| 126 virtual void TearDown() { | 127 virtual void TearDown() { |
| 127 spdy::SpdyFramer::set_enable_compression_default(true); | 128 spdy::SpdyFramer::set_enable_compression_default(true); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 231 } |
| 231 } | 232 } |
| 232 | 233 |
| 233 std::string MockGetHostName() { | 234 std::string MockGetHostName() { |
| 234 return "WTC-WIN7"; | 235 return "WTC-WIN7"; |
| 235 } | 236 } |
| 236 | 237 |
| 237 template<typename EmulatedClientSocketPool> | 238 template<typename EmulatedClientSocketPool> |
| 238 class CaptureGroupNameSocketPool : public EmulatedClientSocketPool { | 239 class CaptureGroupNameSocketPool : public EmulatedClientSocketPool { |
| 239 public: | 240 public: |
| 240 CaptureGroupNameSocketPool(HttpNetworkSession* session) | 241 explicit CaptureGroupNameSocketPool(HttpNetworkSession* session) |
| 241 : EmulatedClientSocketPool(0, 0, NULL, session->host_resolver(), NULL, | 242 : EmulatedClientSocketPool(0, 0, NULL, session->host_resolver(), NULL, |
| 242 NULL) {} | 243 NULL, NULL) {} |
| 243 const std::string last_group_name_received() const { | 244 const std::string last_group_name_received() const { |
| 244 return last_group_name_; | 245 return last_group_name_; |
| 245 } | 246 } |
| 246 | 247 |
| 247 virtual int RequestSocket(const std::string& group_name, | 248 virtual int RequestSocket(const std::string& group_name, |
| 248 const void* socket_params, | 249 const void* socket_params, |
| 249 RequestPriority priority, | 250 RequestPriority priority, |
| 250 ClientSocketHandle* handle, | 251 ClientSocketHandle* handle, |
| 251 CompletionCallback* callback, | 252 CompletionCallback* callback, |
| 252 const BoundNetLog& net_log) { | 253 const BoundNetLog& net_log) { |
| (...skipping 5329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5582 | 5583 |
| 5583 EXPECT_EQ(L"myserver:80", response->auth_challenge->host_and_port); | 5584 EXPECT_EQ(L"myserver:80", response->auth_challenge->host_and_port); |
| 5584 EXPECT_EQ(L"", response->auth_challenge->realm); | 5585 EXPECT_EQ(L"", response->auth_challenge->realm); |
| 5585 EXPECT_EQ(L"mock", response->auth_challenge->scheme); | 5586 EXPECT_EQ(L"mock", response->auth_challenge->scheme); |
| 5586 auth_handler->ResetResolveExpectation(); | 5587 auth_handler->ResetResolveExpectation(); |
| 5587 } | 5588 } |
| 5588 } | 5589 } |
| 5589 | 5590 |
| 5590 class TLSDecompressionFailureSocketDataProvider : public SocketDataProvider { | 5591 class TLSDecompressionFailureSocketDataProvider : public SocketDataProvider { |
| 5591 public: | 5592 public: |
| 5592 TLSDecompressionFailureSocketDataProvider(bool fail_all) | 5593 explicit TLSDecompressionFailureSocketDataProvider(bool fail_all) |
| 5593 : fail_all_(fail_all) { | 5594 : fail_all_(fail_all) { |
| 5594 } | 5595 } |
| 5595 | 5596 |
| 5596 virtual MockRead GetNextRead() { | 5597 virtual MockRead GetNextRead() { |
| 5597 if (fail_all_) | 5598 if (fail_all_) |
| 5598 return MockRead(false /* async */, ERR_SSL_DECOMPRESSION_FAILURE_ALERT); | 5599 return MockRead(false /* async */, ERR_SSL_DECOMPRESSION_FAILURE_ALERT); |
| 5599 | 5600 |
| 5600 return MockRead(false /* async */, | 5601 return MockRead(false /* async */, |
| 5601 "HTTP/1.1 200 OK\r\nContent-Length: 3\r\n\r\nok.\r\n"); | 5602 "HTTP/1.1 200 OK\r\nContent-Length: 3\r\n\r\nok.\r\n"); |
| 5602 } | 5603 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5748 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 5749 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 5749 EXPECT_EQ("hello world", response_data); | 5750 EXPECT_EQ("hello world", response_data); |
| 5750 | 5751 |
| 5751 EXPECT_FALSE(response->was_fetched_via_spdy); | 5752 EXPECT_FALSE(response->was_fetched_via_spdy); |
| 5752 EXPECT_TRUE(response->was_npn_negotiated); | 5753 EXPECT_TRUE(response->was_npn_negotiated); |
| 5753 | 5754 |
| 5754 HttpNetworkTransaction::SetNextProtos(""); | 5755 HttpNetworkTransaction::SetNextProtos(""); |
| 5755 HttpNetworkTransaction::SetUseAlternateProtocols(false); | 5756 HttpNetworkTransaction::SetUseAlternateProtocols(false); |
| 5756 } | 5757 } |
| 5757 } // namespace net | 5758 } // namespace net |
| OLD | NEW |