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

Side by Side Diff: net/spdy/spdy_test_util_common.h

Issue 1411383005: Initial implementation of RequestPriority-based HTTP/2 dependencies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated tests. Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 void SetStreamInitialRecvWindowSize(size_t window); 291 void SetStreamInitialRecvWindowSize(size_t window);
292 292
293 private: 293 private:
294 SpdySessionPool* const pool_; 294 SpdySessionPool* const pool_;
295 295
296 DISALLOW_COPY_AND_ASSIGN(SpdySessionPoolPeer); 296 DISALLOW_COPY_AND_ASSIGN(SpdySessionPoolPeer);
297 }; 297 };
298 298
299 class SpdyTestUtil { 299 class SpdyTestUtil {
300 public: 300 public:
301 explicit SpdyTestUtil(NextProto protocol); 301 explicit SpdyTestUtil(NextProto protocol, bool dependency_priorities);
302 ~SpdyTestUtil();
302 303
303 // Add the appropriate headers to put |url| into |block|. 304 // Add the appropriate headers to put |url| into |block|.
304 void AddUrlToHeaderBlock(base::StringPiece url, 305 void AddUrlToHeaderBlock(base::StringPiece url,
305 SpdyHeaderBlock* headers) const; 306 SpdyHeaderBlock* headers) const;
306 307
307 scoped_ptr<SpdyHeaderBlock> ConstructGetHeaderBlock( 308 scoped_ptr<SpdyHeaderBlock> ConstructGetHeaderBlock(
308 base::StringPiece url) const; 309 base::StringPiece url) const;
309 scoped_ptr<SpdyHeaderBlock> ConstructGetHeaderBlockForProxy( 310 scoped_ptr<SpdyHeaderBlock> ConstructGetHeaderBlockForProxy(
310 base::StringPiece url) const; 311 base::StringPiece url) const;
311 scoped_ptr<SpdyHeaderBlock> ConstructHeadHeaderBlock( 312 scoped_ptr<SpdyHeaderBlock> ConstructHeadHeaderBlock(
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 SpdyFrame* ConstructSpdyBodyFrame(int stream_id, 546 SpdyFrame* ConstructSpdyBodyFrame(int stream_id,
546 const char* data, 547 const char* data,
547 uint32 len, 548 uint32 len,
548 bool fin, 549 bool fin,
549 int padding_length); 550 int padding_length);
550 551
551 // Wraps |frame| in the payload of a data frame in stream |stream_id|. 552 // Wraps |frame| in the payload of a data frame in stream |stream_id|.
552 SpdyFrame* ConstructWrappedSpdyFrame(const scoped_ptr<SpdyFrame>& frame, 553 SpdyFrame* ConstructWrappedSpdyFrame(const scoped_ptr<SpdyFrame>& frame,
553 int stream_id); 554 int stream_id);
554 555
556 // Called when necessary (when it will affect stream dependency specification
557 // when setting dependencies based on priorioties) to notify the utility
558 // class of stream destruction.
559 void OnStreamDestruction(int stream_id);
560
555 const SpdyHeaderInfo MakeSpdyHeader(SpdyFrameType type); 561 const SpdyHeaderInfo MakeSpdyHeader(SpdyFrameType type);
556 562
557 // For versions below SPDY4, adds the version HTTP/1.1 header. 563 // For versions below SPDY4, adds the version HTTP/1.1 header.
558 void MaybeAddVersionHeader(SpdyFrameWithHeaderBlockIR* frame_ir) const; 564 void MaybeAddVersionHeader(SpdyFrameWithHeaderBlockIR* frame_ir) const;
559 void MaybeAddVersionHeader(SpdyHeaderBlock* block) const; 565 void MaybeAddVersionHeader(SpdyHeaderBlock* block) const;
560 566
561 // Maps |priority| to SPDY version priority, and sets it on |frame_ir|. 567 // Maps |priority| to SPDY version priority, and sets it on |frame_ir|.
562 void SetPriority(RequestPriority priority, SpdySynStreamIR* frame_ir) const; 568 void SetPriority(RequestPriority priority, SpdySynStreamIR* frame_ir) const;
563 569
564 NextProto protocol() const { return protocol_; } 570 NextProto protocol() const { return protocol_; }
(...skipping 15 matching lines...) Expand all
580 // |content_length| may be NULL, in which case the content-length 586 // |content_length| may be NULL, in which case the content-length
581 // header will be omitted. 587 // header will be omitted.
582 scoped_ptr<SpdyHeaderBlock> ConstructHeaderBlock( 588 scoped_ptr<SpdyHeaderBlock> ConstructHeaderBlock(
583 base::StringPiece method, 589 base::StringPiece method,
584 base::StringPiece url, 590 base::StringPiece url,
585 int64* content_length) const; 591 int64* content_length) const;
586 592
587 const NextProto protocol_; 593 const NextProto protocol_;
588 const SpdyMajorVersion spdy_version_; 594 const SpdyMajorVersion spdy_version_;
589 GURL default_url_; 595 GURL default_url_;
596 bool dependency_priorities_;
597
598 // Track a FIFO list of the stream_id of all created requests by priority.
599 mutable std::map<int, std::vector<int>> priority_to_stream_id_list_;
Bence 2015/11/11 18:47:15 I don't understand why relevant SpdyTestUtil metho
Randy Smith (Not in Mondays) 2015/11/11 23:25:59 Done.
590 }; 600 };
591 601
592 } // namespace net 602 } // namespace net
593 603
594 #endif // NET_SPDY_SPDY_TEST_UTIL_COMMON_H_ 604 #endif // NET_SPDY_SPDY_TEST_UTIL_COMMON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698