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

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

Issue 2123743002: Rename cookie names in WebSocket cookie tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed cookie flooding test amount Created 4 years, 5 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 | « no previous file | third_party/WebKit/LayoutTests/http/tests/websocket/cookie-flood_wsh.py » ('j') | 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 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 EXPECT_FALSE(stream_); 981 EXPECT_FALSE(stream_);
982 EXPECT_TRUE(request_info_); 982 EXPECT_TRUE(request_info_);
983 EXPECT_FALSE(response_info_); 983 EXPECT_FALSE(response_info_);
984 } 984 }
985 985
986 // Over-size response headers (> 256KB) should not cause a crash. This is a 986 // Over-size response headers (> 256KB) should not cause a crash. This is a
987 // regression test for crbug.com/339456. It is based on the layout test 987 // regression test for crbug.com/339456. It is based on the layout test
988 // "cookie-flood.html". 988 // "cookie-flood.html".
989 TEST_F(WebSocketStreamCreateTest, VeryLargeResponseHeaders) { 989 TEST_F(WebSocketStreamCreateTest, VeryLargeResponseHeaders) {
990 std::string set_cookie_headers; 990 std::string set_cookie_headers;
991 set_cookie_headers.reserve(45 * 10000); 991 set_cookie_headers.reserve(24 * 20000);
992 for (int i = 0; i < 10000; ++i) { 992 for (int i = 0; i < 20000; ++i) {
993 set_cookie_headers += 993 set_cookie_headers += base::StringPrintf("Set-Cookie: ws-%d=1\r\n", i);
994 base::StringPrintf("Set-Cookie: WK-websocket-test-flood-%d=1\r\n", i);
995 } 994 }
995 ASSERT_GT(set_cookie_headers.size(), 256U * 1024U);
996 CreateAndConnectStandard("ws://localhost/", "localhost", "/", 996 CreateAndConnectStandard("ws://localhost/", "localhost", "/",
997 NoSubProtocols(), LocalhostOrigin(), "", "", 997 NoSubProtocols(), LocalhostOrigin(), "", "",
998 set_cookie_headers); 998 set_cookie_headers);
999 WaitUntilConnectDone(); 999 WaitUntilConnectDone();
1000 EXPECT_TRUE(has_failed()); 1000 EXPECT_TRUE(has_failed());
1001 EXPECT_FALSE(response_info_); 1001 EXPECT_FALSE(response_info_);
1002 } 1002 }
1003 1003
1004 // If the remote host closes the connection without sending headers, we should 1004 // If the remote host closes the connection without sending headers, we should
1005 // log the console message "Connection closed before receiving a handshake 1005 // log the console message "Connection closed before receiving a handshake
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 LocalhostOrigin(), "", 1234 LocalhostOrigin(), "",
1235 std::move(socket_data)); 1235 std::move(socket_data));
1236 WaitUntilConnectDone(); 1236 WaitUntilConnectDone();
1237 EXPECT_TRUE(has_failed()); 1237 EXPECT_TRUE(has_failed());
1238 EXPECT_EQ("Establishing a tunnel via proxy server failed.", 1238 EXPECT_EQ("Establishing a tunnel via proxy server failed.",
1239 failure_message()); 1239 failure_message());
1240 } 1240 }
1241 1241
1242 } // namespace 1242 } // namespace
1243 } // namespace net 1243 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/websocket/cookie-flood_wsh.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698