diff options
Diffstat (limited to 'net/spdy/spdy_test_util_spdy2.h')
-rw-r--r-- | net/spdy/spdy_test_util_spdy2.h | 158 |
1 files changed, 86 insertions, 72 deletions
diff --git a/net/spdy/spdy_test_util_spdy2.h b/net/spdy/spdy_test_util_spdy2.h index 584cc49..5833214 100644 --- a/net/spdy/spdy_test_util_spdy2.h +++ b/net/spdy/spdy_test_util_spdy2.h @@ -117,31 +117,31 @@ int AppendToBuffer(int val, // |buffer| is the buffer we're filling in. // Returns a SpdyFrame. SpdyFrame* ConstructSpdyPacket(const SpdyHeaderInfo& header_info, - const char* const extra_headers[], - int extra_header_count, - const char* const tail[], - int tail_header_count); + const char* const extra_headers[], + int extra_header_count, + const char* const tail[], + int tail_header_count); // Construct a generic SpdyControlFrame. SpdyFrame* ConstructSpdyControlFrame(const char* const extra_headers[], - int extra_header_count, - bool compressed, - int stream_id, - RequestPriority request_priority, - SpdyControlType type, - SpdyControlFlags flags, - const char* const* kHeaders, - int kHeadersSize); + int extra_header_count, + bool compressed, + int stream_id, + RequestPriority request_priority, + SpdyControlType type, + SpdyControlFlags flags, + const char* const* kHeaders, + int kHeadersSize); SpdyFrame* ConstructSpdyControlFrame(const char* const extra_headers[], - int extra_header_count, - bool compressed, - int stream_id, - RequestPriority request_priority, - SpdyControlType type, - SpdyControlFlags flags, - const char* const* kHeaders, - int kHeadersSize, - int associated_stream_id); + int extra_header_count, + bool compressed, + int stream_id, + RequestPriority request_priority, + SpdyControlType type, + SpdyControlFlags flags, + const char* const* kHeaders, + int kHeadersSize, + int associated_stream_id); // Construct an expected SPDY reply string. // |extra_headers| are the extra header-value pairs, which typically @@ -161,8 +161,7 @@ SpdyFrame* ConstructSpdySettings(const SettingsMap& settings); // Construct an expected SPDY CREDENTIAL frame. // |credential| is the credential to send. // Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdyCredential( - const SpdyCredential& credential); +SpdyFrame* ConstructSpdyCredential(const SpdyCredential& credential); // Construct a SPDY PING frame. // Returns the constructed frame. The caller takes ownership of the frame. @@ -174,13 +173,12 @@ SpdyFrame* ConstructSpdyGoAway(); // Construct a SPDY WINDOW_UPDATE frame. // Returns the constructed frame. The caller takes ownership of the frame. -SpdyFrame* ConstructSpdyWindowUpdate(SpdyStreamId, - uint32 delta_window_size); +SpdyFrame* ConstructSpdyWindowUpdate(SpdyStreamId, uint32 delta_window_size); // Construct a SPDY RST_STREAM frame. // Returns the constructed frame. The caller takes ownership of the frame. SpdyFrame* ConstructSpdyRstStream(SpdyStreamId stream_id, - SpdyStatusCodes status); + SpdyStatusCodes status); // Construct a single SPDY header entry, for validation. // |extra_headers| are the extra header-value pairs. @@ -199,19 +197,19 @@ int ConstructSpdyHeader(const char* const extra_headers[], // will vary the most between calls. // Returns a SpdyFrame. SpdyFrame* ConstructSpdyGet(const char* const url, - bool compressed, - int stream_id, - RequestPriority request_priority); + bool compressed, + int stream_id, + RequestPriority request_priority); // Constructs a standard SPDY GET SYN packet, optionally compressed. // |extra_headers| are the extra header-value pairs, which typically // will vary the most between calls. // Returns a SpdyFrame. SpdyFrame* ConstructSpdyGet(const char* const extra_headers[], - int extra_header_count, - bool compressed, - int stream_id, - RequestPriority request_priority); + int extra_header_count, + bool compressed, + int stream_id, + RequestPriority request_priority); // Constructs a standard SPDY GET SYN packet, optionally compressed. // |extra_headers| are the extra header-value pairs, which typically @@ -219,52 +217,59 @@ SpdyFrame* ConstructSpdyGet(const char* const extra_headers[], // the full url will be used instead of simply the path. // Returns a SpdyFrame. SpdyFrame* ConstructSpdyGet(const char* const extra_headers[], - int extra_header_count, - bool compressed, - int stream_id, - RequestPriority request_priority, - bool direct); + int extra_header_count, + bool compressed, + int stream_id, + RequestPriority request_priority, + bool direct); // Constructs a standard SPDY SYN_STREAM frame for a CONNECT request. SpdyFrame* ConstructSpdyConnect(const char* const extra_headers[], - int extra_header_count, - int stream_id); + int extra_header_count, + int stream_id); + +// Constructs a standard SPDY SYN_STREAM frame for WebSocket over SPDY +// opening handshake. +SpdyFrame* ConstructSpdyWebSocket(int stream_id, + const char* path, + const char* host, + const char* origin); // Constructs a standard SPDY push SYN packet. // |extra_headers| are the extra header-value pairs, which typically // will vary the most between calls. // Returns a SpdyFrame. SpdyFrame* ConstructSpdyPush(const char* const extra_headers[], - int extra_header_count, - int stream_id, - int associated_stream_id); + int extra_header_count, + int stream_id, + int associated_stream_id); SpdyFrame* ConstructSpdyPush(const char* const extra_headers[], - int extra_header_count, - int stream_id, - int associated_stream_id, - const char* url); + int extra_header_count, + int stream_id, + int associated_stream_id, + const char* url); SpdyFrame* ConstructSpdyPush(const char* const extra_headers[], - int extra_header_count, - int stream_id, - int associated_stream_id, - const char* url, - const char* status, - const char* location); + int extra_header_count, + int stream_id, + int associated_stream_id, + const char* url, + const char* status, + const char* location); SpdyFrame* ConstructSpdyPush(int stream_id, - int associated_stream_id, - const char* url); + int associated_stream_id, + const char* url); SpdyFrame* ConstructSpdyPushHeaders(int stream_id, - const char* const extra_headers[], - int extra_header_count); + const char* const extra_headers[], + int extra_header_count); // Constructs a standard SPDY SYN_REPLY packet to match the SPDY GET. // |extra_headers| are the extra header-value pairs, which typically // will vary the most between calls. // Returns a SpdyFrame. SpdyFrame* ConstructSpdyGetSynReply(const char* const extra_headers[], - int extra_header_count, - int stream_id); + int extra_header_count, + int stream_id); // Constructs a standard SPDY SYN_REPLY packet to match the SPDY GET. // |extra_headers| are the extra header-value pairs, which typically @@ -272,6 +277,11 @@ SpdyFrame* ConstructSpdyGetSynReply(const char* const extra_headers[], // Returns a SpdyFrame. SpdyFrame* ConstructSpdyGetSynReplyRedirect(int stream_id); +// Constructs a standard SPDY SYN_REPLY packet to match the WebSocket over SPDY +// opening handshake. +// Returns a SpdyFrame. +SpdyFrame* ConstructSpdyWebSocketSynReply(int stream_id); + // Constructs a standard SPDY SYN_REPLY packet with an Internal Server // Error status code. // Returns a SpdyFrame. @@ -279,45 +289,49 @@ SpdyFrame* ConstructSpdySynReplyError(int stream_id); // Constructs a standard SPDY SYN_REPLY packet with the specified status code. // Returns a SpdyFrame. -SpdyFrame* ConstructSpdySynReplyError( - const char* const status, - const char* const* const extra_headers, - int extra_header_count, - int stream_id); +SpdyFrame* ConstructSpdySynReplyError(const char* const status, + const char* const* const extra_headers, + int extra_header_count, + int stream_id); // Constructs a standard SPDY POST SYN packet. // |extra_headers| are the extra header-value pairs, which typically // will vary the most between calls. // Returns a SpdyFrame. SpdyFrame* ConstructSpdyPost(int64 content_length, - const char* const extra_headers[], - int extra_header_count); + const char* const extra_headers[], + int extra_header_count); // Constructs a chunked transfer SPDY POST SYN packet. // |extra_headers| are the extra header-value pairs, which typically // will vary the most between calls. // Returns a SpdyFrame. SpdyFrame* ConstructChunkedSpdyPost(const char* const extra_headers[], - int extra_header_count); + int extra_header_count); // Constructs a standard SPDY SYN_REPLY packet to match the SPDY POST. // |extra_headers| are the extra header-value pairs, which typically // will vary the most between calls. // Returns a SpdyFrame. SpdyFrame* ConstructSpdyPostSynReply(const char* const extra_headers[], - int extra_header_count); + int extra_header_count); // Constructs a single SPDY data frame with the contents "hello!" SpdyFrame* ConstructSpdyBodyFrame(int stream_id, - bool fin); + bool fin); // Constructs a single SPDY data frame with the given content. SpdyFrame* ConstructSpdyBodyFrame(int stream_id, const char* data, - uint32 len, bool fin); + uint32 len, bool fin); + +// Constructs a SPDY HEADERS frame for a WebSocket frame over SPDY. +SpdyFrame* ConstructSpdyWebSocketHeadersFrame(int stream_id, + const char* length, + bool fin); // Wraps |frame| in the payload of a data frame in stream |stream_id|. -SpdyFrame* ConstructWrappedSpdyFrame( - const scoped_ptr<SpdyFrame>& frame, int stream_id); +SpdyFrame* ConstructWrappedSpdyFrame(const scoped_ptr<SpdyFrame>& frame, + int stream_id); // Create an async MockWrite from the given SpdyFrame. MockWrite CreateMockWrite(const SpdyFrame& req); |