| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef NET_SPDY_SPDY_TEST_UTIL_H_ | 5 #ifndef NET_SPDY_SPDY_TEST_UTIL_H_ |
| 6 #define NET_SPDY_SPDY_TEST_UTIL_H_ | 6 #define NET_SPDY_SPDY_TEST_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "net/base/mock_host_resolver.h" | 10 #include "net/base/mock_host_resolver.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // will vary the most between calls. If |direct| is false, the | 205 // will vary the most between calls. If |direct| is false, the |
| 206 // the full url will be used instead of simply the path. | 206 // the full url will be used instead of simply the path. |
| 207 // Returns a SpdyFrame. | 207 // Returns a SpdyFrame. |
| 208 spdy::SpdyFrame* ConstructSpdyGet(const char* const extra_headers[], | 208 spdy::SpdyFrame* ConstructSpdyGet(const char* const extra_headers[], |
| 209 int extra_header_count, | 209 int extra_header_count, |
| 210 bool compressed, | 210 bool compressed, |
| 211 int stream_id, | 211 int stream_id, |
| 212 RequestPriority request_priority, | 212 RequestPriority request_priority, |
| 213 bool direct); | 213 bool direct); |
| 214 | 214 |
| 215 // Constructs a standard SPDY SYN_STREAM frame for a CONNECT request. |
| 216 spdy::SpdyFrame* ConstructSpdyConnect(const char* const extra_headers[], |
| 217 int extra_header_count, |
| 218 int stream_id); |
| 219 |
| 215 // Constructs a standard SPDY push SYN packet. | 220 // Constructs a standard SPDY push SYN packet. |
| 216 // |extra_headers| are the extra header-value pairs, which typically | 221 // |extra_headers| are the extra header-value pairs, which typically |
| 217 // will vary the most between calls. | 222 // will vary the most between calls. |
| 218 // Returns a SpdyFrame. | 223 // Returns a SpdyFrame. |
| 219 spdy::SpdyFrame* ConstructSpdyPush(const char* const extra_headers[], | 224 spdy::SpdyFrame* ConstructSpdyPush(const char* const extra_headers[], |
| 220 int extra_header_count, | 225 int extra_header_count, |
| 221 int stream_id, | 226 int stream_id, |
| 222 int associated_stream_id); | 227 int associated_stream_id); |
| 223 spdy::SpdyFrame* ConstructSpdyPush(const char* const extra_headers[], | 228 spdy::SpdyFrame* ConstructSpdyPush(const char* const extra_headers[], |
| 224 int extra_header_count, | 229 int extra_header_count, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 241 spdy::SpdyFrame* ConstructSpdyGetSynReply(const char* const extra_headers[], | 246 spdy::SpdyFrame* ConstructSpdyGetSynReply(const char* const extra_headers[], |
| 242 int extra_header_count, | 247 int extra_header_count, |
| 243 int stream_id); | 248 int stream_id); |
| 244 | 249 |
| 245 // Constructs a standard SPDY SYN_REPLY packet to match the SPDY GET. | 250 // Constructs a standard SPDY SYN_REPLY packet to match the SPDY GET. |
| 246 // |extra_headers| are the extra header-value pairs, which typically | 251 // |extra_headers| are the extra header-value pairs, which typically |
| 247 // will vary the most between calls. | 252 // will vary the most between calls. |
| 248 // Returns a SpdyFrame. | 253 // Returns a SpdyFrame. |
| 249 spdy::SpdyFrame* ConstructSpdyGetSynReplyRedirect(int stream_id); | 254 spdy::SpdyFrame* ConstructSpdyGetSynReplyRedirect(int stream_id); |
| 250 | 255 |
| 256 // Constructs a standard SPDY SYN_REPLY packet with an Internal Server |
| 257 // Error status code. |
| 258 // Returns a SpdyFrame. |
| 259 spdy::SpdyFrame* ConstructSpdySynReplyError(int stream_id); |
| 260 |
| 261 // Constructs a standard SPDY SYN_REPLY packet with the specified status code. |
| 262 // Returns a SpdyFrame. |
| 263 spdy::SpdyFrame* ConstructSpdySynReplyError(const char* const status, |
| 264 int stream_id); |
| 251 // Constructs a standard SPDY POST SYN packet. | 265 // Constructs a standard SPDY POST SYN packet. |
| 252 // |extra_headers| are the extra header-value pairs, which typically | 266 // |extra_headers| are the extra header-value pairs, which typically |
| 253 // will vary the most between calls. | 267 // will vary the most between calls. |
| 254 // Returns a SpdyFrame. | 268 // Returns a SpdyFrame. |
| 255 spdy::SpdyFrame* ConstructSpdyPost(int64 content_length, | 269 spdy::SpdyFrame* ConstructSpdyPost(int64 content_length, |
| 256 const char* const extra_headers[], | 270 const char* const extra_headers[], |
| 257 int extra_header_count); | 271 int extra_header_count); |
| 258 | 272 |
| 259 // Constructs a standard SPDY SYN_REPLY packet to match the SPDY POST. | 273 // Constructs a standard SPDY SYN_REPLY packet to match the SPDY POST. |
| 260 // |extra_headers| are the extra header-value pairs, which typically | 274 // |extra_headers| are the extra header-value pairs, which typically |
| 261 // will vary the most between calls. | 275 // will vary the most between calls. |
| 262 // Returns a SpdyFrame. | 276 // Returns a SpdyFrame. |
| 263 spdy::SpdyFrame* ConstructSpdyPostSynReply(const char* const extra_headers[], | 277 spdy::SpdyFrame* ConstructSpdyPostSynReply(const char* const extra_headers[], |
| 264 int extra_header_count); | 278 int extra_header_count); |
| 265 | 279 |
| 266 // Constructs a single SPDY data frame with the contents "hello!" | 280 // Constructs a single SPDY data frame with the contents "hello!" |
| 267 spdy::SpdyFrame* ConstructSpdyBodyFrame(int stream_id, | 281 spdy::SpdyFrame* ConstructSpdyBodyFrame(int stream_id, |
| 268 bool fin); | 282 bool fin); |
| 269 | 283 |
| 270 // Constructs a single SPDY data frame with the given content. | 284 // Constructs a single SPDY data frame with the given content. |
| 271 spdy::SpdyFrame* ConstructSpdyBodyFrame(int stream_id, const char* data, | 285 spdy::SpdyFrame* ConstructSpdyBodyFrame(int stream_id, const char* data, |
| 272 uint32 len, bool fin); | 286 uint32 len, bool fin); |
| 273 | 287 |
| 288 // Wraps |frame| in the payload of a data frame in stream |stream_id|. |
| 289 spdy::SpdyFrame* ConstructWrappedSpdyFrame( |
| 290 const scoped_ptr<spdy::SpdyFrame>& frame, int stream_id); |
| 291 |
| 274 // Create an async MockWrite from the given SpdyFrame. | 292 // Create an async MockWrite from the given SpdyFrame. |
| 275 MockWrite CreateMockWrite(const spdy::SpdyFrame& req); | 293 MockWrite CreateMockWrite(const spdy::SpdyFrame& req); |
| 276 | 294 |
| 277 // Create an async MockWrite from the given SpdyFrame and sequence number. | 295 // Create an async MockWrite from the given SpdyFrame and sequence number. |
| 278 MockWrite CreateMockWrite(const spdy::SpdyFrame& req, int seq); | 296 MockWrite CreateMockWrite(const spdy::SpdyFrame& req, int seq); |
| 279 | 297 |
| 280 MockWrite CreateMockWrite(const spdy::SpdyFrame& req, int seq, bool async); | 298 MockWrite CreateMockWrite(const spdy::SpdyFrame& req, int seq, bool async); |
| 281 | 299 |
| 282 // Create a MockRead from the given SpdyFrame. | 300 // Create a MockRead from the given SpdyFrame. |
| 283 MockRead CreateMockRead(const spdy::SpdyFrame& resp); | 301 MockRead CreateMockRead(const spdy::SpdyFrame& resp); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 } | 408 } |
| 391 | 409 |
| 392 private: | 410 private: |
| 393 MockClientSocketFactory socket_factory_; | 411 MockClientSocketFactory socket_factory_; |
| 394 }; | 412 }; |
| 395 | 413 |
| 396 const SpdyHeaderInfo make_spdy_header(spdy::SpdyControlType type); | 414 const SpdyHeaderInfo make_spdy_header(spdy::SpdyControlType type); |
| 397 } // namespace net | 415 } // namespace net |
| 398 | 416 |
| 399 #endif // NET_SPDY_SPDY_TEST_UTIL_H_ | 417 #endif // NET_SPDY_SPDY_TEST_UTIL_H_ |
| OLD | NEW |