| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef NET_SPDY_SPDY_TEST_UTIL_COMMON_H_ | 5 #ifndef NET_SPDY_SPDY_TEST_UTIL_COMMON_H_ |
| 6 #define NET_SPDY_SPDY_TEST_UTIL_COMMON_H_ | 6 #define NET_SPDY_SPDY_TEST_UTIL_COMMON_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 class SpdySessionPool; | 48 class SpdySessionPool; |
| 49 class SpdyStream; | 49 class SpdyStream; |
| 50 class SpdyStreamRequest; | 50 class SpdyStreamRequest; |
| 51 | 51 |
| 52 // Default upload data used by both, mock objects and framer when creating | 52 // Default upload data used by both, mock objects and framer when creating |
| 53 // data frames. | 53 // data frames. |
| 54 const char kDefaultURL[] = "http://www.example.org/"; | 54 const char kDefaultURL[] = "http://www.example.org/"; |
| 55 const char kUploadData[] = "hello!"; | 55 const char kUploadData[] = "hello!"; |
| 56 const int kUploadDataSize = arraysize(kUploadData)-1; | 56 const int kUploadDataSize = arraysize(kUploadData)-1; |
| 57 | 57 |
| 58 // Chop a SpdyFrame into an array of MockWrites. | 58 // Chop a SpdySerializedFrame into an array of MockWrites. |
| 59 // |frame| is the frame to chop. | 59 // |frame| is the frame to chop. |
| 60 // |num_chunks| is the number of chunks to create. | 60 // |num_chunks| is the number of chunks to create. |
| 61 MockWrite* ChopWriteFrame(const SpdyFrame& frame, int num_chunks); | 61 MockWrite* ChopWriteFrame(const SpdySerializedFrame& frame, int num_chunks); |
| 62 | 62 |
| 63 // Adds headers and values to a map. | 63 // Adds headers and values to a map. |
| 64 // |extra_headers| is an array of { name, value } pairs, arranged as strings | 64 // |extra_headers| is an array of { name, value } pairs, arranged as strings |
| 65 // where the even entries are the header names, and the odd entries are the | 65 // where the even entries are the header names, and the odd entries are the |
| 66 // header values. | 66 // header values. |
| 67 // |headers| gets filled in from |extra_headers|. | 67 // |headers| gets filled in from |extra_headers|. |
| 68 void AppendToHeaderBlock(const char* const extra_headers[], | 68 void AppendToHeaderBlock(const char* const extra_headers[], |
| 69 int extra_header_count, | 69 int extra_header_count, |
| 70 SpdyHeaderBlock* headers); | 70 SpdyHeaderBlock* headers); |
| 71 | 71 |
| 72 // Create an async MockWrite from the given SpdyFrame. | 72 // Create an async MockWrite from the given SpdySerializedFrame. |
| 73 MockWrite CreateMockWrite(const SpdyFrame& req); | 73 MockWrite CreateMockWrite(const SpdySerializedFrame& req); |
| 74 | 74 |
| 75 // Create an async MockWrite from the given SpdyFrame and sequence number. | 75 // Create an async MockWrite from the given SpdySerializedFrame and sequence |
| 76 MockWrite CreateMockWrite(const SpdyFrame& req, int seq); | 76 // number. |
| 77 MockWrite CreateMockWrite(const SpdySerializedFrame& req, int seq); |
| 77 | 78 |
| 78 MockWrite CreateMockWrite(const SpdyFrame& req, int seq, IoMode mode); | 79 MockWrite CreateMockWrite(const SpdySerializedFrame& req, int seq, IoMode mode); |
| 79 | 80 |
| 80 // Create a MockRead from the given SpdyFrame. | 81 // Create a MockRead from the given SpdySerializedFrame. |
| 81 MockRead CreateMockRead(const SpdyFrame& resp); | 82 MockRead CreateMockRead(const SpdySerializedFrame& resp); |
| 82 | 83 |
| 83 // Create a MockRead from the given SpdyFrame and sequence number. | 84 // Create a MockRead from the given SpdySerializedFrame and sequence number. |
| 84 MockRead CreateMockRead(const SpdyFrame& resp, int seq); | 85 MockRead CreateMockRead(const SpdySerializedFrame& resp, int seq); |
| 85 | 86 |
| 86 MockRead CreateMockRead(const SpdyFrame& resp, int seq, IoMode mode); | 87 MockRead CreateMockRead(const SpdySerializedFrame& resp, int seq, IoMode mode); |
| 87 | 88 |
| 88 // Combines the given SpdyFrames into the given char array and returns | 89 // Combines the given SpdySerializedFrame into the given char array and returns |
| 89 // the total length. | 90 // the total length. |
| 90 int CombineFrames(const SpdyFrame** frames, | 91 int CombineFrames(const SpdySerializedFrame** frames, |
| 91 int num_frames, | 92 int num_frames, |
| 92 char* buf, | 93 char* buf, |
| 93 int buf_len); | 94 int buf_len); |
| 94 | 95 |
| 95 // Returns the SpdyPriority embedded in the given frame. Returns true | 96 // Returns the SpdyPriority embedded in the given frame. Returns true |
| 96 // and fills in |priority| on success. | 97 // and fills in |priority| on success. |
| 97 bool GetSpdyPriority(SpdyMajorVersion version, | 98 bool GetSpdyPriority(SpdyMajorVersion version, |
| 98 const SpdyFrame& frame, | 99 const SpdySerializedFrame& frame, |
| 99 SpdyPriority* priority); | 100 SpdyPriority* priority); |
| 100 | 101 |
| 101 // Tries to create a stream in |session| synchronously. Returns NULL | 102 // Tries to create a stream in |session| synchronously. Returns NULL |
| 102 // on failure. | 103 // on failure. |
| 103 base::WeakPtr<SpdyStream> CreateStreamSynchronously( | 104 base::WeakPtr<SpdyStream> CreateStreamSynchronously( |
| 104 SpdyStreamType type, | 105 SpdyStreamType type, |
| 105 const base::WeakPtr<SpdySession>& session, | 106 const base::WeakPtr<SpdySession>& session, |
| 106 const GURL& url, | 107 const GURL& url, |
| 107 RequestPriority priority, | 108 RequestPriority priority, |
| 108 const BoundNetLog& net_log); | 109 const BoundNetLog& net_log); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 scoped_ptr<SpdyHeaderBlock> ConstructPostHeaderBlock( | 300 scoped_ptr<SpdyHeaderBlock> ConstructPostHeaderBlock( |
| 300 base::StringPiece url, | 301 base::StringPiece url, |
| 301 int64_t content_length) const; | 302 int64_t content_length) const; |
| 302 scoped_ptr<SpdyHeaderBlock> ConstructPutHeaderBlock( | 303 scoped_ptr<SpdyHeaderBlock> ConstructPutHeaderBlock( |
| 303 base::StringPiece url, | 304 base::StringPiece url, |
| 304 int64_t content_length) const; | 305 int64_t content_length) const; |
| 305 | 306 |
| 306 // Construct a SPDY frame. If it is a SYN_STREAM or SYN_REPLY frame (as | 307 // Construct a SPDY frame. If it is a SYN_STREAM or SYN_REPLY frame (as |
| 307 // specified in header_info.kind), the provided headers are included in the | 308 // specified in header_info.kind), the provided headers are included in the |
| 308 // frame. | 309 // frame. |
| 309 SpdyFrame* ConstructSpdyFrame( | 310 SpdySerializedFrame* ConstructSpdyFrame( |
| 310 const SpdyHeaderInfo& header_info, | 311 const SpdyHeaderInfo& header_info, |
| 311 scoped_ptr<SpdyHeaderBlock> headers) const; | 312 scoped_ptr<SpdyHeaderBlock> headers) const; |
| 312 | 313 |
| 313 // Construct a SPDY frame. If it is a SYN_STREAM or SYN_REPLY frame (as | 314 // Construct a SPDY frame. If it is a SYN_STREAM or SYN_REPLY frame (as |
| 314 // specified in header_info.kind), the headers provided in extra_headers and | 315 // specified in header_info.kind), the headers provided in extra_headers and |
| 315 // (if non-NULL) tail_headers are concatenated and included in the frame. | 316 // (if non-NULL) tail_headers are concatenated and included in the frame. |
| 316 // (extra_headers must always be non-NULL.) | 317 // (extra_headers must always be non-NULL.) |
| 317 SpdyFrame* ConstructSpdyFrame(const SpdyHeaderInfo& header_info, | 318 SpdySerializedFrame* ConstructSpdyFrame(const SpdyHeaderInfo& header_info, |
| 318 const char* const extra_headers[], | 319 const char* const extra_headers[], |
| 319 int extra_header_count, | 320 int extra_header_count, |
| 320 const char* const tail_headers[], | 321 const char* const tail_headers[], |
| 321 int tail_header_count) const; | 322 int tail_header_count) const; |
| 322 | 323 |
| 323 // Construct an expected SPDY reply string from the given headers. | 324 // Construct an expected SPDY reply string from the given headers. |
| 324 std::string ConstructSpdyReplyString(const SpdyHeaderBlock& headers) const; | 325 std::string ConstructSpdyReplyString(const SpdyHeaderBlock& headers) const; |
| 325 | 326 |
| 326 // Construct an expected SPDY SETTINGS frame. | 327 // Construct an expected SPDY SETTINGS frame. |
| 327 // |settings| are the settings to set. | 328 // |settings| are the settings to set. |
| 328 // Returns the constructed frame. The caller takes ownership of the frame. | 329 // Returns the constructed frame. The caller takes ownership of the frame. |
| 329 SpdyFrame* ConstructSpdySettings(const SettingsMap& settings); | 330 SpdySerializedFrame* ConstructSpdySettings(const SettingsMap& settings); |
| 330 | 331 |
| 331 // Constructs an expected SPDY SETTINGS acknowledgement frame, if the protocol | 332 // Constructs an expected SPDY SETTINGS acknowledgement frame, if the protocol |
| 332 // version is SPDY4 or higher, or an empty placeholder frame otherwise. | 333 // version is SPDY4 or higher, or an empty placeholder frame otherwise. |
| 333 SpdyFrame* ConstructSpdySettingsAck(); | 334 SpdySerializedFrame* ConstructSpdySettingsAck(); |
| 334 | 335 |
| 335 // Construct a SPDY PING frame. | 336 // Construct a SPDY PING frame. |
| 336 // Returns the constructed frame. The caller takes ownership of the frame. | 337 // Returns the constructed frame. The caller takes ownership of the frame. |
| 337 SpdyFrame* ConstructSpdyPing(uint32_t ping_id, bool is_ack); | 338 SpdySerializedFrame* ConstructSpdyPing(uint32_t ping_id, bool is_ack); |
| 338 | 339 |
| 339 // Construct a SPDY GOAWAY frame with last_good_stream_id = 0. | 340 // Construct a SPDY GOAWAY frame with last_good_stream_id = 0. |
| 340 // Returns the constructed frame. The caller takes ownership of the frame. | 341 // Returns the constructed frame. The caller takes ownership of the frame. |
| 341 SpdyFrame* ConstructSpdyGoAway(); | 342 SpdySerializedFrame* ConstructSpdyGoAway(); |
| 342 | 343 |
| 343 // Construct a SPDY GOAWAY frame with the specified last_good_stream_id. | 344 // Construct a SPDY GOAWAY frame with the specified last_good_stream_id. |
| 344 // Returns the constructed frame. The caller takes ownership of the frame. | 345 // Returns the constructed frame. The caller takes ownership of the frame. |
| 345 SpdyFrame* ConstructSpdyGoAway(SpdyStreamId last_good_stream_id); | 346 SpdySerializedFrame* ConstructSpdyGoAway(SpdyStreamId last_good_stream_id); |
| 346 | 347 |
| 347 // Construct a SPDY GOAWAY frame with the specified last_good_stream_id, | 348 // Construct a SPDY GOAWAY frame with the specified last_good_stream_id, |
| 348 // status, and description. Returns the constructed frame. The caller takes | 349 // status, and description. Returns the constructed frame. The caller takes |
| 349 // ownership of the frame. | 350 // ownership of the frame. |
| 350 SpdyFrame* ConstructSpdyGoAway(SpdyStreamId last_good_stream_id, | 351 SpdySerializedFrame* ConstructSpdyGoAway(SpdyStreamId last_good_stream_id, |
| 351 SpdyGoAwayStatus status, | 352 SpdyGoAwayStatus status, |
| 352 const std::string& desc); | 353 const std::string& desc); |
| 353 | 354 |
| 354 // Construct a SPDY WINDOW_UPDATE frame. | 355 // Construct a SPDY WINDOW_UPDATE frame. |
| 355 // Returns the constructed frame. The caller takes ownership of the frame. | 356 // Returns the constructed frame. The caller takes ownership of the frame. |
| 356 SpdyFrame* ConstructSpdyWindowUpdate(SpdyStreamId stream_id, | 357 SpdySerializedFrame* ConstructSpdyWindowUpdate(SpdyStreamId stream_id, |
| 357 uint32_t delta_window_size); | 358 uint32_t delta_window_size); |
| 358 | 359 |
| 359 // Construct a SPDY RST_STREAM frame. | 360 // Construct a SPDY RST_STREAM frame. |
| 360 // Returns the constructed frame. The caller takes ownership of the frame. | 361 // Returns the constructed frame. The caller takes ownership of the frame. |
| 361 SpdyFrame* ConstructSpdyRstStream(SpdyStreamId stream_id, | 362 SpdySerializedFrame* ConstructSpdyRstStream(SpdyStreamId stream_id, |
| 362 SpdyRstStreamStatus status); | 363 SpdyRstStreamStatus status); |
| 363 | 364 |
| 364 // Constructs a standard SPDY GET SYN frame for |url| with header compression. | 365 // Constructs a standard SPDY GET SYN frame for |url| with header compression. |
| 365 // |extra_headers| are the extra header-value pairs, which typically | 366 // |extra_headers| are the extra header-value pairs, which typically |
| 366 // will vary the most between calls. | 367 // will vary the most between calls. |
| 367 // Returns a SpdyFrame. | 368 // Returns a SpdySerializedFrame. |
| 368 SpdyFrame* ConstructSpdyGet(const char* const url, | 369 SpdySerializedFrame* ConstructSpdyGet(const char* const url, |
| 369 SpdyStreamId stream_id, | 370 SpdyStreamId stream_id, |
| 370 RequestPriority request_priority); | 371 RequestPriority request_priority); |
| 371 | 372 |
| 372 // Constructs a standard SPDY GET SYN frame with header compression. | 373 // Constructs a standard SPDY GET SYN frame with header compression. |
| 373 // |extra_headers| are the extra header-value pairs, which typically | 374 // |extra_headers| are the extra header-value pairs, which typically |
| 374 // will vary the most between calls. If |direct| is false, the | 375 // will vary the most between calls. If |direct| is false, the |
| 375 // the full url will be used instead of simply the path. | 376 // the full url will be used instead of simply the path. |
| 376 // Returns a SpdyFrame. | 377 // Returns a SpdySerializedFrame. |
| 377 SpdyFrame* ConstructSpdyGet(const char* const extra_headers[], | 378 SpdySerializedFrame* ConstructSpdyGet(const char* const extra_headers[], |
| 378 int extra_header_count, | 379 int extra_header_count, |
| 379 int stream_id, | 380 int stream_id, |
| 380 RequestPriority request_priority, | 381 RequestPriority request_priority, |
| 381 bool direct); | 382 bool direct); |
| 382 | 383 |
| 383 // Constructs a standard SPDY SYN_STREAM frame for a CONNECT request. | 384 // Constructs a standard SPDY SYN_STREAM frame for a CONNECT request. |
| 384 SpdyFrame* ConstructSpdyConnect(const char* const extra_headers[], | 385 SpdySerializedFrame* ConstructSpdyConnect(const char* const extra_headers[], |
| 385 int extra_header_count, | 386 int extra_header_count, |
| 386 int stream_id, | 387 int stream_id, |
| 387 RequestPriority priority, | 388 RequestPriority priority, |
| 388 const HostPortPair& host_port_pair); | 389 const HostPortPair& host_port_pair); |
| 389 | 390 |
| 390 // Constructs a standard SPDY push SYN frame. | 391 // Constructs a standard SPDY push SYN frame. |
| 391 // |extra_headers| are the extra header-value pairs, which typically | 392 // |extra_headers| are the extra header-value pairs, which typically |
| 392 // will vary the most between calls. | 393 // will vary the most between calls. |
| 393 // Returns a SpdyFrame. | 394 // Returns a SpdySerializedFrame. |
| 394 SpdyFrame* ConstructSpdyPush(const char* const extra_headers[], | 395 SpdySerializedFrame* ConstructSpdyPush(const char* const extra_headers[], |
| 395 int extra_header_count, | 396 int extra_header_count, |
| 396 int stream_id, | 397 int stream_id, |
| 397 int associated_stream_id, | 398 int associated_stream_id, |
| 398 const char* url); | 399 const char* url); |
| 399 SpdyFrame* ConstructSpdyPush(const char* const extra_headers[], | 400 SpdySerializedFrame* ConstructSpdyPush(const char* const extra_headers[], |
| 400 int extra_header_count, | 401 int extra_header_count, |
| 401 int stream_id, | 402 int stream_id, |
| 402 int associated_stream_id, | 403 int associated_stream_id, |
| 403 const char* url, | 404 const char* url, |
| 404 const char* status, | 405 const char* status, |
| 405 const char* location); | 406 const char* location); |
| 406 | 407 |
| 407 SpdyFrame* ConstructInitialSpdyPushFrame(scoped_ptr<SpdyHeaderBlock> headers, | 408 SpdySerializedFrame* ConstructInitialSpdyPushFrame( |
| 408 int stream_id, | 409 scoped_ptr<SpdyHeaderBlock> headers, |
| 409 int associated_stream_id); | 410 int stream_id, |
| 411 int associated_stream_id); |
| 410 | 412 |
| 411 SpdyFrame* ConstructSpdyPushHeaders(int stream_id, | 413 SpdySerializedFrame* ConstructSpdyPushHeaders( |
| 412 const char* const extra_headers[], | 414 int stream_id, |
| 413 int extra_header_count); | 415 const char* const extra_headers[], |
| 416 int extra_header_count); |
| 414 | 417 |
| 415 // Constructs a SPDY header frame with the request header compression context | 418 // Constructs a SPDY header frame with the request header compression context |
| 416 // with END_STREAM flag set to |fin|. | 419 // with END_STREAM flag set to |fin|. |
| 417 SpdyFrame* ConstructSpdyResponseHeaders(int stream_id, | 420 SpdySerializedFrame* ConstructSpdyResponseHeaders( |
| 418 const SpdyHeaderBlock& headers, | 421 int stream_id, |
| 419 bool fin); | 422 const SpdyHeaderBlock& headers, |
| 423 bool fin); |
| 420 | 424 |
| 421 // Construct a SPDY syn (HEADERS or SYN_STREAM, depending on protocol | 425 // Construct a SPDY syn (HEADERS or SYN_STREAM, depending on protocol |
| 422 // version) carrying exactly the given headers and priority. | 426 // version) carrying exactly the given headers and priority. |
| 423 SpdyFrame* ConstructSpdySyn(int stream_id, | 427 SpdySerializedFrame* ConstructSpdySyn(int stream_id, |
| 424 const SpdyHeaderBlock& headers, | 428 const SpdyHeaderBlock& headers, |
| 425 RequestPriority priority, | 429 RequestPriority priority, |
| 426 bool fin); | 430 bool fin); |
| 427 | 431 |
| 428 // Construct a SPDY reply (HEADERS or SYN_REPLY, depending on protocol | 432 // Construct a SPDY reply (HEADERS or SYN_REPLY, depending on protocol |
| 429 // version) carrying exactly the given headers, and the default priority | 433 // version) carrying exactly the given headers, and the default priority |
| 430 // (or no priority, depending on protocol version). | 434 // (or no priority, depending on protocol version). |
| 431 SpdyFrame* ConstructSpdyReply(int stream_id, const SpdyHeaderBlock& headers); | 435 SpdySerializedFrame* ConstructSpdyReply(int stream_id, |
| 436 const SpdyHeaderBlock& headers); |
| 432 | 437 |
| 433 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY GET. | 438 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY GET. |
| 434 // |extra_headers| are the extra header-value pairs, which typically | 439 // |extra_headers| are the extra header-value pairs, which typically |
| 435 // will vary the most between calls. | 440 // will vary the most between calls. |
| 436 // Returns a SpdyFrame. | 441 // Returns a SpdySerializedFrame. |
| 437 SpdyFrame* ConstructSpdyGetSynReply(const char* const extra_headers[], | 442 SpdySerializedFrame* ConstructSpdyGetSynReply( |
| 438 int extra_header_count, | 443 const char* const extra_headers[], |
| 439 int stream_id); | 444 int extra_header_count, |
| 445 int stream_id); |
| 440 | 446 |
| 441 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY GET. | 447 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY GET. |
| 442 // |extra_headers| are the extra header-value pairs, which typically | 448 // |extra_headers| are the extra header-value pairs, which typically |
| 443 // will vary the most between calls. | 449 // will vary the most between calls. |
| 444 // Returns a SpdyFrame. | 450 // Returns a SpdySerializedFrame. |
| 445 SpdyFrame* ConstructSpdyGetSynReplyRedirect(int stream_id); | 451 SpdySerializedFrame* ConstructSpdyGetSynReplyRedirect(int stream_id); |
| 446 | 452 |
| 447 // Constructs a standard SPDY SYN_REPLY frame with an Internal Server | 453 // Constructs a standard SPDY SYN_REPLY frame with an Internal Server |
| 448 // Error status code. | 454 // Error status code. |
| 449 // Returns a SpdyFrame. | 455 // Returns a SpdySerializedFrame. |
| 450 SpdyFrame* ConstructSpdySynReplyError(int stream_id); | 456 SpdySerializedFrame* ConstructSpdySynReplyError(int stream_id); |
| 451 | 457 |
| 452 // Constructs a standard SPDY SYN_REPLY frame with the specified status code. | 458 // Constructs a standard SPDY SYN_REPLY frame with the specified status code. |
| 453 // Returns a SpdyFrame. | 459 // Returns a SpdySerializedFrame. |
| 454 SpdyFrame* ConstructSpdySynReplyError(const char* const status, | 460 SpdySerializedFrame* ConstructSpdySynReplyError( |
| 455 const char* const* const extra_headers, | 461 const char* const status, |
| 456 int extra_header_count, | 462 const char* const* const extra_headers, |
| 457 int stream_id); | 463 int extra_header_count, |
| 464 int stream_id); |
| 458 | 465 |
| 459 // Constructs a standard SPDY POST SYN frame. | 466 // Constructs a standard SPDY POST SYN frame. |
| 460 // |extra_headers| are the extra header-value pairs, which typically | 467 // |extra_headers| are the extra header-value pairs, which typically |
| 461 // will vary the most between calls. | 468 // will vary the most between calls. |
| 462 // Returns a SpdyFrame. | 469 // Returns a SpdySerializedFrame. |
| 463 SpdyFrame* ConstructSpdyPost(const char* url, | 470 SpdySerializedFrame* ConstructSpdyPost(const char* url, |
| 464 SpdyStreamId stream_id, | 471 SpdyStreamId stream_id, |
| 465 int64_t content_length, | 472 int64_t content_length, |
| 466 RequestPriority priority, | 473 RequestPriority priority, |
| 467 const char* const extra_headers[], | 474 const char* const extra_headers[], |
| 468 int extra_header_count); | 475 int extra_header_count); |
| 469 | 476 |
| 470 // Constructs a chunked transfer SPDY POST SYN frame. | 477 // Constructs a chunked transfer SPDY POST SYN frame. |
| 471 // |extra_headers| are the extra header-value pairs, which typically | 478 // |extra_headers| are the extra header-value pairs, which typically |
| 472 // will vary the most between calls. | 479 // will vary the most between calls. |
| 473 // Returns a SpdyFrame. | 480 // Returns a SpdySerializedFrame. |
| 474 SpdyFrame* ConstructChunkedSpdyPost(const char* const extra_headers[], | 481 SpdySerializedFrame* ConstructChunkedSpdyPost( |
| 475 int extra_header_count); | 482 const char* const extra_headers[], |
| 483 int extra_header_count); |
| 476 | 484 |
| 477 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY POST. | 485 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY POST. |
| 478 // |extra_headers| are the extra header-value pairs, which typically | 486 // |extra_headers| are the extra header-value pairs, which typically |
| 479 // will vary the most between calls. | 487 // will vary the most between calls. |
| 480 // Returns a SpdyFrame. | 488 // Returns a SpdySerializedFrame. |
| 481 SpdyFrame* ConstructSpdyPostSynReply(const char* const extra_headers[], | 489 SpdySerializedFrame* ConstructSpdyPostSynReply( |
| 482 int extra_header_count); | 490 const char* const extra_headers[], |
| 491 int extra_header_count); |
| 483 | 492 |
| 484 // Constructs a single SPDY data frame with the contents "hello!" | 493 // Constructs a single SPDY data frame with the contents "hello!" |
| 485 SpdyFrame* ConstructSpdyBodyFrame(int stream_id, | 494 SpdySerializedFrame* ConstructSpdyBodyFrame(int stream_id, bool fin); |
| 486 bool fin); | |
| 487 | 495 |
| 488 // Constructs a single SPDY data frame with the given content. | 496 // Constructs a single SPDY data frame with the given content. |
| 489 SpdyFrame* ConstructSpdyBodyFrame(int stream_id, | 497 SpdySerializedFrame* ConstructSpdyBodyFrame(int stream_id, |
| 490 const char* data, | 498 const char* data, |
| 491 uint32_t len, | 499 uint32_t len, |
| 492 bool fin); | 500 bool fin); |
| 493 | 501 |
| 494 // Constructs a single SPDY data frame with the given content and padding. | 502 // Constructs a single SPDY data frame with the given content and padding. |
| 495 SpdyFrame* ConstructSpdyBodyFrame(int stream_id, | 503 SpdySerializedFrame* ConstructSpdyBodyFrame(int stream_id, |
| 496 const char* data, | 504 const char* data, |
| 497 uint32_t len, | 505 uint32_t len, |
| 498 bool fin, | 506 bool fin, |
| 499 int padding_length); | 507 int padding_length); |
| 500 | 508 |
| 501 // Wraps |frame| in the payload of a data frame in stream |stream_id|. | 509 // Wraps |frame| in the payload of a data frame in stream |stream_id|. |
| 502 SpdyFrame* ConstructWrappedSpdyFrame(const scoped_ptr<SpdyFrame>& frame, | 510 SpdySerializedFrame* ConstructWrappedSpdyFrame( |
| 503 int stream_id); | 511 const scoped_ptr<SpdySerializedFrame>& frame, |
| 512 int stream_id); |
| 504 | 513 |
| 505 // Called when necessary (when it will affect stream dependency specification | 514 // Called when necessary (when it will affect stream dependency specification |
| 506 // when setting dependencies based on priorioties) to notify the utility | 515 // when setting dependencies based on priorioties) to notify the utility |
| 507 // class of stream destruction. | 516 // class of stream destruction. |
| 508 void UpdateWithStreamDestruction(int stream_id); | 517 void UpdateWithStreamDestruction(int stream_id); |
| 509 | 518 |
| 510 // For versions below SPDY4, adds the version HTTP/1.1 header. | 519 // For versions below SPDY4, adds the version HTTP/1.1 header. |
| 511 void MaybeAddVersionHeader(SpdyFrameWithHeaderBlockIR* frame_ir) const; | 520 void MaybeAddVersionHeader(SpdyFrameWithHeaderBlockIR* frame_ir) const; |
| 512 void MaybeAddVersionHeader(SpdyHeaderBlock* block) const; | 521 void MaybeAddVersionHeader(SpdyHeaderBlock* block) const; |
| 513 | 522 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 GURL default_url_; | 560 GURL default_url_; |
| 552 bool dependency_priorities_; | 561 bool dependency_priorities_; |
| 553 | 562 |
| 554 // Track a FIFO list of the stream_id of all created requests by priority. | 563 // Track a FIFO list of the stream_id of all created requests by priority. |
| 555 std::map<int, std::vector<int>> priority_to_stream_id_list_; | 564 std::map<int, std::vector<int>> priority_to_stream_id_list_; |
| 556 }; | 565 }; |
| 557 | 566 |
| 558 } // namespace net | 567 } // namespace net |
| 559 | 568 |
| 560 #endif // NET_SPDY_SPDY_TEST_UTIL_COMMON_H_ | 569 #endif // NET_SPDY_SPDY_TEST_UTIL_COMMON_H_ |
| OLD | NEW |