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

Unified Diff: net/websockets/websocket_stream_test.cc

Issue 895853003: Update from https://crrev.com/314320 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 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_end_to_end_test.cc ('k') | sandbox/linux/BUILD.gn » ('j') | 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 0fdc34b93bba51aef06abaf6a4c3fb468d9dae93..713af37715f2b427b8ec9f76a1c8e7b488c892c7 100644
--- a/net/websockets/websocket_stream_test.cc
+++ b/net/websockets/websocket_stream_test.cc
@@ -1388,5 +1388,29 @@ TEST_F(WebSocketStreamCreateUMATest, Failed) {
EXPECT_EQ(0, samples->GetCount(FAILED));
}
+TEST_F(WebSocketStreamCreateTest, HandleErrConnectionClosed) {
+ static const char kTruncatedResponse[] =
+ "HTTP/1.1 101 Switching Protocols\r\n"
+ "Upgrade: websocket\r\n"
+ "Connection: Upgrade\r\n"
+ "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n"
+ "Cache-Control: no-sto";
+
+ std::string request =
+ WebSocketStandardRequest("/", "localhost", "http://localhost", "");
+ MockRead reads[] = {
+ MockRead(SYNCHRONOUS, 1, kTruncatedResponse),
+ MockRead(SYNCHRONOUS, ERR_CONNECTION_CLOSED, 2),
+ };
+ MockWrite writes[] = {MockWrite(SYNCHRONOUS, 0, request.c_str())};
+ scoped_ptr<DeterministicSocketData> socket_data(
+ BuildSocketData(reads, writes));
+ socket_data->set_connect_data(MockConnect(SYNCHRONOUS, OK));
+ CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(),
+ "http://localhost", socket_data.Pass());
+ RunUntilIdle();
+ EXPECT_TRUE(has_failed());
+}
+
} // namespace
} // namespace net
« no previous file with comments | « net/websockets/websocket_end_to_end_test.cc ('k') | sandbox/linux/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698