Commit 06d647ed authored by Lily Chen's avatar Lily Chen Committed by Commit Bot

Add unit test for changing priority of an SSLClientSocketPool request

New unit test checks that setting the priority of a request to an
SSLClientSocketPool layered on top of a HttpProxyClientSocketPool
passes the priority change all the way down to the transport socket
pool.

Bug: 166689
Change-Id: I4a4b00106659a65ea75689c5cea1c4e44266bb13
Reviewed-on: https://chromium-review.googlesource.com/c/1356865Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Commit-Queue: Lily Chen <chlily@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612748}
parent 8eb3f00f
......@@ -720,9 +720,46 @@ TEST_F(SSLClientSocketPoolTest, SetTransportPriorityOnInitHTTP) {
EXPECT_EQ(HIGHEST, transport_socket_pool_.requests()[0]->priority());
}
// TODO(chlily): Test that the SSLConnectJob passes priority changes down to the
// transport socket pool (for the HTTP_PROXY case), once change priority is
// implemented for HttpProxyClientSocketPool.
// Test that the SSLConnectJob passes priority changes down to the transport
// socket pool (for the HTTP_PROXY case).
TEST_F(SSLClientSocketPoolTest, SetSocketRequestPriorityHTTP) {
MockWrite writes[] = {
MockWrite("CONNECT host:80 HTTP/1.1\r\n"
"Host: host:80\r\n"
"Proxy-Connection: keep-alive\r\n"
"Proxy-Authorization: Basic Zm9vOmJhcg==\r\n\r\n"),
};
MockRead reads[] = {
MockRead("HTTP/1.1 200 Connection Established\r\n\r\n"),
};
StaticSocketDataProvider data(reads, writes);
socket_factory_.AddSocketDataProvider(&data);
AddAuthToCache();
SSLSocketDataProvider ssl(ASYNC, OK);
socket_factory_.AddSSLSocketDataProvider(&ssl);
CreatePool(false, true /* http proxy pool */, true /* socks pool */);
scoped_refptr<SSLSocketParams> params = SSLParams(ProxyServer::SCHEME_HTTP);
ClientSocketHandle handle;
TestCompletionCallback callback;
int rv = handle.Init(kGroupName, params, MEDIUM, SocketTag(),
ClientSocketPool::RespectLimits::ENABLED,
callback.callback(), pool_.get(), NetLogWithSource());
EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
EXPECT_FALSE(handle.is_initialized());
EXPECT_FALSE(handle.socket());
EXPECT_EQ(MEDIUM, transport_socket_pool_.last_request_priority());
EXPECT_EQ(MEDIUM, transport_socket_pool_.requests()[0]->priority());
handle.SetPriority(HIGHEST);
EXPECT_EQ(HIGHEST, transport_socket_pool_.requests()[0]->priority());
EXPECT_THAT(callback.WaitForResult(), IsOk());
EXPECT_TRUE(handle.is_initialized());
EXPECT_TRUE(handle.socket());
}
TEST_F(SSLClientSocketPoolTest, HttpProxyBasicAsync) {
MockWrite writes[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment