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

Side by Side Diff: net/spdy/write_blocked_list_test.cc

Issue 76723002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compilation error Created 7 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 | Annotate | Revision Log
« no previous file with comments | « net/spdy/write_blocked_list.h ('k') | net/tools/quic/end_to_end_test.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "net/spdy/write_blocked_list.h" 5 #include "net/spdy/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 9
10 namespace net { 10 namespace net {
11 namespace test { 11 namespace test {
12 namespace { 12 namespace {
13 13
14 typedef WriteBlockedList<int> IntWriteBlockedList; 14 typedef WriteBlockedList<int> IntWriteBlockedList;
15 15
16 TEST(WriteBlockedListTest, GetHighestPriority) { 16 TEST(WriteBlockedListTest, GetHighestPriority) {
17 IntWriteBlockedList list; 17 IntWriteBlockedList list;
18 EXPECT_EQ(-1, list.GetHighestPriorityWriteBlockedList()); 18 EXPECT_FALSE(list.HasWriteBlockedStreams());
19 list.PushBack(1, 1); 19 list.PushBack(1, 1);
20 EXPECT_TRUE(list.HasWriteBlockedStreams());
20 EXPECT_EQ(1, list.GetHighestPriorityWriteBlockedList()); 21 EXPECT_EQ(1, list.GetHighestPriorityWriteBlockedList());
21 list.PushBack(1, 0); 22 list.PushBack(1, 0);
23 EXPECT_TRUE(list.HasWriteBlockedStreams());
22 EXPECT_EQ(0, list.GetHighestPriorityWriteBlockedList()); 24 EXPECT_EQ(0, list.GetHighestPriorityWriteBlockedList());
23 } 25 }
24 26
25 TEST(WriteBlockedListTest, HasWriteBlockedStreamsOfGreaterThanPriority) { 27 TEST(WriteBlockedListTest, HasWriteBlockedStreamsOfGreaterThanPriority) {
26 IntWriteBlockedList list; 28 IntWriteBlockedList list;
27 list.PushBack(1, 4); 29 list.PushBack(1, 4);
28 EXPECT_TRUE(list.HasWriteBlockedStreamsGreaterThanPriority(5)); 30 EXPECT_TRUE(list.HasWriteBlockedStreamsGreaterThanPriority(5));
29 EXPECT_FALSE(list.HasWriteBlockedStreamsGreaterThanPriority(4)); 31 EXPECT_FALSE(list.HasWriteBlockedStreamsGreaterThanPriority(4));
30 list.PushBack(1, 2); 32 list.PushBack(1, 2);
31 EXPECT_TRUE(list.HasWriteBlockedStreamsGreaterThanPriority(3)); 33 EXPECT_TRUE(list.HasWriteBlockedStreamsGreaterThanPriority(3));
(...skipping 16 matching lines...) Expand all
48 EXPECT_FALSE(list.HasWriteBlockedStreams()); 50 EXPECT_FALSE(list.HasWriteBlockedStreams());
49 51
50 list.PushBack(1, 7); 52 list.PushBack(1, 7);
51 EXPECT_TRUE(list.HasWriteBlockedStreams()); 53 EXPECT_TRUE(list.HasWriteBlockedStreams());
52 } 54 }
53 55
54 TEST(WriteBlockedListTest, PopFront) { 56 TEST(WriteBlockedListTest, PopFront) {
55 IntWriteBlockedList list; 57 IntWriteBlockedList list;
56 58
57 list.PushBack(1, 4); 59 list.PushBack(1, 4);
58 EXPECT_EQ(1, list.NumBlockedStreams()); 60 EXPECT_EQ(1u, list.NumBlockedStreams());
59 list.PushBack(2, 4); 61 list.PushBack(2, 4);
60 list.PushBack(1, 4); 62 list.PushBack(1, 4);
61 list.PushBack(3, 4); 63 list.PushBack(3, 4);
62 EXPECT_EQ(4, list.NumBlockedStreams()); 64 EXPECT_EQ(4u, list.NumBlockedStreams());
63 65
64 EXPECT_EQ(1, list.PopFront(4)); 66 EXPECT_EQ(1, list.PopFront(4));
65 EXPECT_EQ(2, list.PopFront(4)); 67 EXPECT_EQ(2, list.PopFront(4));
66 EXPECT_EQ(1, list.PopFront(4)); 68 EXPECT_EQ(1, list.PopFront(4));
67 EXPECT_EQ(1, list.NumBlockedStreams()); 69 EXPECT_EQ(1u, list.NumBlockedStreams());
68 EXPECT_EQ(3, list.PopFront(4)); 70 EXPECT_EQ(3, list.PopFront(4));
69 } 71 }
70 72
71 } // namespace 73 } // namespace
72 } // namespace test 74 } // namespace test
73 } // namespace net 75 } // namespace net
74
75
76
OLDNEW
« no previous file with comments | « net/spdy/write_blocked_list.h ('k') | net/tools/quic/end_to_end_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698