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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/websocket/cookie-flood_wsh.py

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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/websocket/cookie-flood_wsh.py
diff --git a/third_party/WebKit/LayoutTests/http/tests/websocket/cookie-flood_wsh.py b/third_party/WebKit/LayoutTests/http/tests/websocket/cookie-flood_wsh.py
index 5cba0bbfff4229dcb7a4018d29436e3aae827c65..70e48793e4c999db3718fae9e78b9056f59ac7a1 100644
--- a/third_party/WebKit/LayoutTests/http/tests/websocket/cookie-flood_wsh.py
+++ b/third_party/WebKit/LayoutTests/http/tests/websocket/cookie-flood_wsh.py
@@ -33,9 +33,22 @@ from mod_pywebsocket import msgutil
def web_socket_do_extra_handshake(request):
# Exact number of headers that will fit in 256KB. Above 256KB an
# ERR_RESPONSE_HEADERS_TOO_BIG error is triggered instead.
- for i in xrange(5978):
- request.extra_headers.append(
- ('Set-Cookie', 'WK-websocket-test-flood-%d=1' % i))
+
+ name = 'Set-Cookie'
+ common_length = len(name + ': ' + '\r\n')
+
+ i = 0
+ total_length = 0
+ while True:
+ value = 'ws-%d=1' % i
+
+ total_length += common_length + len(value)
+ # Subtract 1KB to make sure we have space for the other headers.
+ if total_length >= 256 * 1024 - 1024:
+ break
+
+ request.extra_headers.append((name, value))
+ i += 1
def web_socket_transfer_data(request):
« no previous file with comments | « net/websockets/websocket_stream_test.cc ('k') | third_party/WebKit/LayoutTests/http/tests/websocket/cookie-http-to-ws.pl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698