This source file includes following definitions.
- TEST
- TEST
- TEST
- TEST
#include "net/quic/quic_write_blocked_list.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
namespace test {
namespace {
TEST(QuicWriteBlockedListTest, PriorityOrder) {
QuicWriteBlockedList write_blocked_list;
write_blocked_list.PushBack(40,
QuicWriteBlockedList::kLowestPriority);
write_blocked_list.PushBack(23,
QuicWriteBlockedList::kHighestPriority);
write_blocked_list.PushBack(17,
QuicWriteBlockedList::kHighestPriority);
write_blocked_list.PushBack(kHeadersStreamId,
QuicWriteBlockedList::kHighestPriority);
write_blocked_list.PushBack(kCryptoStreamId,
QuicWriteBlockedList::kHighestPriority);
EXPECT_EQ(5u, write_blocked_list.NumBlockedStreams());
EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams());
EXPECT_EQ(kCryptoStreamId, write_blocked_list.PopFront());
EXPECT_EQ(kHeadersStreamId, write_blocked_list.PopFront());
EXPECT_EQ(23u, write_blocked_list.PopFront());
EXPECT_EQ(17u, write_blocked_list.PopFront());
EXPECT_EQ(40u, write_blocked_list.PopFront());
EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams());
EXPECT_FALSE(write_blocked_list.HasWriteBlockedStreams());
}
TEST(QuicWriteBlockedListTest, CryptoStream) {
QuicWriteBlockedList write_blocked_list;
write_blocked_list.PushBack(kCryptoStreamId,
QuicWriteBlockedList::kHighestPriority);
EXPECT_EQ(1u, write_blocked_list.NumBlockedStreams());
EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams());
EXPECT_EQ(kCryptoStreamId, write_blocked_list.PopFront());
EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams());
EXPECT_FALSE(write_blocked_list.HasWriteBlockedStreams());
}
TEST(QuicWriteBlockedListTest, HeadersStream) {
QuicWriteBlockedList write_blocked_list;
write_blocked_list.PushBack(kHeadersStreamId,
QuicWriteBlockedList::kHighestPriority);
EXPECT_EQ(1u, write_blocked_list.NumBlockedStreams());
EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams());
EXPECT_EQ(kHeadersStreamId, write_blocked_list.PopFront());
EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams());
EXPECT_FALSE(write_blocked_list.HasWriteBlockedStreams());
}
TEST(QuicWriteBlockedListTest, VerifyHeadersStream) {
QuicWriteBlockedList write_blocked_list;
write_blocked_list.PushBack(5,
QuicWriteBlockedList::kHighestPriority);
write_blocked_list.PushBack(kHeadersStreamId,
QuicWriteBlockedList::kHighestPriority);
EXPECT_EQ(2u, write_blocked_list.NumBlockedStreams());
EXPECT_TRUE(write_blocked_list.HasWriteBlockedStreams());
EXPECT_EQ(kHeadersStreamId, write_blocked_list.PopFront());
EXPECT_EQ(5u, write_blocked_list.PopFront());
EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams());
EXPECT_FALSE(write_blocked_list.HasWriteBlockedStreams());
}
}
}
}