| Index: jingle/glue/proxy_resolving_client_socket_unittest.cc
|
| diff --git a/jingle/glue/proxy_resolving_client_socket_unittest.cc b/jingle/glue/proxy_resolving_client_socket_unittest.cc
|
| index d784cf3c426402cb9f860378504df715188f782c..66de24744000505a8b93da261eefaef347c5cbc6 100644
|
| --- a/jingle/glue/proxy_resolving_client_socket_unittest.cc
|
| +++ b/jingle/glue/proxy_resolving_client_socket_unittest.cc
|
| @@ -116,5 +116,54 @@ TEST_F(ProxyResolvingClientSocketTest, ReportsBadProxies) {
|
| EXPECT_TRUE(iter != retry_info.end());
|
| }
|
|
|
| +TEST_F(ProxyResolvingClientSocketTest, ReusesHTTPAuthCache) {
|
| + scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter(
|
| + new net::TestURLRequestContextGetter(
|
| + base::ThreadTaskRunnerHandle::Get(),
|
| + std::unique_ptr<net::TestURLRequestContext>(
|
| + new MyTestURLRequestContext)));
|
| + net::MockClientSocketFactory socket_factory;
|
| + net::HostPortPair dest("example.com", 443);
|
| +
|
| + // What the client of the socket expects to read:
|
| + net::MockRead reads[] = {
|
| + net::MockRead("HTTP/1.1 407 Proxy Authentication Required\r\n"
|
| + "Proxy-Authenticate: Basic realm=\"test_realm\"\r\n"
|
| + "\r\n"),
|
| + net::MockRead("HTTP/1.1 200 Success\r\n\r\n")
|
| + };
|
| + // What the client of the socket should write:
|
| + net::MockWrite writes[] = {
|
| + net::MockWrite("CONNECT example.com:443 HTTP/1.1\r\n"
|
| + "Host: example.com:443\r\n"
|
| + "Proxy-Connection: keep-alive\r\n"
|
| + "\r\n"),
|
| + net::MockWrite("CONNECT example.com:443 HTTP/1.1\r\n"
|
| + "Host: example.com:443\r\n"
|
| + "Proxy-Authorization: dXNlcm5hbWU6cGFzc3dvcmQ=\r\n"
|
| + "Proxy-Connection: keep-alive\r\n"
|
| + "\r\n")
|
| + };
|
| + net::StaticSocketDataProvider socket_data(reads, arraysize(reads), writes,
|
| + arraysize(writes));
|
| + socket_data.set_connect_data(net::MockConnect(net::ASYNC, net::OK));
|
| + socket_factory.AddSocketDataProvider(&socket_data);
|
| +
|
| + ProxyResolvingClientSocket proxy_resolving_socket(
|
| + &socket_factory,
|
| + url_request_context_getter,
|
| + net::SSLConfig(),
|
| + dest);
|
| +
|
| + net::TestCompletionCallback callback;
|
| + int status = proxy_resolving_socket.Connect(callback.callback());
|
| + EXPECT_EQ(net::ERR_IO_PENDING, status);
|
| + status = callback.WaitForResult();
|
| + EXPECT_EQ(net::ERR_PROXY_AUTH_REQUESTED, status);
|
| +
|
| + // TODO(cfredric): seed socket factory with credentials, verify that prcs
|
| + // sends those credentials on 407.
|
| +}
|
| +
|
| // TODO(sanjeevr): Add more unit-tests.
|
| } // namespace jingle_glue
|
|
|