| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 const char* location); | 458 const char* location); |
| 459 | 459 |
| 460 SpdyFrame* ConstructInitialSpdyPushFrame(scoped_ptr<SpdyHeaderBlock> headers, | 460 SpdyFrame* ConstructInitialSpdyPushFrame(scoped_ptr<SpdyHeaderBlock> headers, |
| 461 int stream_id, | 461 int stream_id, |
| 462 int associated_stream_id); | 462 int associated_stream_id); |
| 463 | 463 |
| 464 SpdyFrame* ConstructSpdyPushHeaders(int stream_id, | 464 SpdyFrame* ConstructSpdyPushHeaders(int stream_id, |
| 465 const char* const extra_headers[], | 465 const char* const extra_headers[], |
| 466 int extra_header_count); | 466 int extra_header_count); |
| 467 | 467 |
| 468 // Construct a SPDY syn (HEADERS or SYN_STREAM, depending on protocol |
| 469 // version) carrying exactly the given headers and priority. |
| 470 SpdyFrame* ConstructSpdySyn(int stream_id, |
| 471 const SpdyHeaderBlock& headers, |
| 472 RequestPriority priority, |
| 473 bool compressed, |
| 474 bool fin) const; |
| 475 |
| 476 // Construct a SPDY reply (HEADERS or SYN_REPLY, depending on protocol |
| 477 // version) carrying exactly the given headers, and the default priority |
| 478 // (or no priority, depending on protocl version). |
| 479 // The |headers| parameter variant is preferred. |
| 480 SpdyFrame* ConstructSpdyReply(int stream_id, const SpdyHeaderBlock& headers); |
| 481 |
| 468 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY GET. | 482 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY GET. |
| 469 // |extra_headers| are the extra header-value pairs, which typically | 483 // |extra_headers| are the extra header-value pairs, which typically |
| 470 // will vary the most between calls. | 484 // will vary the most between calls. |
| 471 // Returns a SpdyFrame. | 485 // Returns a SpdyFrame. |
| 472 SpdyFrame* ConstructSpdyGetSynReply(const char* const extra_headers[], | 486 SpdyFrame* ConstructSpdyGetSynReply(const char* const extra_headers[], |
| 473 int extra_header_count, | 487 int extra_header_count, |
| 474 int stream_id); | 488 int stream_id); |
| 475 | 489 |
| 476 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY GET. | 490 // Constructs a standard SPDY SYN_REPLY frame to match the SPDY GET. |
| 477 // |extra_headers| are the extra header-value pairs, which typically | 491 // |extra_headers| are the extra header-value pairs, which typically |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 uint32 len, bool fin); | 539 uint32 len, bool fin); |
| 526 | 540 |
| 527 // Wraps |frame| in the payload of a data frame in stream |stream_id|. | 541 // Wraps |frame| in the payload of a data frame in stream |stream_id|. |
| 528 SpdyFrame* ConstructWrappedSpdyFrame(const scoped_ptr<SpdyFrame>& frame, | 542 SpdyFrame* ConstructWrappedSpdyFrame(const scoped_ptr<SpdyFrame>& frame, |
| 529 int stream_id); | 543 int stream_id); |
| 530 | 544 |
| 531 const SpdyHeaderInfo MakeSpdyHeader(SpdyFrameType type); | 545 const SpdyHeaderInfo MakeSpdyHeader(SpdyFrameType type); |
| 532 | 546 |
| 533 // For versions below SPDY4, adds the version HTTP/1.1 header. | 547 // For versions below SPDY4, adds the version HTTP/1.1 header. |
| 534 void MaybeAddVersionHeader(SpdyFrameWithNameValueBlockIR* frame_ir) const; | 548 void MaybeAddVersionHeader(SpdyFrameWithNameValueBlockIR* frame_ir) const; |
| 549 void MaybeAddVersionHeader(SpdyHeaderBlock* block) const; |
| 535 | 550 |
| 536 // Maps |priority| to SPDY version priority, and sets it on |frame_ir|. | 551 // Maps |priority| to SPDY version priority, and sets it on |frame_ir|. |
| 537 void SetPriority(RequestPriority priority, SpdySynStreamIR* frame_ir) const; | 552 void SetPriority(RequestPriority priority, SpdySynStreamIR* frame_ir) const; |
| 538 | 553 |
| 539 NextProto protocol() const { return protocol_; } | 554 NextProto protocol() const { return protocol_; } |
| 540 SpdyMajorVersion spdy_version() const { return spdy_version_; } | 555 SpdyMajorVersion spdy_version() const { return spdy_version_; } |
| 541 bool is_spdy2() const { return protocol_ < kProtoSPDY3; } | 556 bool is_spdy2() const { return protocol_ < kProtoSPDY3; } |
| 542 bool include_version_header() const { return protocol_ < kProtoSPDY4; } | 557 bool include_version_header() const { return protocol_ < kProtoSPDY4; } |
| 543 scoped_ptr<SpdyFramer> CreateFramer(bool compressed) const; | 558 scoped_ptr<SpdyFramer> CreateFramer(bool compressed) const; |
| 544 | 559 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 557 base::StringPiece url, | 572 base::StringPiece url, |
| 558 int64* content_length) const; | 573 int64* content_length) const; |
| 559 | 574 |
| 560 const NextProto protocol_; | 575 const NextProto protocol_; |
| 561 const SpdyMajorVersion spdy_version_; | 576 const SpdyMajorVersion spdy_version_; |
| 562 }; | 577 }; |
| 563 | 578 |
| 564 } // namespace net | 579 } // namespace net |
| 565 | 580 |
| 566 #endif // NET_SPDY_SPDY_TEST_UTIL_COMMON_H_ | 581 #endif // NET_SPDY_SPDY_TEST_UTIL_COMMON_H_ |
| OLD | NEW |