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

Unified Diff: net/spdy/spdy_websocket_test_util_spdy3.cc

Issue 10832335: WebSocket over SPDY: update test data and expectation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ready for review Created 8 years, 4 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/spdy/spdy_websocket_test_util_spdy3.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_websocket_test_util_spdy3.cc
diff --git a/net/spdy/spdy_websocket_test_util_spdy3.cc b/net/spdy/spdy_websocket_test_util_spdy3.cc
index f6b430addf0554672359a22134278976adc6f21d..f146d603b49dc83c10bb6ad8839e7c6b6a1a671e 100644
--- a/net/spdy/spdy_websocket_test_util_spdy3.cc
+++ b/net/spdy/spdy_websocket_test_util_spdy3.cc
@@ -20,6 +20,49 @@ namespace net {
namespace test_spdy3 {
+SpdyFrame* ConstructSpdyWebSocketSynStream(int stream_id,
+ const char* path,
+ const char* host,
+ const char* origin) {
+ const char* const kWebSocketHeaders[] = {
+ ":path",
+ path,
+ ":host",
+ host,
+ ":version",
+ "WebSocket/13",
+ ":scheme",
+ "ws",
+ ":origin",
+ origin
+ };
+ return ConstructSpdyControlFrame(/*extra_headers*/ NULL,
+ /*extra_header_count*/ 0,
+ /*compressed*/ false,
+ stream_id,
+ HIGHEST,
+ SYN_STREAM,
+ CONTROL_FLAG_NONE,
+ kWebSocketHeaders,
+ arraysize(kWebSocketHeaders));
+}
+
+SpdyFrame* ConstructSpdyWebSocketSynReply(int stream_id) {
+ static const char* const kStandardWebSocketHeaders[] = {
+ ":status",
+ "101"
+ };
+ return ConstructSpdyControlFrame(NULL,
+ 0,
+ false,
+ stream_id,
+ LOWEST,
+ SYN_REPLY,
+ CONTROL_FLAG_NONE,
+ kStandardWebSocketHeaders,
+ arraysize(kStandardWebSocketHeaders));
+}
+
SpdyFrame* ConstructSpdyWebSocketHandshakeRequestFrame(
const char* const headers[],
int header_count,
@@ -80,6 +123,28 @@ SpdyFrame* ConstructSpdyWebSocketHandshakeResponseFrame(
header_count);
}
+SpdyFrame* ConstructSpdyWebSocketHeadersFrame(int stream_id,
+ const char* length,
+ bool fin) {
+ static const char* const kHeaders[] = {
+ ":opcode",
+ "1", // text frame
+ ":length",
+ length,
+ ":fin",
+ fin ? "1" : "0"
+ };
+ return ConstructSpdyControlFrame(/*extra_headers*/ NULL,
+ /*extra_header_count*/ 0,
+ /*compression*/ false,
+ stream_id,
+ LOWEST,
+ HEADERS,
+ CONTROL_FLAG_NONE,
+ kHeaders,
+ arraysize(kHeaders));
+}
+
SpdyFrame* ConstructSpdyWebSocketDataFrame(
const char* data,
int len,
« no previous file with comments | « net/spdy/spdy_websocket_test_util_spdy3.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698