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

Side by Side Diff: net/websockets/websocket_stream_test.cc

Issue 173523004: Use a better error message for bad status lines. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update WebSocketStreamCreateTest.MalformedResponse 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 unified diff | Download patch
« no previous file with comments | « net/websockets/websocket_basic_handshake_stream.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/websockets/websocket_stream.h" 5 #include "net/websockets/websocket_stream.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n" 696 "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n"
697 "\r\n"; 697 "\r\n";
698 CreateAndConnectCustomResponse("ws://localhost/", 698 CreateAndConnectCustomResponse("ws://localhost/",
699 "/", 699 "/",
700 NoSubProtocols(), 700 NoSubProtocols(),
701 "http://localhost/", 701 "http://localhost/",
702 "", 702 "",
703 kMalformedResponse); 703 kMalformedResponse);
704 RunUntilIdle(); 704 RunUntilIdle();
705 EXPECT_TRUE(has_failed()); 705 EXPECT_TRUE(has_failed());
706 EXPECT_EQ("Error during WebSocket handshake: Unexpected response code: 200", 706 EXPECT_EQ("Error during WebSocket handshake: Invalid status line",
707 failure_message()); 707 failure_message());
708 } 708 }
709 709
710 // Upgrade header must be present. 710 // Upgrade header must be present.
711 TEST_F(WebSocketStreamCreateTest, MissingUpgradeHeader) { 711 TEST_F(WebSocketStreamCreateTest, MissingUpgradeHeader) {
712 static const char kMissingUpgradeResponse[] = 712 static const char kMissingUpgradeResponse[] =
713 "HTTP/1.1 101 Switching Protocols\r\n" 713 "HTTP/1.1 101 Switching Protocols\r\n"
714 "Connection: Upgrade\r\n" 714 "Connection: Upgrade\r\n"
715 "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n" 715 "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n"
716 "\r\n"; 716 "\r\n";
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 socket_data->RunFor(2); 1001 socket_data->RunFor(2);
1002 EXPECT_TRUE(has_failed()); 1002 EXPECT_TRUE(has_failed());
1003 EXPECT_FALSE(stream_); 1003 EXPECT_FALSE(stream_);
1004 EXPECT_FALSE(response_info_); 1004 EXPECT_FALSE(response_info_);
1005 EXPECT_EQ("Connection closed before receiving a handshake response", 1005 EXPECT_EQ("Connection closed before receiving a handshake response",
1006 failure_message()); 1006 failure_message());
1007 } 1007 }
1008 1008
1009 } // namespace 1009 } // namespace
1010 } // namespace net 1010 } // namespace net
OLDNEW
« no previous file with comments | « net/websockets/websocket_basic_handshake_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698