| Index: net/websockets/websocket_stream_test.cc
|
| diff --git a/net/websockets/websocket_stream_test.cc b/net/websockets/websocket_stream_test.cc
|
| index 91ccdde04359ca0ba34672b8817538ee7418970c..4e259a9438dd142dc68cd8e8bb56f954fd63ac1c 100644
|
| --- a/net/websockets/websocket_stream_test.cc
|
| +++ b/net/websockets/websocket_stream_test.cc
|
| @@ -92,6 +92,7 @@ class WebSocketStreamCreateTest : public ::testing::Test,
|
| const std::string& socket_path,
|
| const std::vector<std::string>& sub_protocols,
|
| const url::Origin& origin,
|
| + const std::string& send_additional_request_headers,
|
| const std::string& extra_request_headers,
|
| const std::string& response_body,
|
| std::unique_ptr<base::Timer> timer = std::unique_ptr<base::Timer>()) {
|
| @@ -99,7 +100,8 @@ class WebSocketStreamCreateTest : public ::testing::Test,
|
| WebSocketStandardRequest(socket_path, socket_host, origin,
|
| extra_request_headers),
|
| response_body);
|
| - CreateAndConnectStream(socket_url, sub_protocols, origin, std::move(timer));
|
| + CreateAndConnectStream(socket_url, sub_protocols, origin,
|
| + send_additional_request_headers, std::move(timer));
|
| }
|
|
|
| // |extra_request_headers| and |extra_response_headers| must end in "\r\n" or
|
| @@ -110,12 +112,13 @@ class WebSocketStreamCreateTest : public ::testing::Test,
|
| const std::string& socket_path,
|
| const std::vector<std::string>& sub_protocols,
|
| const url::Origin& origin,
|
| + const std::string& send_additional_request_headers,
|
| const std::string& extra_request_headers,
|
| const std::string& extra_response_headers,
|
| std::unique_ptr<base::Timer> timer = std::unique_ptr<base::Timer>()) {
|
| CreateAndConnectCustomResponse(
|
| socket_url, socket_host, socket_path, sub_protocols, origin,
|
| - extra_request_headers,
|
| + send_additional_request_headers, extra_request_headers,
|
| WebSocketStandardResponse(extra_response_headers), std::move(timer));
|
| }
|
|
|
| @@ -123,10 +126,12 @@ class WebSocketStreamCreateTest : public ::testing::Test,
|
| const std::string& socket_url,
|
| const std::vector<std::string>& sub_protocols,
|
| const url::Origin& origin,
|
| + const std::string& send_additional_request_headers,
|
| std::unique_ptr<SequencedSocketData> socket_data,
|
| std::unique_ptr<base::Timer> timer = std::unique_ptr<base::Timer>()) {
|
| AddRawExpectations(std::move(socket_data));
|
| - CreateAndConnectStream(socket_url, sub_protocols, origin, std::move(timer));
|
| + CreateAndConnectStream(socket_url, sub_protocols, origin,
|
| + send_additional_request_headers, std::move(timer));
|
| }
|
|
|
| // Add additional raw expectations for sockets created before the final one.
|
| @@ -146,7 +151,7 @@ class WebSocketStreamCreateExtensionTest : public WebSocketStreamCreateTest {
|
| const std::string& extensions_header_value) {
|
| CreateAndConnectStandard(
|
| "ws://localhost/testing_path", "localhost", "/testing_path",
|
| - NoSubProtocols(), LocalhostOrigin(), "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "",
|
| "Sec-WebSocket-Extensions: " + extensions_header_value + "\r\n");
|
| WaitUntilConnectDone();
|
| }
|
| @@ -224,7 +229,7 @@ class WebSocketStreamCreateBasicAuthTest : public WebSocketStreamCreateTest {
|
| const std::string request =
|
| base::StringPrintf(request2format, base64_user_pass.c_str());
|
| CreateAndConnectRawExpectations(
|
| - url, NoSubProtocols(), LocalhostOrigin(),
|
| + url, NoSubProtocols(), LocalhostOrigin(), "",
|
| helper_.BuildSocketData2(request, response2));
|
| }
|
|
|
| @@ -302,7 +307,7 @@ class WebSocketStreamCreateUMATest : public ::testing::Test {
|
| // Confirm that the basic case works as expected.
|
| TEST_F(WebSocketStreamCreateTest, SimpleSuccess) {
|
| CreateAndConnectStandard("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "", "");
|
| + NoSubProtocols(), LocalhostOrigin(), "", "", "");
|
| EXPECT_FALSE(request_info_);
|
| EXPECT_FALSE(response_info_);
|
| WaitUntilConnectDone();
|
| @@ -324,7 +329,7 @@ TEST_F(WebSocketStreamCreateTest, HandshakeInfo) {
|
| "\r\n";
|
|
|
| CreateAndConnectCustomResponse("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "",
|
| kResponse);
|
| EXPECT_FALSE(request_info_);
|
| EXPECT_FALSE(response_info_);
|
| @@ -375,10 +380,58 @@ TEST_F(WebSocketStreamCreateTest, HandshakeInfo) {
|
| EXPECT_EQ(HeaderKeyValuePair("hoge", "piyo"), response_headers[5]);
|
| }
|
|
|
| +// Confirms that request headers are overriden/added after handshake
|
| +TEST_F(WebSocketStreamCreateTest, HandshakeOverrideHeaders) {
|
| + static const char kResponse[] =
|
| + "HTTP/1.1 101 Switching Protocols\r\n"
|
| + "Upgrade: websocket\r\n"
|
| + "Connection: Upgrade\r\n"
|
| + "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n"
|
| + "foo: bar, baz\r\n"
|
| + "hoge: fuga\r\n"
|
| + "hoge: piyo\r\n"
|
| + "\r\n";
|
| + url_request_context_host_.SetExpectations(
|
| + base::StringPrintf("GET / HTTP/1.1\r\n"
|
| + "Host: localhost\r\n"
|
| + "Connection: Upgrade\r\n"
|
| + "Pragma: no-cache\r\n"
|
| + "Cache-Control: no-cache\r\n"
|
| + "Upgrade: websocket\r\n"
|
| + "Origin: %s\r\n"
|
| + "Sec-WebSocket-Version: 13\r\n"
|
| + "User-Agent: OveRrIde\r\n"
|
| + "rAnDomHeader: foobar\r\n"
|
| + "Accept-Encoding: gzip, deflate\r\n"
|
| + "Accept-Language: en-us,fr\r\n"
|
| + "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n"
|
| + "Sec-WebSocket-Extensions: permessage-deflate; "
|
| + "client_max_window_bits\r\n"
|
| + "\r\n",
|
| + LocalhostOrigin().Serialize().c_str()),
|
| + kResponse);
|
| + CreateAndConnectStream("ws://localhost/", NoSubProtocols(), LocalhostOrigin(),
|
| + "User-Agent: OveRrIde\r\n" // Tests overrite header
|
| + "rAnDomHeader: foobar", // Tests adding new header
|
| + std::unique_ptr<base::Timer>());
|
| +
|
| + EXPECT_FALSE(request_info_);
|
| + EXPECT_FALSE(response_info_);
|
| + WaitUntilConnectDone();
|
| + EXPECT_TRUE(stream_);
|
| + ASSERT_TRUE(request_info_);
|
| + ASSERT_TRUE(response_info_);
|
| +
|
| + std::vector<HeaderKeyValuePair> request_headers =
|
| + RequestHeadersToVector(request_info_->headers);
|
| + EXPECT_EQ(HeaderKeyValuePair("User-Agent", "OveRrIde"), request_headers[7]);
|
| + EXPECT_EQ(HeaderKeyValuePair("rAnDomHeader", "foobar"), request_headers[8]);
|
| +}
|
| +
|
| // Confirm that the stream isn't established until the message loop runs.
|
| TEST_F(WebSocketStreamCreateTest, NeedsToRunLoop) {
|
| CreateAndConnectStandard("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "", "");
|
| + NoSubProtocols(), LocalhostOrigin(), "", "", "");
|
| EXPECT_FALSE(has_failed());
|
| EXPECT_FALSE(stream_);
|
| }
|
| @@ -387,7 +440,7 @@ TEST_F(WebSocketStreamCreateTest, NeedsToRunLoop) {
|
| TEST_F(WebSocketStreamCreateTest, PathIsUsed) {
|
| CreateAndConnectStandard("ws://localhost/testing_path", "localhost",
|
| "/testing_path", NoSubProtocols(), LocalhostOrigin(),
|
| - "", "");
|
| + "", "", "");
|
| WaitUntilConnectDone();
|
| EXPECT_FALSE(has_failed());
|
| EXPECT_TRUE(stream_);
|
| @@ -397,7 +450,7 @@ TEST_F(WebSocketStreamCreateTest, PathIsUsed) {
|
| TEST_F(WebSocketStreamCreateTest, OriginIsUsed) {
|
| CreateAndConnectStandard("ws://localhost/testing_path", "localhost",
|
| "/testing_path", NoSubProtocols(), GoogleOrigin(),
|
| - "", "");
|
| + "", "", "");
|
| WaitUntilConnectDone();
|
| EXPECT_FALSE(has_failed());
|
| EXPECT_TRUE(stream_);
|
| @@ -409,7 +462,7 @@ TEST_F(WebSocketStreamCreateTest, SubProtocolIsUsed) {
|
| sub_protocols.push_back("chatv11.chromium.org");
|
| sub_protocols.push_back("chatv20.chromium.org");
|
| CreateAndConnectStandard("ws://localhost/testing_path", "localhost",
|
| - "/testing_path", sub_protocols, GoogleOrigin(),
|
| + "/testing_path", sub_protocols, GoogleOrigin(), "",
|
| "Sec-WebSocket-Protocol: chatv11.chromium.org, "
|
| "chatv20.chromium.org\r\n",
|
| "Sec-WebSocket-Protocol: chatv20.chromium.org\r\n");
|
| @@ -423,7 +476,7 @@ TEST_F(WebSocketStreamCreateTest, SubProtocolIsUsed) {
|
| TEST_F(WebSocketStreamCreateTest, UnsolicitedSubProtocol) {
|
| CreateAndConnectStandard("ws://localhost/testing_path", "localhost",
|
| "/testing_path", NoSubProtocols(), GoogleOrigin(),
|
| - "",
|
| + "", "",
|
| "Sec-WebSocket-Protocol: chatv20.chromium.org\r\n");
|
| WaitUntilConnectDone();
|
| EXPECT_FALSE(stream_);
|
| @@ -440,7 +493,8 @@ TEST_F(WebSocketStreamCreateTest, UnacceptedSubProtocol) {
|
| sub_protocols.push_back("chat.example.com");
|
| CreateAndConnectStandard("ws://localhost/testing_path", "localhost",
|
| "/testing_path", sub_protocols, LocalhostOrigin(),
|
| - "Sec-WebSocket-Protocol: chat.example.com\r\n", "");
|
| + "", "Sec-WebSocket-Protocol: chat.example.com\r\n",
|
| + "");
|
| WaitUntilConnectDone();
|
| EXPECT_FALSE(stream_);
|
| EXPECT_TRUE(has_failed());
|
| @@ -456,7 +510,7 @@ TEST_F(WebSocketStreamCreateTest, MultipleSubProtocolsInResponse) {
|
| sub_protocols.push_back("chatv11.chromium.org");
|
| sub_protocols.push_back("chatv20.chromium.org");
|
| CreateAndConnectStandard("ws://localhost/testing_path", "localhost",
|
| - "/testing_path", sub_protocols, GoogleOrigin(),
|
| + "/testing_path", sub_protocols, GoogleOrigin(), "",
|
| "Sec-WebSocket-Protocol: chatv11.chromium.org, "
|
| "chatv20.chromium.org\r\n",
|
| "Sec-WebSocket-Protocol: chatv11.chromium.org, "
|
| @@ -476,7 +530,7 @@ TEST_F(WebSocketStreamCreateTest, UnmatchedSubProtocolInResponse) {
|
| sub_protocols.push_back("chatv11.chromium.org");
|
| sub_protocols.push_back("chatv20.chromium.org");
|
| CreateAndConnectStandard("ws://localhost/testing_path", "localhost",
|
| - "/testing_path", sub_protocols, GoogleOrigin(),
|
| + "/testing_path", sub_protocols, GoogleOrigin(), "",
|
| "Sec-WebSocket-Protocol: chatv11.chromium.org, "
|
| "chatv20.chromium.org\r\n",
|
| "Sec-WebSocket-Protocol: chatv21.chromium.org\r\n");
|
| @@ -511,7 +565,7 @@ TEST_F(WebSocketStreamCreateExtensionTest, PerMessageDeflateParamsSuccess) {
|
| TEST_F(WebSocketStreamCreateExtensionTest, PerMessageDeflateInflates) {
|
| CreateAndConnectCustomResponse(
|
| "ws://localhost/testing_path", "localhost", "/testing_path",
|
| - NoSubProtocols(), LocalhostOrigin(), "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "",
|
| WebSocketStandardResponse(
|
| "Sec-WebSocket-Extensions: permessage-deflate\r\n") +
|
| std::string(
|
| @@ -586,7 +640,7 @@ TEST_F(WebSocketStreamCreateExtensionTest, NoMaxWindowBitsArgument) {
|
| TEST_F(WebSocketStreamCreateTest, DoubleAccept) {
|
| CreateAndConnectStandard(
|
| "ws://localhost/", "localhost", "/", NoSubProtocols(), LocalhostOrigin(),
|
| - "", "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n");
|
| + "", "", "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n");
|
| WaitUntilConnectDone();
|
| EXPECT_FALSE(stream_);
|
| EXPECT_TRUE(has_failed());
|
| @@ -605,7 +659,7 @@ TEST_F(WebSocketStreamCreateTest, InvalidStatusCode) {
|
| "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n"
|
| "\r\n";
|
| CreateAndConnectCustomResponse("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "",
|
| kInvalidStatusCodeResponse);
|
| WaitUntilConnectDone();
|
| EXPECT_TRUE(has_failed());
|
| @@ -625,7 +679,7 @@ TEST_F(WebSocketStreamCreateTest, RedirectsRejected) {
|
| "\r\n"
|
| "<title>Moved</title><h1>Moved</h1>";
|
| CreateAndConnectCustomResponse("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "",
|
| kRedirectResponse);
|
| WaitUntilConnectDone();
|
| EXPECT_TRUE(has_failed());
|
| @@ -646,7 +700,7 @@ TEST_F(WebSocketStreamCreateTest, MalformedResponse) {
|
| "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n"
|
| "\r\n";
|
| CreateAndConnectCustomResponse("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "",
|
| kMalformedResponse);
|
| WaitUntilConnectDone();
|
| EXPECT_TRUE(has_failed());
|
| @@ -662,7 +716,7 @@ TEST_F(WebSocketStreamCreateTest, MissingUpgradeHeader) {
|
| "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n"
|
| "\r\n";
|
| CreateAndConnectCustomResponse("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "",
|
| kMissingUpgradeResponse);
|
| WaitUntilConnectDone();
|
| EXPECT_TRUE(has_failed());
|
| @@ -673,7 +727,7 @@ TEST_F(WebSocketStreamCreateTest, MissingUpgradeHeader) {
|
| // There must only be one upgrade header.
|
| TEST_F(WebSocketStreamCreateTest, DoubleUpgradeHeader) {
|
| CreateAndConnectStandard("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "",
|
| "Upgrade: HTTP/2.0\r\n");
|
| WaitUntilConnectDone();
|
| EXPECT_TRUE(has_failed());
|
| @@ -691,7 +745,7 @@ TEST_F(WebSocketStreamCreateTest, IncorrectUpgradeHeader) {
|
| "Upgrade: hogefuga\r\n"
|
| "\r\n";
|
| CreateAndConnectCustomResponse("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "",
|
| kMissingUpgradeResponse);
|
| WaitUntilConnectDone();
|
| EXPECT_TRUE(has_failed());
|
| @@ -708,7 +762,7 @@ TEST_F(WebSocketStreamCreateTest, MissingConnectionHeader) {
|
| "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n"
|
| "\r\n";
|
| CreateAndConnectCustomResponse("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "",
|
| kMissingConnectionResponse);
|
| WaitUntilConnectDone();
|
| EXPECT_TRUE(has_failed());
|
| @@ -726,7 +780,7 @@ TEST_F(WebSocketStreamCreateTest, IncorrectConnectionHeader) {
|
| "Connection: hogefuga\r\n"
|
| "\r\n";
|
| CreateAndConnectCustomResponse("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "",
|
| kMissingConnectionResponse);
|
| WaitUntilConnectDone();
|
| EXPECT_TRUE(has_failed());
|
| @@ -744,7 +798,7 @@ TEST_F(WebSocketStreamCreateTest, AdditionalTokenInConnectionHeader) {
|
| "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n"
|
| "\r\n";
|
| CreateAndConnectCustomResponse("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "",
|
| kAdditionalConnectionTokenResponse);
|
| WaitUntilConnectDone();
|
| EXPECT_FALSE(has_failed());
|
| @@ -759,7 +813,7 @@ TEST_F(WebSocketStreamCreateTest, MissingSecWebSocketAccept) {
|
| "Connection: Upgrade\r\n"
|
| "\r\n";
|
| CreateAndConnectCustomResponse("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "",
|
| kMissingAcceptResponse);
|
| WaitUntilConnectDone();
|
| EXPECT_TRUE(has_failed());
|
| @@ -777,7 +831,7 @@ TEST_F(WebSocketStreamCreateTest, WrongSecWebSocketAccept) {
|
| "Sec-WebSocket-Accept: x/byyPZ2tOFvJCGkkugcKvqhhPk=\r\n"
|
| "\r\n";
|
| CreateAndConnectCustomResponse("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "",
|
| kIncorrectAcceptResponse);
|
| WaitUntilConnectDone();
|
| EXPECT_TRUE(has_failed());
|
| @@ -789,7 +843,7 @@ TEST_F(WebSocketStreamCreateTest, WrongSecWebSocketAccept) {
|
| // Cancellation works.
|
| TEST_F(WebSocketStreamCreateTest, Cancellation) {
|
| CreateAndConnectStandard("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "", "");
|
| + NoSubProtocols(), LocalhostOrigin(), "", "", "");
|
| stream_request_.reset();
|
| // WaitUntilConnectDone doesn't work in this case.
|
| base::RunLoop().RunUntilIdle();
|
| @@ -805,7 +859,8 @@ TEST_F(WebSocketStreamCreateTest, ConnectionFailure) {
|
| socket_data->set_connect_data(
|
| MockConnect(SYNCHRONOUS, ERR_CONNECTION_REFUSED));
|
| CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(),
|
| - LocalhostOrigin(), std::move(socket_data));
|
| + LocalhostOrigin(), "",
|
| + std::move(socket_data));
|
| WaitUntilConnectDone();
|
| EXPECT_TRUE(has_failed());
|
| EXPECT_EQ("Error in connection establishment: net::ERR_CONNECTION_REFUSED",
|
| @@ -820,7 +875,8 @@ TEST_F(WebSocketStreamCreateTest, ConnectionTimeout) {
|
| socket_data->set_connect_data(
|
| MockConnect(ASYNC, ERR_CONNECTION_TIMED_OUT));
|
| CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(),
|
| - LocalhostOrigin(), std::move(socket_data));
|
| + LocalhostOrigin(), "",
|
| + std::move(socket_data));
|
| WaitUntilConnectDone();
|
| EXPECT_TRUE(has_failed());
|
| EXPECT_EQ("Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT",
|
| @@ -834,7 +890,7 @@ TEST_F(WebSocketStreamCreateTest, HandshakeTimeout) {
|
| std::unique_ptr<MockWeakTimer> timer(new MockWeakTimer(false, false));
|
| base::WeakPtr<MockWeakTimer> weak_timer = timer->AsWeakPtr();
|
| CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(),
|
| - LocalhostOrigin(), std::move(socket_data),
|
| + LocalhostOrigin(), "", std::move(socket_data),
|
| std::move(timer));
|
| EXPECT_FALSE(has_failed());
|
| ASSERT_TRUE(weak_timer.get());
|
| @@ -855,7 +911,7 @@ TEST_F(WebSocketStreamCreateTest, HandshakeTimerOnSuccess) {
|
| base::WeakPtr<MockWeakTimer> weak_timer = timer->AsWeakPtr();
|
|
|
| CreateAndConnectStandard("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "", "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "", "",
|
| std::move(timer));
|
| ASSERT_TRUE(weak_timer);
|
| EXPECT_TRUE(weak_timer->IsRunning());
|
| @@ -875,7 +931,7 @@ TEST_F(WebSocketStreamCreateTest, HandshakeTimerOnFailure) {
|
| std::unique_ptr<MockWeakTimer> timer(new MockWeakTimer(false, false));
|
| base::WeakPtr<MockWeakTimer> weak_timer = timer->AsWeakPtr();
|
| CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(),
|
| - LocalhostOrigin(), std::move(socket_data),
|
| + LocalhostOrigin(), "", std::move(socket_data),
|
| std::move(timer));
|
| ASSERT_TRUE(weak_timer.get());
|
| EXPECT_TRUE(weak_timer->IsRunning());
|
| @@ -893,7 +949,8 @@ TEST_F(WebSocketStreamCreateTest, CancellationDuringConnect) {
|
| std::unique_ptr<SequencedSocketData> socket_data(BuildNullSocketData());
|
| socket_data->set_connect_data(MockConnect(SYNCHRONOUS, ERR_IO_PENDING));
|
| CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(),
|
| - LocalhostOrigin(), std::move(socket_data));
|
| + LocalhostOrigin(), "",
|
| + std::move(socket_data));
|
| stream_request_.reset();
|
| // WaitUntilConnectDone doesn't work in this case.
|
| base::RunLoop().RunUntilIdle();
|
| @@ -909,7 +966,7 @@ TEST_F(WebSocketStreamCreateTest, CancellationDuringWrite) {
|
| new SequencedSocketData(NULL, 0, writes, arraysize(writes)));
|
| socket_data->set_connect_data(MockConnect(SYNCHRONOUS, OK));
|
| CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(),
|
| - LocalhostOrigin(),
|
| + LocalhostOrigin(), "",
|
| base::WrapUnique(socket_data));
|
| base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(socket_data->AllWriteDataConsumed());
|
| @@ -934,7 +991,8 @@ TEST_F(WebSocketStreamCreateTest, CancellationDuringRead) {
|
| BuildSocketData(reads, writes));
|
| SequencedSocketData* socket_data_raw_ptr = socket_data.get();
|
| CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(),
|
| - LocalhostOrigin(), std::move(socket_data));
|
| + LocalhostOrigin(), "",
|
| + std::move(socket_data));
|
| base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(socket_data_raw_ptr->AllReadDataConsumed());
|
| stream_request_.reset();
|
| @@ -957,7 +1015,7 @@ TEST_F(WebSocketStreamCreateTest, VeryLargeResponseHeaders) {
|
| base::StringPrintf("Set-Cookie: WK-websocket-test-flood-%d=1\r\n", i);
|
| }
|
| CreateAndConnectStandard("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "",
|
| set_cookie_headers);
|
| WaitUntilConnectDone();
|
| EXPECT_TRUE(has_failed());
|
| @@ -976,7 +1034,8 @@ TEST_F(WebSocketStreamCreateTest, NoResponse) {
|
| BuildSocketData(reads, writes));
|
| SequencedSocketData* socket_data_raw_ptr = socket_data.get();
|
| CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(),
|
| - LocalhostOrigin(), std::move(socket_data));
|
| + LocalhostOrigin(), "",
|
| + std::move(socket_data));
|
| base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(socket_data_raw_ptr->AllReadDataConsumed());
|
| EXPECT_TRUE(has_failed());
|
| @@ -994,7 +1053,7 @@ TEST_F(WebSocketStreamCreateTest, SelfSignedCertificateFailure) {
|
| ASSERT_TRUE(ssl_data_[0]->cert.get());
|
| std::unique_ptr<SequencedSocketData> raw_socket_data(BuildNullSocketData());
|
| CreateAndConnectRawExpectations("wss://localhost/", NoSubProtocols(),
|
| - LocalhostOrigin(),
|
| + LocalhostOrigin(), "",
|
| std::move(raw_socket_data));
|
| // WaitUntilConnectDone doesn't work in this case.
|
| base::RunLoop().RunUntilIdle();
|
| @@ -1017,7 +1076,7 @@ TEST_F(WebSocketStreamCreateTest, SelfSignedCertificateSuccess) {
|
| ssl_data_.push_back(std::move(ssl_data));
|
| url_request_context_host_.AddRawExpectations(BuildNullSocketData());
|
| CreateAndConnectStandard("wss://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "", "");
|
| + NoSubProtocols(), LocalhostOrigin(), "", "", "");
|
| // WaitUntilConnectDone doesn't work in this case.
|
| base::RunLoop().RunUntilIdle();
|
| ASSERT_TRUE(ssl_error_callbacks_);
|
| @@ -1031,7 +1090,7 @@ TEST_F(WebSocketStreamCreateTest, SelfSignedCertificateSuccess) {
|
| // connection should fail cleanly.
|
| TEST_F(WebSocketStreamCreateBasicAuthTest, FailureNoCredentials) {
|
| CreateAndConnectCustomResponse("ws://localhost/", "localhost", "/",
|
| - NoSubProtocols(), LocalhostOrigin(), "",
|
| + NoSubProtocols(), LocalhostOrigin(), "", "",
|
| kUnauthorizedResponse);
|
| WaitUntilConnectDone();
|
| EXPECT_TRUE(has_failed());
|
| @@ -1066,7 +1125,7 @@ TEST_F(WebSocketStreamCreateDigestAuthTest, DigestPasswordInUrl) {
|
| AddRawExpectations(helper_.BuildSocketData1(kUnauthorizedResponse));
|
|
|
| CreateAndConnectRawExpectations(
|
| - "ws://FooBar:pass@localhost/", NoSubProtocols(), LocalhostOrigin(),
|
| + "ws://FooBar:pass@localhost/", NoSubProtocols(), LocalhostOrigin(), "",
|
| helper_.BuildSocketData2(kAuthorizedRequest,
|
| WebSocketStandardResponse(std::string())));
|
| WaitUntilConnectDone();
|
| @@ -1084,7 +1143,7 @@ TEST_F(WebSocketStreamCreateUMATest, Incomplete) {
|
| StreamCreation creation;
|
| creation.CreateAndConnectStandard("ws://localhost/", "localhost", "/",
|
| creation.NoSubProtocols(),
|
| - LocalhostOrigin(), "", "");
|
| + LocalhostOrigin(), "", "", "");
|
| }
|
|
|
| std::unique_ptr<base::HistogramSamples> samples(GetSamples(name));
|
| @@ -1105,7 +1164,7 @@ TEST_F(WebSocketStreamCreateUMATest, Connected) {
|
| StreamCreation creation;
|
| creation.CreateAndConnectStandard("ws://localhost/", "localhost", "/",
|
| creation.NoSubProtocols(),
|
| - LocalhostOrigin(), "", "");
|
| + LocalhostOrigin(), "", "", "");
|
| creation.WaitUntilConnectDone();
|
| }
|
|
|
| @@ -1133,7 +1192,7 @@ TEST_F(WebSocketStreamCreateUMATest, Failed) {
|
| "\r\n";
|
| creation.CreateAndConnectCustomResponse(
|
| "ws://localhost/", "localhost", "/", creation.NoSubProtocols(),
|
| - LocalhostOrigin(), "", kInvalidStatusCodeResponse);
|
| + LocalhostOrigin(), "", "", kInvalidStatusCodeResponse);
|
| creation.WaitUntilConnectDone();
|
| }
|
|
|
| @@ -1166,7 +1225,8 @@ TEST_F(WebSocketStreamCreateTest, HandleErrConnectionClosed) {
|
| BuildSocketData(reads, writes));
|
| socket_data->set_connect_data(MockConnect(SYNCHRONOUS, OK));
|
| CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(),
|
| - LocalhostOrigin(), std::move(socket_data));
|
| + LocalhostOrigin(), "",
|
| + std::move(socket_data));
|
| WaitUntilConnectDone();
|
| EXPECT_TRUE(has_failed());
|
| }
|
| @@ -1192,7 +1252,8 @@ TEST_F(WebSocketStreamCreateTest, HandleErrTunnelConnectionFailed) {
|
| BuildSocketData(reads, writes));
|
| url_request_context_host_.SetProxyConfig("https=proxy:8000");
|
| CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(),
|
| - LocalhostOrigin(), std::move(socket_data));
|
| + LocalhostOrigin(), "",
|
| + std::move(socket_data));
|
| WaitUntilConnectDone();
|
| EXPECT_TRUE(has_failed());
|
| EXPECT_EQ("Establishing a tunnel via proxy server failed.",
|
|
|