OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/frames/quic_ack_frame.h" | 5 #include "net/quic/core/frames/quic_ack_frame.h" |
6 #include "net/quic/core/frames/quic_blocked_frame.h" | 6 #include "net/quic/core/frames/quic_blocked_frame.h" |
7 #include "net/quic/core/frames/quic_connection_close_frame.h" | 7 #include "net/quic/core/frames/quic_connection_close_frame.h" |
8 #include "net/quic/core/frames/quic_frame.h" | 8 #include "net/quic/core/frames/quic_frame.h" |
9 #include "net/quic/core/frames/quic_goaway_frame.h" | 9 #include "net/quic/core/frames/quic_goaway_frame.h" |
10 #include "net/quic/core/frames/quic_mtu_discovery_frame.h" | 10 #include "net/quic/core/frames/quic_mtu_discovery_frame.h" |
11 #include "net/quic/core/frames/quic_padding_frame.h" | 11 #include "net/quic/core/frames/quic_padding_frame.h" |
12 #include "net/quic/core/frames/quic_path_close_frame.h" | |
13 #include "net/quic/core/frames/quic_ping_frame.h" | 12 #include "net/quic/core/frames/quic_ping_frame.h" |
14 #include "net/quic/core/frames/quic_rst_stream_frame.h" | 13 #include "net/quic/core/frames/quic_rst_stream_frame.h" |
15 #include "net/quic/core/frames/quic_stop_waiting_frame.h" | 14 #include "net/quic/core/frames/quic_stop_waiting_frame.h" |
16 #include "net/quic/core/frames/quic_stream_frame.h" | 15 #include "net/quic/core/frames/quic_stream_frame.h" |
17 #include "net/quic/core/frames/quic_window_update_frame.h" | 16 #include "net/quic/core/frames/quic_window_update_frame.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
20 | 19 |
21 namespace net { | 20 namespace net { |
22 namespace test { | 21 namespace test { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 108 } |
110 | 109 |
111 TEST(QuicFramesTest, StopWaitingFrameToString) { | 110 TEST(QuicFramesTest, StopWaitingFrameToString) { |
112 QuicStopWaitingFrame frame; | 111 QuicStopWaitingFrame frame; |
113 frame.least_unacked = 2; | 112 frame.least_unacked = 2; |
114 std::ostringstream stream; | 113 std::ostringstream stream; |
115 stream << frame; | 114 stream << frame; |
116 EXPECT_EQ("{ least_unacked: 2 }\n", stream.str()); | 115 EXPECT_EQ("{ least_unacked: 2 }\n", stream.str()); |
117 } | 116 } |
118 | 117 |
119 TEST(QuicFramesTest, PathCloseFrameToString) { | |
120 QuicPathCloseFrame frame; | |
121 frame.path_id = 1; | |
122 std::ostringstream stream; | |
123 stream << frame; | |
124 EXPECT_EQ("{ path_id: 1 }\n", stream.str()); | |
125 } | |
126 | |
127 TEST(QuicFramesTest, IsAwaitingPacket) { | 118 TEST(QuicFramesTest, IsAwaitingPacket) { |
128 QuicAckFrame ack_frame1; | 119 QuicAckFrame ack_frame1; |
129 ack_frame1.largest_observed = 10u; | 120 ack_frame1.largest_observed = 10u; |
130 ack_frame1.packets.Add(1, 11); | 121 ack_frame1.packets.Add(1, 11); |
131 EXPECT_TRUE(IsAwaitingPacket(ack_frame1, 11u, 0u)); | 122 EXPECT_TRUE(IsAwaitingPacket(ack_frame1, 11u, 0u)); |
132 EXPECT_FALSE(IsAwaitingPacket(ack_frame1, 1u, 0u)); | 123 EXPECT_FALSE(IsAwaitingPacket(ack_frame1, 1u, 0u)); |
133 | 124 |
134 ack_frame1.packets.Remove(10); | 125 ack_frame1.packets.Remove(10); |
135 EXPECT_TRUE(IsAwaitingPacket(ack_frame1, 10u, 0u)); | 126 EXPECT_TRUE(IsAwaitingPacket(ack_frame1, 10u, 0u)); |
136 | 127 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 EXPECT_EQ(2u, queue.NumIntervals()); | 284 EXPECT_EQ(2u, queue.NumIntervals()); |
294 EXPECT_TRUE(queue.Contains(10)); | 285 EXPECT_TRUE(queue.Contains(10)); |
295 EXPECT_TRUE(queue.Contains(11)); | 286 EXPECT_TRUE(queue.Contains(11)); |
296 EXPECT_TRUE(queue.Contains(20)); | 287 EXPECT_TRUE(queue.Contains(20)); |
297 EXPECT_TRUE(queue.Contains(21)); | 288 EXPECT_TRUE(queue.Contains(21)); |
298 } | 289 } |
299 | 290 |
300 } // namespace | 291 } // namespace |
301 } // namespace test | 292 } // namespace test |
302 } // namespace net | 293 } // namespace net |
OLD | NEW |