summaryrefslogtreecommitdiffstats
path: root/net/spdy
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-25 06:36:58 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-25 06:36:58 +0000
commit31e68d79c7a0ee90d6de5f8fd26b72a7b35bdd2e (patch)
tree884da7cd68797bda1109b596355a2ec2c1647561 /net/spdy
parent7a6a4b3a5b233bb2eae6cec674d90ac858d1a9e7 (diff)
downloadchromium_src-31e68d79c7a0ee90d6de5f8fd26b72a7b35bdd2e.zip
chromium_src-31e68d79c7a0ee90d6de5f8fd26b72a7b35bdd2e.tar.gz
chromium_src-31e68d79c7a0ee90d6de5f8fd26b72a7b35bdd2e.tar.bz2
Refactor: change the spdy session pool key to take a ProxyServer instead of a string representation of the proxy server.
BUG=52668 Review URL: http://codereview.chromium.org/3197018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57297 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy')
-rw-r--r--net/spdy/spdy_http_stream_unittest.cc6
-rw-r--r--net/spdy/spdy_network_transaction_unittest.cc9
-rw-r--r--net/spdy/spdy_session_pool.h7
-rw-r--r--net/spdy/spdy_session_unittest.cc2
-rw-r--r--net/spdy/spdy_stream_unittest.cc2
5 files changed, 15 insertions, 11 deletions
diff --git a/net/spdy/spdy_http_stream_unittest.cc b/net/spdy/spdy_http_stream_unittest.cc
index 5af7d52..22244c4 100644
--- a/net/spdy/spdy_http_stream_unittest.cc
+++ b/net/spdy/spdy_http_stream_unittest.cc
@@ -25,7 +25,7 @@ class SpdyHttpStreamTest : public testing::Test {
int InitSession(MockRead* reads, size_t reads_count,
MockWrite* writes, size_t writes_count,
HostPortPair& host_port_pair) {
- HostPortProxyPair pair(host_port_pair, "");
+ HostPortProxyPair pair(host_port_pair, ProxyServer::Direct());
data_ = new OrderedSocketData(reads, reads_count, writes, writes_count);
session_deps_.socket_factory->AddSocketDataProvider(data_.get());
http_session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_);
@@ -58,7 +58,7 @@ TEST_F(SpdyHttpStreamTest, SendRequest) {
};
HostPortPair host_port_pair("www.google.com", 80);
- HostPortProxyPair pair(host_port_pair, "");
+ HostPortProxyPair pair(host_port_pair, ProxyServer::Direct());
EXPECT_EQ(OK, InitSession(reads, arraysize(reads), writes, arraysize(writes),
host_port_pair));
@@ -108,7 +108,7 @@ TEST_F(SpdyHttpStreamTest, SpdyURLTest) {
};
HostPortPair host_port_pair("www.google.com", 80);
- HostPortProxyPair pair(host_port_pair, "");
+ HostPortProxyPair pair(host_port_pair, ProxyServer::Direct());
EXPECT_EQ(OK, InitSession(reads, arraysize(reads), writes, arraysize(writes),
host_port_pair));
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc
index 61630c3..f194eff 100644
--- a/net/spdy/spdy_network_transaction_unittest.cc
+++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -361,7 +361,7 @@ class SpdyNetworkTransactionTest
const GURL& url = helper.request().url;
int port = helper.test_type() == SPDYNPN ? 443 : 80;
HostPortPair host_port_pair(url.host(), port);
- HostPortProxyPair pair(host_port_pair, "DIRECT");
+ HostPortProxyPair pair(host_port_pair, ProxyServer::Direct());
BoundNetLog log;
const scoped_refptr<HttpNetworkSession>& session = helper.session();
scoped_refptr<SpdySessionPool> pool(session->spdy_session_pool());
@@ -4010,9 +4010,12 @@ TEST_P(SpdyNetworkTransactionTest, DirectConnectProxyReconnect) {
// Check that the SpdySession is still in the SpdySessionPool.
HostPortPair host_port_pair("www.google.com", helper.port());
- HostPortProxyPair session_pool_key_direct(host_port_pair, "DIRECT");
+ HostPortProxyPair session_pool_key_direct(
+ host_port_pair, ProxyServer::Direct());
EXPECT_TRUE(spdy_session_pool->HasSession(session_pool_key_direct));
- HostPortProxyPair session_pool_key_proxy(host_port_pair, "PROXY www.foo.com");
+ HostPortProxyPair session_pool_key_proxy(
+ host_port_pair,
+ ProxyServer::FromURI("www.foo.com", ProxyServer::SCHEME_HTTP));
EXPECT_FALSE(spdy_session_pool->HasSession(session_pool_key_proxy));
// Set up data for the proxy connection.
diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h
index 7efb400..149deb0 100644
--- a/net/spdy/spdy_session_pool.h
+++ b/net/spdy/spdy_session_pool.h
@@ -18,11 +18,12 @@
#include "net/base/net_errors.h"
#include "net/base/network_change_notifier.h"
#include "net/proxy/proxy_config.h"
+#include "net/proxy/proxy_server.h"
namespace net {
-// Sessions are uniquely identified by their HostPortPair and the PAC-style list
-// of valid proxy servers.
-typedef std::pair<HostPortPair, std::string> HostPortProxyPair;
+// Sessions are uniquely identified by their HostPortPair and the proxy server
+// that will be used to connect to it (may be DIRECT).
+typedef std::pair<HostPortPair, ProxyServer> HostPortProxyPair;
class BoundNetLog;
class ClientSocketHandle;
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc
index 83bb624..f53d022 100644
--- a/net/spdy/spdy_session_unittest.cc
+++ b/net/spdy/spdy_session_unittest.cc
@@ -80,7 +80,7 @@ TEST_F(SpdySessionTest, GoAway) {
const std::string kTestHost("www.foo.com");
const int kTestPort = 80;
HostPortPair test_host_port_pair(kTestHost, kTestPort);
- HostPortProxyPair pair(test_host_port_pair, "");
+ HostPortProxyPair pair(test_host_port_pair, ProxyServer::Direct());
scoped_refptr<SpdySessionPool> spdy_session_pool(
http_session->spdy_session_pool());
diff --git a/net/spdy/spdy_stream_unittest.cc b/net/spdy/spdy_stream_unittest.cc
index 71664ad..57afd53 100644
--- a/net/spdy/spdy_stream_unittest.cc
+++ b/net/spdy/spdy_stream_unittest.cc
@@ -119,7 +119,7 @@ class SpdyStreamTest : public testing::Test {
scoped_refptr<SpdySession> CreateSpdySession() {
spdy::SpdyFramer::set_enable_compression_default(false);
HostPortPair host_port_pair("www.google.com", 80);
- HostPortProxyPair pair(host_port_pair, "");
+ HostPortProxyPair pair(host_port_pair, ProxyServer::Direct());
scoped_refptr<SpdySession> session(
session_->spdy_session_pool()->Get(pair, session_, BoundNetLog()));
return session;