Index: net/spdy/spdy_session_unittest.cc |
=================================================================== |
--- net/spdy/spdy_session_unittest.cc (revision 92863) |
+++ net/spdy/spdy_session_unittest.cc (working copy) |
@@ -4,6 +4,7 @@ |
#include "net/spdy/spdy_session.h" |
+#include "net/base/ip_endpoint.h" |
#include "net/spdy/spdy_io_buffer.h" |
#include "net/spdy/spdy_session_pool.h" |
#include "net/spdy/spdy_stream.h" |
@@ -416,9 +417,10 @@ |
std::string name; |
std::string iplist; |
HostPortProxyPair pair; |
+ AddressList addresses; |
} test_hosts[] = { |
- { "www.foo.com", "192.168.0.1,192.168.0.5" }, |
- { "images.foo.com", "192.168.0.2,192.168.0.3,192.168.0.5" }, |
+ { "www.foo.com", "192.0.2.33,192.168.0.1,192.168.0.5" }, |
+ { "images.foo.com", "192.168.0.2,192.168.0.3,192.168.0.5,192.0.2.33" }, |
{ "js.foo.com", "192.168.0.4,192.168.0.3" }, |
}; |
@@ -431,9 +433,8 @@ |
// This test requires that the HostResolver cache be populated. Normal |
// code would have done this already, but we do it manually. |
HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort)); |
- AddressList result; |
session_deps.host_resolver->Resolve( |
- info, &result, NULL, NULL, BoundNetLog()); |
+ info, &test_hosts[i].addresses, NULL, NULL, BoundNetLog()); |
// Setup a HostPortProxyPair |
test_hosts[i].pair = HostPortProxyPair( |
@@ -477,6 +478,12 @@ |
BoundNetLog())); |
EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); |
+ // TODO(rtenneti): MockClientSocket::GetPeerAddress return's 0 as the port |
+ // number. Fix it to return port 80 and then use GetPeerAddress to AddAlias. |
+ const addrinfo* address = test_hosts[0].addresses.head(); |
+ SpdySessionPoolPeer pool_peer(spdy_session_pool); |
+ pool_peer.AddAlias(address, test_hosts[0].pair); |
+ |
// Flush the SpdySession::OnReadComplete() task. |
MessageLoop::current()->RunAllPending(); |