Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: net/websockets/websocket_stream_test.cc

Issue 158453004: [ABANDONED] [WebSocket] Remove the trailing slash from the origin header. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/websockets/websocket_stream.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_stream_test.cc
diff --git a/net/websockets/websocket_stream_test.cc b/net/websockets/websocket_stream_test.cc
index de9e2761e8601be95be4274c3228c17392d1cded..8bf6a7b6ffc51f56874c9fd3e878f27494d65938 100644
--- a/net/websockets/websocket_stream_test.cc
+++ b/net/websockets/websocket_stream_test.cc
@@ -200,7 +200,7 @@ class WebSocketStreamCreateExtensionTest : public WebSocketStreamCreateTest {
"ws://localhost/testing_path",
"/testing_path",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
"",
"Sec-WebSocket-Extensions: " + extensions_header_value + "\r\n");
RunUntilIdle();
@@ -210,7 +210,7 @@ class WebSocketStreamCreateExtensionTest : public WebSocketStreamCreateTest {
// Confirm that the basic case works as expected.
TEST_F(WebSocketStreamCreateTest, SimpleSuccess) {
CreateAndConnectStandard(
- "ws://localhost/", "/", NoSubProtocols(), "http://localhost/", "", "");
+ "ws://localhost/", "/", NoSubProtocols(), "http://localhost", "", "");
EXPECT_FALSE(request_info_);
EXPECT_FALSE(response_info_);
RunUntilIdle();
@@ -235,7 +235,7 @@ TEST_F(WebSocketStreamCreateTest, HandshakeInfo) {
"ws://localhost/",
"/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost:8080",
"",
kResponse);
EXPECT_FALSE(request_info_);
@@ -259,7 +259,7 @@ TEST_F(WebSocketStreamCreateTest, HandshakeInfo) {
EXPECT_EQ(HeaderKeyValuePair("Cache-Control", "no-cache"),
request_headers[3]);
EXPECT_EQ(HeaderKeyValuePair("Upgrade", "websocket"), request_headers[4]);
- EXPECT_EQ(HeaderKeyValuePair("Origin", "http://localhost/"),
+ EXPECT_EQ(HeaderKeyValuePair("Origin", "http://localhost:8080"),
request_headers[5]);
EXPECT_EQ(HeaderKeyValuePair("Sec-WebSocket-Version", "13"),
request_headers[6]);
@@ -290,7 +290,7 @@ TEST_F(WebSocketStreamCreateTest, HandshakeInfo) {
// Confirm that the stream isn't established until the message loop runs.
TEST_F(WebSocketStreamCreateTest, NeedsToRunLoop) {
CreateAndConnectStandard(
- "ws://localhost/", "/", NoSubProtocols(), "http://localhost/", "", "");
+ "ws://localhost/", "/", NoSubProtocols(), "http://localhost", "", "");
EXPECT_FALSE(has_failed());
EXPECT_FALSE(stream_);
}
@@ -300,7 +300,7 @@ TEST_F(WebSocketStreamCreateTest, PathIsUsed) {
CreateAndConnectStandard("ws://localhost/testing_path",
"/testing_path",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
"",
"");
RunUntilIdle();
@@ -313,7 +313,7 @@ TEST_F(WebSocketStreamCreateTest, OriginIsUsed) {
CreateAndConnectStandard("ws://localhost/testing_path",
"/testing_path",
NoSubProtocols(),
- "http://google.com/",
+ "http://google.com",
"",
"");
RunUntilIdle();
@@ -329,7 +329,7 @@ TEST_F(WebSocketStreamCreateTest, SubProtocolIsUsed) {
CreateAndConnectStandard("ws://localhost/testing_path",
"/testing_path",
sub_protocols,
- "http://google.com/",
+ "http://google.com",
"Sec-WebSocket-Protocol: chatv11.chromium.org, "
"chatv20.chromium.org\r\n",
"Sec-WebSocket-Protocol: chatv20.chromium.org\r\n");
@@ -344,7 +344,7 @@ TEST_F(WebSocketStreamCreateTest, UnsolicitedSubProtocol) {
CreateAndConnectStandard("ws://localhost/testing_path",
"/testing_path",
NoSubProtocols(),
- "http://google.com/",
+ "http://google.com",
"",
"Sec-WebSocket-Protocol: chatv20.chromium.org\r\n");
RunUntilIdle();
@@ -363,7 +363,7 @@ TEST_F(WebSocketStreamCreateTest, UnacceptedSubProtocol) {
CreateAndConnectStandard("ws://localhost/testing_path",
"/testing_path",
sub_protocols,
- "http://localhost/",
+ "http://localhost",
"Sec-WebSocket-Protocol: chat.example.com\r\n",
"");
RunUntilIdle();
@@ -383,7 +383,7 @@ TEST_F(WebSocketStreamCreateTest, MultipleSubProtocolsInResponse) {
CreateAndConnectStandard("ws://localhost/testing_path",
"/testing_path",
sub_protocols,
- "http://google.com/",
+ "http://google.com",
"Sec-WebSocket-Protocol: chatv11.chromium.org, "
"chatv20.chromium.org\r\n",
"Sec-WebSocket-Protocol: chatv11.chromium.org, "
@@ -405,7 +405,7 @@ TEST_F(WebSocketStreamCreateTest, UnmatchedSubProtocolInResponse) {
CreateAndConnectStandard("ws://localhost/testing_path",
"/testing_path",
sub_protocols,
- "http://google.com/",
+ "http://google.com",
"Sec-WebSocket-Protocol: chatv11.chromium.org, "
"chatv20.chromium.org\r\n",
"Sec-WebSocket-Protocol: chatv21.chromium.org\r\n");
@@ -442,7 +442,7 @@ TEST_F(WebSocketStreamCreateExtensionTest, PerMessageDeflateInflates) {
"ws://localhost/testing_path",
"/testing_path",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
"",
WebSocketStandardResponse(
"Sec-WebSocket-Extensions: permessage-deflate\r\n") +
@@ -627,7 +627,7 @@ TEST_F(WebSocketStreamCreateTest, DoubleAccept) {
"ws://localhost/",
"/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
"",
"Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n");
RunUntilIdle();
@@ -650,7 +650,7 @@ TEST_F(WebSocketStreamCreateTest, InvalidStatusCode) {
CreateAndConnectCustomResponse("ws://localhost/",
"/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
"",
kInvalidStatusCodeResponse);
RunUntilIdle();
@@ -673,7 +673,7 @@ TEST_F(WebSocketStreamCreateTest, RedirectsRejected) {
CreateAndConnectCustomResponse("ws://localhost/",
"/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
"",
kRedirectResponse);
RunUntilIdle();
@@ -697,7 +697,7 @@ TEST_F(WebSocketStreamCreateTest, MalformedResponse) {
CreateAndConnectCustomResponse("ws://localhost/",
"/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
"",
kMalformedResponse);
RunUntilIdle();
@@ -716,7 +716,7 @@ TEST_F(WebSocketStreamCreateTest, MissingUpgradeHeader) {
CreateAndConnectCustomResponse("ws://localhost/",
"/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
"",
kMissingUpgradeResponse);
RunUntilIdle();
@@ -731,7 +731,7 @@ TEST_F(WebSocketStreamCreateTest, DoubleUpgradeHeader) {
"ws://localhost/",
"/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
"", "Upgrade: HTTP/2.0\r\n");
RunUntilIdle();
EXPECT_TRUE(has_failed());
@@ -751,7 +751,7 @@ TEST_F(WebSocketStreamCreateTest, IncorrectUpgradeHeader) {
CreateAndConnectCustomResponse("ws://localhost/",
"/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
"",
kMissingUpgradeResponse);
RunUntilIdle();
@@ -771,7 +771,7 @@ TEST_F(WebSocketStreamCreateTest, MissingConnectionHeader) {
CreateAndConnectCustomResponse("ws://localhost/",
"/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
"",
kMissingConnectionResponse);
RunUntilIdle();
@@ -792,7 +792,7 @@ TEST_F(WebSocketStreamCreateTest, IncorrectConnectionHeader) {
CreateAndConnectCustomResponse("ws://localhost/",
"/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
"",
kMissingConnectionResponse);
RunUntilIdle();
@@ -813,7 +813,7 @@ TEST_F(WebSocketStreamCreateTest, AdditionalTokenInConnectionHeader) {
CreateAndConnectCustomResponse("ws://localhost/",
"/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
"",
kAdditionalConnectionTokenResponse);
RunUntilIdle();
@@ -831,7 +831,7 @@ TEST_F(WebSocketStreamCreateTest, MissingSecWebSocketAccept) {
CreateAndConnectCustomResponse("ws://localhost/",
"/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
"",
kMissingAcceptResponse);
RunUntilIdle();
@@ -852,7 +852,7 @@ TEST_F(WebSocketStreamCreateTest, WrongSecWebSocketAccept) {
CreateAndConnectCustomResponse("ws://localhost/",
"/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
"",
kIncorrectAcceptResponse);
RunUntilIdle();
@@ -865,7 +865,7 @@ TEST_F(WebSocketStreamCreateTest, WrongSecWebSocketAccept) {
// Cancellation works.
TEST_F(WebSocketStreamCreateTest, Cancellation) {
CreateAndConnectStandard(
- "ws://localhost/", "/", NoSubProtocols(), "http://localhost/", "", "");
+ "ws://localhost/", "/", NoSubProtocols(), "http://localhost", "", "");
stream_request_.reset();
RunUntilIdle();
EXPECT_FALSE(has_failed());
@@ -881,7 +881,7 @@ TEST_F(WebSocketStreamCreateTest, ConnectionFailure) {
socket_data->set_connect_data(
MockConnect(SYNCHRONOUS, ERR_CONNECTION_REFUSED));
CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(),
- "http://localhost/", socket_data.Pass());
+ "http://localhost", socket_data.Pass());
RunUntilIdle();
EXPECT_TRUE(has_failed());
EXPECT_EQ("Error in connection establishment: net::ERR_CONNECTION_REFUSED",
@@ -911,7 +911,7 @@ TEST_F(WebSocketStreamCreateTest, CancellationDuringConnect) {
socket_data->set_connect_data(MockConnect(SYNCHRONOUS, ERR_IO_PENDING));
CreateAndConnectRawExpectations("ws://localhost/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
socket_data.Pass());
stream_request_.reset();
RunUntilIdle();
@@ -931,7 +931,7 @@ TEST_F(WebSocketStreamCreateTest, CancellationDuringWrite) {
socket_data->SetStop(1);
CreateAndConnectRawExpectations("ws://localhost/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
make_scoped_ptr(socket_data));
socket_data->Run();
stream_request_.reset();
@@ -944,7 +944,7 @@ TEST_F(WebSocketStreamCreateTest, CancellationDuringWrite) {
// Cancellation during read of the response headers works.
TEST_F(WebSocketStreamCreateTest, CancellationDuringRead) {
- std::string request = WebSocketStandardRequest("/", "http://localhost/", "");
+ std::string request = WebSocketStandardRequest("/", "http://localhost", "");
MockWrite writes[] = {MockWrite(ASYNC, 0, request.c_str())};
MockRead reads[] = {
MockRead(ASYNC, 1, "HTTP/1.1 101 Switching Protocols\r\nUpgr"),
@@ -955,7 +955,7 @@ TEST_F(WebSocketStreamCreateTest, CancellationDuringRead) {
socket_data->SetStop(1);
CreateAndConnectRawExpectations("ws://localhost/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
make_scoped_ptr(socket_data));
socket_data->Run();
stream_request_.reset();
@@ -977,7 +977,7 @@ TEST_F(WebSocketStreamCreateTest, VeryLargeResponseHeaders) {
base::StringPrintf("Set-Cookie: WK-websocket-test-flood-%d=1\r\n", i);
}
CreateAndConnectStandard("ws://localhost/", "/", NoSubProtocols(),
- "http://localhost/", "", set_cookie_headers);
+ "http://localhost", "", set_cookie_headers);
RunUntilIdle();
EXPECT_TRUE(has_failed());
EXPECT_FALSE(response_info_);
@@ -987,7 +987,7 @@ TEST_F(WebSocketStreamCreateTest, VeryLargeResponseHeaders) {
// log the console message "Connection closed before receiving a handshake
// response".
TEST_F(WebSocketStreamCreateTest, NoResponse) {
- std::string request = WebSocketStandardRequest("/", "http://localhost/", "");
+ std::string request = WebSocketStandardRequest("/", "http://localhost", "");
MockWrite writes[] = {MockWrite(ASYNC, request.data(), request.size(), 0)};
MockRead reads[] = {MockRead(ASYNC, 0, 1)};
DeterministicSocketData* socket_data(new DeterministicSocketData(
@@ -995,7 +995,7 @@ TEST_F(WebSocketStreamCreateTest, NoResponse) {
socket_data->set_connect_data(MockConnect(SYNCHRONOUS, OK));
CreateAndConnectRawExpectations("ws://localhost/",
NoSubProtocols(),
- "http://localhost/",
+ "http://localhost",
make_scoped_ptr(socket_data));
socket_data->RunFor(2);
EXPECT_TRUE(has_failed());
« no previous file with comments | « net/websockets/websocket_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698