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

Unified Diff: net/websockets/websocket_stream_test.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
Index: net/websockets/websocket_stream_test.cc
diff --git a/net/websockets/websocket_stream_test.cc b/net/websockets/websocket_stream_test.cc
index 4ea8538b76273c28af1164db13b8e145192a3770..14cfa0ba530beadd5c94cea048557449e5daae36 100644
--- a/net/websockets/websocket_stream_test.cc
+++ b/net/websockets/websocket_stream_test.cc
@@ -79,7 +79,7 @@ class DeterministicKeyWebSocketHandshakeStreamCreateHelper
class WebSocketStreamCreateTest : public ::testing::Test {
public:
- WebSocketStreamCreateTest(): has_failed_(false) {}
+ WebSocketStreamCreateTest() : has_failed_(false) {}
void CreateAndConnectCustomResponse(
const std::string& socket_url,
@@ -257,13 +257,12 @@ TEST_F(WebSocketStreamCreateTest, HandshakeInfo) {
"hoge: piyo\r\n"
"\r\n";
- CreateAndConnectCustomResponse(
- "ws://localhost/",
- "/",
- NoSubProtocols(),
- "http://localhost",
- "",
- kResponse);
+ CreateAndConnectCustomResponse("ws://localhost/",
+ "/",
+ NoSubProtocols(),
+ "http://localhost",
+ "",
+ kResponse);
EXPECT_FALSE(request_info_);
EXPECT_FALSE(response_info_);
RunUntilIdle();
@@ -294,7 +293,7 @@ TEST_F(WebSocketStreamCreateTest, HandshakeInfo) {
request_headers[8]);
EXPECT_EQ(HeaderKeyValuePair("Accept-Language", "en-us,fr"),
request_headers[9]);
- EXPECT_EQ("Sec-WebSocket-Key", request_headers[10].first);
+ EXPECT_EQ("Sec-WebSocket-Key", request_headers[10].first);
EXPECT_EQ(HeaderKeyValuePair("Sec-WebSocket-Extensions",
"permessage-deflate; client_max_window_bits"),
request_headers[11]);
@@ -376,10 +375,11 @@ TEST_F(WebSocketStreamCreateTest, UnsolicitedSubProtocol) {
RunUntilIdle();
EXPECT_FALSE(stream_);
EXPECT_TRUE(has_failed());
- EXPECT_EQ("Error during WebSocket handshake: "
- "Response must not include 'Sec-WebSocket-Protocol' header "
- "if not present in request: chatv20.chromium.org",
- failure_message());
+ EXPECT_EQ(
+ "Error during WebSocket handshake: "
+ "Response must not include 'Sec-WebSocket-Protocol' header "
+ "if not present in request: chatv20.chromium.org",
+ failure_message());
}
// Missing sub-protocol response is rejected.
@@ -395,10 +395,11 @@ TEST_F(WebSocketStreamCreateTest, UnacceptedSubProtocol) {
RunUntilIdle();
EXPECT_FALSE(stream_);
EXPECT_TRUE(has_failed());
- EXPECT_EQ("Error during WebSocket handshake: "
- "Sent non-empty 'Sec-WebSocket-Protocol' header "
- "but no response was received",
- failure_message());
+ EXPECT_EQ(
+ "Error during WebSocket handshake: "
+ "Sent non-empty 'Sec-WebSocket-Protocol' header "
+ "but no response was received",
+ failure_message());
}
// Only one sub-protocol can be accepted.
@@ -417,10 +418,11 @@ TEST_F(WebSocketStreamCreateTest, MultipleSubProtocolsInResponse) {
RunUntilIdle();
EXPECT_FALSE(stream_);
EXPECT_TRUE(has_failed());
- EXPECT_EQ("Error during WebSocket handshake: "
- "'Sec-WebSocket-Protocol' header must not appear "
- "more than once in a response",
- failure_message());
+ EXPECT_EQ(
+ "Error during WebSocket handshake: "
+ "'Sec-WebSocket-Protocol' header must not appear "
+ "more than once in a response",
+ failure_message());
}
// Unmatched sub-protocol should be rejected.
@@ -438,10 +440,11 @@ TEST_F(WebSocketStreamCreateTest, UnmatchedSubProtocolInResponse) {
RunUntilIdle();
EXPECT_FALSE(stream_);
EXPECT_TRUE(has_failed());
- EXPECT_EQ("Error during WebSocket handshake: "
- "'Sec-WebSocket-Protocol' header value 'chatv21.chromium.org' "
- "in response does not match any of sent values",
- failure_message());
+ EXPECT_EQ(
+ "Error during WebSocket handshake: "
+ "'Sec-WebSocket-Protocol' header value 'chatv21.chromium.org' "
+ "in response does not match any of sent values",
+ failure_message());
}
// permessage-deflate extension basic success case.
@@ -492,10 +495,11 @@ TEST_F(WebSocketStreamCreateExtensionTest, UnknownExtension) {
CreateAndConnectWithExtensions("x-unknown-extension");
EXPECT_FALSE(stream_);
EXPECT_TRUE(has_failed());
- EXPECT_EQ("Error during WebSocket handshake: "
- "Found an unsupported extension 'x-unknown-extension' "
- "in 'Sec-WebSocket-Extensions' header",
- failure_message());
+ EXPECT_EQ(
+ "Error during WebSocket handshake: "
+ "Found an unsupported extension 'x-unknown-extension' "
+ "in 'Sec-WebSocket-Extensions' header",
+ failure_message());
}
// Malformed extensions are rejected (this file does not cover all possible
@@ -660,10 +664,11 @@ TEST_F(WebSocketStreamCreateTest, DoubleAccept) {
RunUntilIdle();
EXPECT_FALSE(stream_);
EXPECT_TRUE(has_failed());
- EXPECT_EQ("Error during WebSocket handshake: "
- "'Sec-WebSocket-Accept' header must not appear "
- "more than once in a response",
- failure_message());
+ EXPECT_EQ(
+ "Error during WebSocket handshake: "
+ "'Sec-WebSocket-Accept' header must not appear "
+ "more than once in a response",
+ failure_message());
}
// Response code 200 must be rejected.
@@ -754,17 +759,18 @@ TEST_F(WebSocketStreamCreateTest, MissingUpgradeHeader) {
// There must only be one upgrade header.
TEST_F(WebSocketStreamCreateTest, DoubleUpgradeHeader) {
- CreateAndConnectStandard(
- "ws://localhost/",
- "/",
- NoSubProtocols(),
- "http://localhost",
- "", "Upgrade: HTTP/2.0\r\n");
+ CreateAndConnectStandard("ws://localhost/",
+ "/",
+ NoSubProtocols(),
+ "http://localhost",
+ "",
+ "Upgrade: HTTP/2.0\r\n");
RunUntilIdle();
EXPECT_TRUE(has_failed());
- EXPECT_EQ("Error during WebSocket handshake: "
- "'Upgrade' header must not appear more than once in a response",
- failure_message());
+ EXPECT_EQ(
+ "Error during WebSocket handshake: "
+ "'Upgrade' header must not appear more than once in a response",
+ failure_message());
}
// There must only be one correct upgrade header.
@@ -783,9 +789,10 @@ TEST_F(WebSocketStreamCreateTest, IncorrectUpgradeHeader) {
kMissingUpgradeResponse);
RunUntilIdle();
EXPECT_TRUE(has_failed());
- EXPECT_EQ("Error during WebSocket handshake: "
- "'Upgrade' header value is not 'WebSocket': hogefuga",
- failure_message());
+ EXPECT_EQ(
+ "Error during WebSocket handshake: "
+ "'Upgrade' header value is not 'WebSocket': hogefuga",
+ failure_message());
}
// Connection header must be present.
@@ -803,9 +810,10 @@ TEST_F(WebSocketStreamCreateTest, MissingConnectionHeader) {
kMissingConnectionResponse);
RunUntilIdle();
EXPECT_TRUE(has_failed());
- EXPECT_EQ("Error during WebSocket handshake: "
- "'Connection' header is missing",
- failure_message());
+ EXPECT_EQ(
+ "Error during WebSocket handshake: "
+ "'Connection' header is missing",
+ failure_message());
}
// Connection header must contain "Upgrade".
@@ -824,9 +832,10 @@ TEST_F(WebSocketStreamCreateTest, IncorrectConnectionHeader) {
kMissingConnectionResponse);
RunUntilIdle();
EXPECT_TRUE(has_failed());
- EXPECT_EQ("Error during WebSocket handshake: "
- "'Connection' header value must contain 'Upgrade'",
- failure_message());
+ EXPECT_EQ(
+ "Error during WebSocket handshake: "
+ "'Connection' header value must contain 'Upgrade'",
+ failure_message());
}
// Connection header is permitted to contain other tokens.
@@ -863,9 +872,10 @@ TEST_F(WebSocketStreamCreateTest, MissingSecWebSocketAccept) {
kMissingAcceptResponse);
RunUntilIdle();
EXPECT_TRUE(has_failed());
- EXPECT_EQ("Error during WebSocket handshake: "
- "'Sec-WebSocket-Accept' header is missing",
- failure_message());
+ EXPECT_EQ(
+ "Error during WebSocket handshake: "
+ "'Sec-WebSocket-Accept' header is missing",
+ failure_message());
}
// Sec-WebSocket-Accept header must match the key that was sent.
@@ -884,9 +894,10 @@ TEST_F(WebSocketStreamCreateTest, WrongSecWebSocketAccept) {
kIncorrectAcceptResponse);
RunUntilIdle();
EXPECT_TRUE(has_failed());
- EXPECT_EQ("Error during WebSocket handshake: "
- "Incorrect 'Sec-WebSocket-Accept' header value",
- failure_message());
+ EXPECT_EQ(
+ "Error during WebSocket handshake: "
+ "Incorrect 'Sec-WebSocket-Accept' header value",
+ failure_message());
}
// Cancellation works.
@@ -907,8 +918,10 @@ TEST_F(WebSocketStreamCreateTest, ConnectionFailure) {
new DeterministicSocketData(NULL, 0, NULL, 0));
socket_data->set_connect_data(
MockConnect(SYNCHRONOUS, ERR_CONNECTION_REFUSED));
- CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(),
- "http://localhost", socket_data.Pass());
+ CreateAndConnectRawExpectations("ws://localhost/",
+ NoSubProtocols(),
+ "http://localhost",
+ socket_data.Pass());
RunUntilIdle();
EXPECT_TRUE(has_failed());
EXPECT_EQ("Error in connection establishment: net::ERR_CONNECTION_REFUSED",
@@ -921,10 +934,11 @@ TEST_F(WebSocketStreamCreateTest, ConnectionFailure) {
TEST_F(WebSocketStreamCreateTest, ConnectionTimeout) {
scoped_ptr<DeterministicSocketData> socket_data(
new DeterministicSocketData(NULL, 0, NULL, 0));
- socket_data->set_connect_data(
- MockConnect(ASYNC, ERR_CONNECTION_TIMED_OUT));
- CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(),
- "http://localhost", socket_data.Pass());
+ socket_data->set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_TIMED_OUT));
+ CreateAndConnectRawExpectations("ws://localhost/",
+ NoSubProtocols(),
+ "http://localhost",
+ socket_data.Pass());
RunUntilIdle();
EXPECT_TRUE(has_failed());
EXPECT_EQ("Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT",
@@ -974,7 +988,7 @@ TEST_F(WebSocketStreamCreateTest, CancellationDuringRead) {
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"),
+ MockRead(ASYNC, 1, "HTTP/1.1 101 Switching Protocols\r\nUpgr"),
};
DeterministicSocketData* socket_data(new DeterministicSocketData(
reads, arraysize(reads), writes, arraysize(writes)));
@@ -1003,8 +1017,12 @@ TEST_F(WebSocketStreamCreateTest, VeryLargeResponseHeaders) {
set_cookie_headers +=
base::StringPrintf("Set-Cookie: WK-websocket-test-flood-%d=1\r\n", i);
}
- CreateAndConnectStandard("ws://localhost/", "/", NoSubProtocols(),
- "http://localhost", "", set_cookie_headers);
+ CreateAndConnectStandard("ws://localhost/",
+ "/",
+ NoSubProtocols(),
+ "http://localhost",
+ "",
+ set_cookie_headers);
RunUntilIdle();
EXPECT_TRUE(has_failed());
EXPECT_FALSE(response_info_);

Powered by Google App Engine
This is Rietveld 408576698