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

Side by Side Diff: net/quic/quic_write_blocked_list_test.cc

Issue 185203003: Killing off QUICv12, including cleaning out all of the code for handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Deleted unused StripUint32 Created 6 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_write_blocked_list.h ('k') | net/quic/reliable_quic_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "net/quic/quic_write_blocked_list.h" 5 #include "net/quic/quic_write_blocked_list.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace net { 9 namespace net {
10 namespace test { 10 namespace test {
11 namespace { 11 namespace {
12 12
13 TEST(QuicWriteBlockedListTest, PriorityOrder) { 13 TEST(QuicWriteBlockedListTest, PriorityOrder) {
14 QuicWriteBlockedList write_blocked_list; 14 QuicWriteBlockedList write_blocked_list;
15 15
16 // Mark streams blocked in roughly reverse priority order, and 16 // Mark streams blocked in roughly reverse priority order, and
17 // verify that streams are sorted. 17 // verify that streams are sorted.
18 write_blocked_list.PushBack(40, 18 write_blocked_list.PushBack(40,
19 QuicWriteBlockedList::kLowestPriority, 19 QuicWriteBlockedList::kLowestPriority);
20 QUIC_VERSION_13);
21 write_blocked_list.PushBack(23, 20 write_blocked_list.PushBack(23,
22 QuicWriteBlockedList::kHighestPriority, 21 QuicWriteBlockedList::kHighestPriority);
23 QUIC_VERSION_13);
24 write_blocked_list.PushBack(17, 22 write_blocked_list.PushBack(17,
25 QuicWriteBlockedList::kHighestPriority, 23 QuicWriteBlockedList::kHighestPriority);
26 QUIC_VERSION_13);
27 write_blocked_list.PushBack(kHeadersStreamId, 24 write_blocked_list.PushBack(kHeadersStreamId,
28 QuicWriteBlockedList::kHighestPriority, 25 QuicWriteBlockedList::kHighestPriority);
29 QUIC_VERSION_13);
30 write_blocked_list.PushBack(kCryptoStreamId, 26 write_blocked_list.PushBack(kCryptoStreamId,
31 QuicWriteBlockedList::kHighestPriority, 27 QuicWriteBlockedList::kHighestPriority);
32 QUIC_VERSION_13);
33 28
34 EXPECT_EQ(5u, write_blocked_list.NumBlockedStreams()); 29 EXPECT_EQ(5u, write_blocked_list.NumBlockedStreams());
35 EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams()); 30 EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams());
36 // The Crypto stream is highest priority. 31 // The Crypto stream is highest priority.
37 EXPECT_EQ(kCryptoStreamId, write_blocked_list.PopFront()); 32 EXPECT_EQ(kCryptoStreamId, write_blocked_list.PopFront());
38 // Followed by the Headers stream. 33 // Followed by the Headers stream.
39 EXPECT_EQ(kHeadersStreamId, write_blocked_list.PopFront()); 34 EXPECT_EQ(kHeadersStreamId, write_blocked_list.PopFront());
40 // Streams with same priority are popped in the order they were inserted. 35 // Streams with same priority are popped in the order they were inserted.
41 EXPECT_EQ(23u, write_blocked_list.PopFront()); 36 EXPECT_EQ(23u, write_blocked_list.PopFront());
42 EXPECT_EQ(17u, write_blocked_list.PopFront()); 37 EXPECT_EQ(17u, write_blocked_list.PopFront());
43 // Low priority stream appears last. 38 // Low priority stream appears last.
44 EXPECT_EQ(40u, write_blocked_list.PopFront()); 39 EXPECT_EQ(40u, write_blocked_list.PopFront());
45 40
46 EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams()); 41 EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams());
47 EXPECT_FALSE(write_blocked_list.HasWriteBlockedStreams()); 42 EXPECT_FALSE(write_blocked_list.HasWriteBlockedStreams());
48 } 43 }
49 44
50 TEST(QuicWriteBlockedListTest, CryptoStream) { 45 TEST(QuicWriteBlockedListTest, CryptoStream) {
51 QuicWriteBlockedList write_blocked_list; 46 QuicWriteBlockedList write_blocked_list;
52 write_blocked_list.PushBack(kCryptoStreamId, 47 write_blocked_list.PushBack(kCryptoStreamId,
53 QuicWriteBlockedList::kHighestPriority, 48 QuicWriteBlockedList::kHighestPriority);
54 QUIC_VERSION_13);
55 49
56 EXPECT_EQ(1u, write_blocked_list.NumBlockedStreams()); 50 EXPECT_EQ(1u, write_blocked_list.NumBlockedStreams());
57 EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams()); 51 EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams());
58 EXPECT_EQ(kCryptoStreamId, write_blocked_list.PopFront()); 52 EXPECT_EQ(kCryptoStreamId, write_blocked_list.PopFront());
59 EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams()); 53 EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams());
60 EXPECT_FALSE(write_blocked_list.HasWriteBlockedStreams()); 54 EXPECT_FALSE(write_blocked_list.HasWriteBlockedStreams());
61 } 55 }
62 56
63 TEST(QuicWriteBlockedListTest, HeadersStream) { 57 TEST(QuicWriteBlockedListTest, HeadersStream) {
64 QuicWriteBlockedList write_blocked_list; 58 QuicWriteBlockedList write_blocked_list;
65 write_blocked_list.PushBack(kHeadersStreamId, 59 write_blocked_list.PushBack(kHeadersStreamId,
66 QuicWriteBlockedList::kHighestPriority, 60 QuicWriteBlockedList::kHighestPriority);
67 QUIC_VERSION_13);
68 61
69 EXPECT_EQ(1u, write_blocked_list.NumBlockedStreams()); 62 EXPECT_EQ(1u, write_blocked_list.NumBlockedStreams());
70 EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams()); 63 EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams());
71 EXPECT_EQ(kHeadersStreamId, write_blocked_list.PopFront()); 64 EXPECT_EQ(kHeadersStreamId, write_blocked_list.PopFront());
72 EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams()); 65 EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams());
73 EXPECT_FALSE(write_blocked_list.HasWriteBlockedStreams()); 66 EXPECT_FALSE(write_blocked_list.HasWriteBlockedStreams());
74 } 67 }
75 68
76 TEST(QuicWriteBlockedListTest, NoHeadersStreamInVersion12) { 69 TEST(QuicWriteBlockedListTest, VerifyHeadersStream) {
77 for (int idx = 0; idx < 2; ++idx) { 70 QuicWriteBlockedList write_blocked_list;
78 QuicVersion version = ((idx == 0) ? QUIC_VERSION_13 : QUIC_VERSION_12); 71 write_blocked_list.PushBack(5,
79 QuicWriteBlockedList write_blocked_list; 72 QuicWriteBlockedList::kHighestPriority);
80 write_blocked_list.PushBack(5, 73 write_blocked_list.PushBack(kHeadersStreamId,
81 QuicWriteBlockedList::kHighestPriority, 74 QuicWriteBlockedList::kHighestPriority);
82 version);
83 write_blocked_list.PushBack(kHeadersStreamId,
84 QuicWriteBlockedList::kHighestPriority,
85 version);
86 75
87 EXPECT_EQ(2u, write_blocked_list.NumBlockedStreams()); 76 EXPECT_EQ(2u, write_blocked_list.NumBlockedStreams());
88 EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams()); 77 EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams());
89 if (version > QUIC_VERSION_12) { 78 // In newer QUIC versions, there is a headers stream which is
90 // In newer QUIC versions, there is a headers stream which is 79 // higher priority than data streams.
91 // higher priority than data streams. 80 EXPECT_EQ(kHeadersStreamId, write_blocked_list.PopFront());
92 EXPECT_EQ(kHeadersStreamId, write_blocked_list.PopFront()); 81 EXPECT_EQ(5u, write_blocked_list.PopFront());
93 EXPECT_EQ(5u, write_blocked_list.PopFront()); 82 EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams());
94 } else { 83 EXPECT_FALSE(write_blocked_list.HasWriteBlockedStreams());
95 // In older QUIC versions, there is no reserved headers stream id.
96 EXPECT_EQ(5u, write_blocked_list.PopFront());
97 EXPECT_EQ(kHeadersStreamId, write_blocked_list.PopFront());
98 }
99 EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams());
100 EXPECT_FALSE(write_blocked_list.HasWriteBlockedStreams());
101 }
102 } 84 }
103 85
104 } // namespace 86 } // namespace
105 } // namespace test 87 } // namespace test
106 } // namespace net 88 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_write_blocked_list.h ('k') | net/quic/reliable_quic_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698