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

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

Issue 1472573002: These packets got reformatted at some point, maybe before the clang-format off annotation was added. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@107711408
Patch Set: 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 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 "net/quic/test_tools/quic_test_utils.h" 7 #include "net/quic/test_tools/quic_test_utils.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 using net::kLowestPriority; 10 using net::kLowestPriority;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 write_blocked_list.AddStream(id2, net::kLowestPriority); 139 write_blocked_list.AddStream(id2, net::kLowestPriority);
140 EXPECT_EQ(2u, write_blocked_list.NumBlockedStreams()); 140 EXPECT_EQ(2u, write_blocked_list.NumBlockedStreams());
141 141
142 // Ensure higher priority streams are popped first. 142 // Ensure higher priority streams are popped first.
143 const QuicStreamId id3 = kClientDataStreamId2 + 2; 143 const QuicStreamId id3 = kClientDataStreamId2 + 2;
144 write_blocked_list.AddStream(id3, net::kHighestPriority); 144 write_blocked_list.AddStream(id3, net::kHighestPriority);
145 EXPECT_EQ(id3, write_blocked_list.PopFront()); 145 EXPECT_EQ(id3, write_blocked_list.PopFront());
146 146
147 // Higher priority streams will always be popped first, even if using their 147 // Higher priority streams will always be popped first, even if using their
148 // byte quota 148 // byte quota
149 write_blocked_list.AddStream(id3, net::kHighestPriority); 149 write_blocked_list.UpdateBytesForStream(id3, 20000);
150 write_blocked_list.UpdateBytesForStream(id1, 20000);
151 write_blocked_list.AddStream(id3, net::kHighestPriority); 150 write_blocked_list.AddStream(id3, net::kHighestPriority);
152 EXPECT_EQ(id3, write_blocked_list.PopFront()); 151 EXPECT_EQ(id3, write_blocked_list.PopFront());
153 152
154 // Once the higher priority stream is out of the way, id2 will resume its 16k 153 // Once the higher priority stream is out of the way, id2 will resume its 16k
155 // write, with only 1 byte remaining of its guaranteed write allocation. 154 // write, with only 1 byte remaining of its guaranteed write allocation.
156 EXPECT_EQ(id2, write_blocked_list.PopFront()); 155 EXPECT_EQ(id2, write_blocked_list.PopFront());
157 write_blocked_list.AddStream(id2, net::kHighestPriority); 156 write_blocked_list.AddStream(id2, net::kHighestPriority);
158 write_blocked_list.UpdateBytesForStream(id2, 1); 157 write_blocked_list.UpdateBytesForStream(id2, 1);
159 write_blocked_list.AddStream(id2, net::kLowestPriority); 158 write_blocked_list.AddStream(id2, net::kLowestPriority);
160 EXPECT_EQ(2u, write_blocked_list.NumBlockedStreams()); 159 EXPECT_EQ(2u, write_blocked_list.NumBlockedStreams());
161 EXPECT_EQ(id1, write_blocked_list.PopFront()); 160 EXPECT_EQ(id1, write_blocked_list.PopFront());
162 } 161 }
163 162
164 } // namespace 163 } // namespace
165 } // namespace test 164 } // namespace test
166 } // namespace net 165 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698