summaryrefslogtreecommitdiffstats
path: root/net/spdy/write_blocked_list_test.cc
diff options
context:
space:
mode:
authorrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-20 16:03:55 +0000
committerrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-20 16:03:55 +0000
commite4696aaab9ff077cf816a91e1d82ccc6251c25f1 (patch)
tree67725c5c93e2c1e77021d84550c34f3c00a281b8 /net/spdy/write_blocked_list_test.cc
parent52656e0176001ea7f6a2d6191d61681dcb0b7ef2 (diff)
downloadchromium_src-e4696aaab9ff077cf816a91e1d82ccc6251c25f1.zip
chromium_src-e4696aaab9ff077cf816a91e1d82ccc6251c25f1.tar.gz
chromium_src-e4696aaab9ff077cf816a91e1d82ccc6251c25f1.tar.bz2
Land Recent QUIC changes.
Moving QUIC over to the new QUIC/SPDY write blocked list template. Fixing all QUIC streams to a single priority for now. Merge internal change: 50911466 Factoring out the spdy write blocked logic into a utility Spdy and Quic can share. Merge internal change: 50897578 Moving the quic dispatcher from using the WriteBlockedList to using a generic linked hash map, in preperation to adding priorities to the WriteBlockedList. Merge internal change: 50728003 QUIC dead code removal. Merge internal change: 50710912 Clarify batch mode in packet generator. Merge internal change: 50587122 Minor spacing/wording fixes to DLOG messages in quic_connection. Merge internal change: 50574131 Define kDefaultRetransmissionTime once in QuicConnectionTest. Merge internal change: 50571883 Deleted FramePackingAckResponse from chromium and will do the same on server side in another CL. Improve frame packing of acks and other frames when acks are received. Merge internal change: 50521649 Fix TODO in quic_connection.cc Merge internal change: 50515632 R=rch@chromium.org Review URL: https://chromiumcodereview.appspot.com/22801008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218500 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/write_blocked_list_test.cc')
-rw-r--r--net/spdy/write_blocked_list_test.cc76
1 files changed, 76 insertions, 0 deletions
diff --git a/net/spdy/write_blocked_list_test.cc b/net/spdy/write_blocked_list_test.cc
new file mode 100644
index 0000000..3bb49df
--- /dev/null
+++ b/net/spdy/write_blocked_list_test.cc
@@ -0,0 +1,76 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/spdy/write_blocked_list.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+
+namespace net {
+namespace test {
+namespace {
+
+typedef WriteBlockedList<int> IntWriteBlockedList;
+
+TEST(WriteBlockedListTest, GetHighestPriority) {
+ IntWriteBlockedList list;
+ EXPECT_EQ(-1, list.GetHighestPriorityWriteBlockedList());
+ list.PushBack(1, 1);
+ EXPECT_EQ(1, list.GetHighestPriorityWriteBlockedList());
+ list.PushBack(1, 0);
+ EXPECT_EQ(0, list.GetHighestPriorityWriteBlockedList());
+}
+
+TEST(WriteBlockedListTest, HasWriteBlockedStreamsOfGreaterThanPriority) {
+ IntWriteBlockedList list;
+ list.PushBack(1, 4);
+ EXPECT_TRUE(list.HasWriteBlockedStreamsGreaterThanPriority(5));
+ EXPECT_FALSE(list.HasWriteBlockedStreamsGreaterThanPriority(4));
+ list.PushBack(1, 2);
+ EXPECT_TRUE(list.HasWriteBlockedStreamsGreaterThanPriority(3));
+ EXPECT_FALSE(list.HasWriteBlockedStreamsGreaterThanPriority(2));
+}
+
+TEST(WriteBlockedListTest, RemoveStreamFromWriteBlockedList) {
+ IntWriteBlockedList list;
+
+ list.PushBack(1, 4);
+ EXPECT_TRUE(list.HasWriteBlockedStreams());
+
+ list.RemoveStreamFromWriteBlockedList(1, 5);
+ EXPECT_TRUE(list.HasWriteBlockedStreams());
+
+ list.PushBack(2, 4);
+ list.PushBack(1, 4);
+ list.RemoveStreamFromWriteBlockedList(1, 4);
+ list.RemoveStreamFromWriteBlockedList(2, 4);
+ EXPECT_FALSE(list.HasWriteBlockedStreams());
+
+ list.PushBack(1, 7);
+ EXPECT_TRUE(list.HasWriteBlockedStreams());
+}
+
+TEST(WriteBlockedListTest, PopFront) {
+ IntWriteBlockedList list;
+
+ list.PushBack(1, 4);
+ EXPECT_EQ(1, list.NumBlockedStreams());
+ list.PushBack(2, 4);
+ list.PushBack(1, 4);
+ list.PushBack(3, 4);
+ EXPECT_EQ(4, list.NumBlockedStreams());
+
+ EXPECT_EQ(1, list.PopFront(4));
+ EXPECT_EQ(2, list.PopFront(4));
+ EXPECT_EQ(1, list.PopFront(4));
+ EXPECT_EQ(1, list.NumBlockedStreams());
+ EXPECT_EQ(3, list.PopFront(4));
+}
+
+} // namespace
+} // namespace test
+} // namespace net
+
+
+