| OLD | NEW |
| 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::kV3LowestPriority; | 10 using net::kV3LowestPriority; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 EXPECT_EQ(1u, write_blocked_list.NumBlockedStreams()); | 108 EXPECT_EQ(1u, write_blocked_list.NumBlockedStreams()); |
| 109 EXPECT_TRUE(write_blocked_list.HasWriteBlockedDataStreams()); | 109 EXPECT_TRUE(write_blocked_list.HasWriteBlockedDataStreams()); |
| 110 | 110 |
| 111 // There should only be one stream to pop off the front. | 111 // There should only be one stream to pop off the front. |
| 112 EXPECT_EQ(kBlockedId, write_blocked_list.PopFront()); | 112 EXPECT_EQ(kBlockedId, write_blocked_list.PopFront()); |
| 113 EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams()); | 113 EXPECT_EQ(0u, write_blocked_list.NumBlockedStreams()); |
| 114 EXPECT_FALSE(write_blocked_list.HasWriteBlockedDataStreams()); | 114 EXPECT_FALSE(write_blocked_list.HasWriteBlockedDataStreams()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 TEST(QuicWriteBlockedListTest, BatchingWrites) { | 117 TEST(QuicWriteBlockedListTest, BatchingWrites) { |
| 118 ValueRestore<bool> old_flag(&FLAGS_quic_batch_writes, true); | |
| 119 QuicWriteBlockedList write_blocked_list; | 118 QuicWriteBlockedList write_blocked_list; |
| 120 | 119 |
| 121 const QuicStreamId id1 = kClientDataStreamId1; | 120 const QuicStreamId id1 = kClientDataStreamId1; |
| 122 const QuicStreamId id2 = kClientDataStreamId2; | 121 const QuicStreamId id2 = kClientDataStreamId2; |
| 123 const QuicStreamId id3 = kClientDataStreamId2 + 2; | 122 const QuicStreamId id3 = kClientDataStreamId2 + 2; |
| 124 write_blocked_list.RegisterStream(id1, kV3LowestPriority); | 123 write_blocked_list.RegisterStream(id1, kV3LowestPriority); |
| 125 write_blocked_list.RegisterStream(id2, kV3LowestPriority); | 124 write_blocked_list.RegisterStream(id2, kV3LowestPriority); |
| 126 write_blocked_list.RegisterStream(id3, kV3HighestPriority); | 125 write_blocked_list.RegisterStream(id3, kV3HighestPriority); |
| 127 | 126 |
| 128 write_blocked_list.AddStream(id1); | 127 write_blocked_list.AddStream(id1); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 write_blocked_list.AddStream(kCryptoStreamId); | 210 write_blocked_list.AddStream(kCryptoStreamId); |
| 212 EXPECT_TRUE(write_blocked_list.ShouldYield(16)); | 211 EXPECT_TRUE(write_blocked_list.ShouldYield(16)); |
| 213 EXPECT_TRUE(write_blocked_list.ShouldYield(15)); | 212 EXPECT_TRUE(write_blocked_list.ShouldYield(15)); |
| 214 EXPECT_TRUE(write_blocked_list.ShouldYield(kHeadersStreamId)); | 213 EXPECT_TRUE(write_blocked_list.ShouldYield(kHeadersStreamId)); |
| 215 EXPECT_FALSE(write_blocked_list.ShouldYield(kCryptoStreamId)); | 214 EXPECT_FALSE(write_blocked_list.ShouldYield(kCryptoStreamId)); |
| 216 } | 215 } |
| 217 | 216 |
| 218 } // namespace | 217 } // namespace |
| 219 } // namespace test | 218 } // namespace test |
| 220 } // namespace net | 219 } // namespace net |
| OLD | NEW |