OLD | NEW |
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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/core/packet_number_indexed_queue.h" | 5 #include "net/quic/core/packet_number_indexed_queue.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 ASSERT_FALSE(queue_.Remove(1002)); | 162 ASSERT_FALSE(queue_.Remove(1002)); |
163 } | 163 } |
164 | 164 |
165 TEST_F(PacketNumberIndexedQueueTest, FailToRemoveElementsTwice) { | 165 TEST_F(PacketNumberIndexedQueueTest, FailToRemoveElementsTwice) { |
166 queue_.Emplace(1001, "one"); | 166 queue_.Emplace(1001, "one"); |
167 ASSERT_TRUE(queue_.Remove(1001)); | 167 ASSERT_TRUE(queue_.Remove(1001)); |
168 ASSERT_FALSE(queue_.Remove(1001)); | 168 ASSERT_FALSE(queue_.Remove(1001)); |
169 ASSERT_FALSE(queue_.Remove(1001)); | 169 ASSERT_FALSE(queue_.Remove(1001)); |
170 } | 170 } |
171 | 171 |
| 172 TEST_F(PacketNumberIndexedQueueTest, ConstGetter) { |
| 173 queue_.Emplace(1001, "one"); |
| 174 const auto& const_queue = queue_; |
| 175 |
| 176 EXPECT_EQ("one", *const_queue.GetEntry(1001)); |
| 177 EXPECT_EQ(nullptr, const_queue.GetEntry(1002)); |
| 178 } |
| 179 |
172 } // namespace | 180 } // namespace |
173 } // namespace net | 181 } // namespace net |
OLD | NEW |