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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
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, QuicWriteBlockedList::kLowestPriority);
19 QuicWriteBlockedList::kLowestPriority); 19 write_blocked_list.PushBack(23, QuicWriteBlockedList::kHighestPriority);
20 write_blocked_list.PushBack(23, 20 write_blocked_list.PushBack(17, QuicWriteBlockedList::kHighestPriority);
21 QuicWriteBlockedList::kHighestPriority);
22 write_blocked_list.PushBack(17,
23 QuicWriteBlockedList::kHighestPriority);
24 write_blocked_list.PushBack(kHeadersStreamId, 21 write_blocked_list.PushBack(kHeadersStreamId,
25 QuicWriteBlockedList::kHighestPriority); 22 QuicWriteBlockedList::kHighestPriority);
26 write_blocked_list.PushBack(kCryptoStreamId, 23 write_blocked_list.PushBack(kCryptoStreamId,
27 QuicWriteBlockedList::kHighestPriority); 24 QuicWriteBlockedList::kHighestPriority);
28 25
29 EXPECT_EQ(5u, write_blocked_list.NumBlockedStreams()); 26 EXPECT_EQ(5u, write_blocked_list.NumBlockedStreams());
30 EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams()); 27 EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams());
31 // The Crypto stream is highest priority. 28 // The Crypto stream is highest priority.
32 EXPECT_EQ(kCryptoStreamId, write_blocked_list.PopFront()); 29 EXPECT_EQ(kCryptoStreamId, write_blocked_list.PopFront());
33 // Followed by the Headers stream. 30 // Followed by the Headers stream.
(...skipping 27 matching lines...) Expand all
61 58
62 EXPECT_EQ(1u, write_blocked_list.NumBlockedStreams()); 59 EXPECT_EQ(1u, write_blocked_list.NumBlockedStreams());
63 EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams()); 60 EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams());
64 EXPECT_EQ(kHeadersStreamId, write_blocked_list.PopFront()); 61 EXPECT_EQ(kHeadersStreamId, write_blocked_list.PopFront());
65 EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams()); 62 EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams());
66 EXPECT_FALSE(write_blocked_list.HasWriteBlockedStreams()); 63 EXPECT_FALSE(write_blocked_list.HasWriteBlockedStreams());
67 } 64 }
68 65
69 TEST(QuicWriteBlockedListTest, VerifyHeadersStream) { 66 TEST(QuicWriteBlockedListTest, VerifyHeadersStream) {
70 QuicWriteBlockedList write_blocked_list; 67 QuicWriteBlockedList write_blocked_list;
71 write_blocked_list.PushBack(5, 68 write_blocked_list.PushBack(5, QuicWriteBlockedList::kHighestPriority);
72 QuicWriteBlockedList::kHighestPriority);
73 write_blocked_list.PushBack(kHeadersStreamId, 69 write_blocked_list.PushBack(kHeadersStreamId,
74 QuicWriteBlockedList::kHighestPriority); 70 QuicWriteBlockedList::kHighestPriority);
75 71
76 EXPECT_EQ(2u, write_blocked_list.NumBlockedStreams()); 72 EXPECT_EQ(2u, write_blocked_list.NumBlockedStreams());
77 EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams()); 73 EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams());
78 // In newer QUIC versions, there is a headers stream which is 74 // In newer QUIC versions, there is a headers stream which is
79 // higher priority than data streams. 75 // higher priority than data streams.
80 EXPECT_EQ(kHeadersStreamId, write_blocked_list.PopFront()); 76 EXPECT_EQ(kHeadersStreamId, write_blocked_list.PopFront());
81 EXPECT_EQ(5u, write_blocked_list.PopFront()); 77 EXPECT_EQ(5u, write_blocked_list.PopFront());
82 EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams()); 78 EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams());
83 EXPECT_FALSE(write_blocked_list.HasWriteBlockedStreams()); 79 EXPECT_FALSE(write_blocked_list.HasWriteBlockedStreams());
84 } 80 }
85 81
86 } // namespace 82 } // namespace
87 } // namespace test 83 } // namespace test
88 } // namespace net 84 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698