OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_protocol.h" | 5 #include "net/quic/quic_protocol.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "net/quic/quic_utils.h" | 10 #include "net/quic/quic_utils.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 ack_frame2.largest_observed = 100u; | 60 ack_frame2.largest_observed = 100u; |
61 ack_frame2.packets.Add(21, 100); | 61 ack_frame2.packets.Add(21, 100); |
62 EXPECT_FALSE(IsAwaitingPacket(ack_frame2, 11u, 20u)); | 62 EXPECT_FALSE(IsAwaitingPacket(ack_frame2, 11u, 20u)); |
63 EXPECT_FALSE(IsAwaitingPacket(ack_frame2, 80u, 20u)); | 63 EXPECT_FALSE(IsAwaitingPacket(ack_frame2, 80u, 20u)); |
64 EXPECT_TRUE(IsAwaitingPacket(ack_frame2, 101u, 20u)); | 64 EXPECT_TRUE(IsAwaitingPacket(ack_frame2, 101u, 20u)); |
65 | 65 |
66 ack_frame2.packets.Remove(50); | 66 ack_frame2.packets.Remove(50); |
67 EXPECT_TRUE(IsAwaitingPacket(ack_frame2, 50u, 20u)); | 67 EXPECT_TRUE(IsAwaitingPacket(ack_frame2, 50u, 20u)); |
68 } | 68 } |
69 | 69 |
70 TEST(QuicProtocolTest, QuicDeprecatedErrorCodeCount) { | |
71 // If you deprecated any QuicErrorCode, you will need to update the | |
72 // deprecated QuicErrorCode count. Otherwise this test will fail. | |
73 int num_deprecated_errors = 0; | |
74 std::string invalid_error_code = "INVALID_ERROR_CODE"; | |
75 for (int i = 0; i < QUIC_LAST_ERROR; ++i) { | |
76 if (QuicUtils::ErrorToString(static_cast<QuicErrorCode>(i)) == | |
77 invalid_error_code) { | |
78 ++num_deprecated_errors; | |
79 } | |
80 } | |
81 EXPECT_EQ(kDeprecatedQuicErrorCount, num_deprecated_errors); | |
82 } | |
83 | |
84 TEST(QuicProtocolTest, QuicVersionToQuicTag) { | 70 TEST(QuicProtocolTest, QuicVersionToQuicTag) { |
85 // If you add a new version to the QuicVersion enum you will need to add a new | 71 // If you add a new version to the QuicVersion enum you will need to add a new |
86 // case to QuicVersionToQuicTag, otherwise this test will fail. | 72 // case to QuicVersionToQuicTag, otherwise this test will fail. |
87 | 73 |
88 // TODO(rtenneti): Enable checking of Log(ERROR) messages. | 74 // TODO(rtenneti): Enable checking of Log(ERROR) messages. |
89 #if 0 | 75 #if 0 |
90 // Any logs would indicate an unsupported version which we don't expect. | 76 // Any logs would indicate an unsupported version which we don't expect. |
91 ScopedMockLog log(kDoNotCaptureLogsYet); | 77 ScopedMockLog log(kDoNotCaptureLogsYet); |
92 EXPECT_CALL(log, Log(_, _, _)).Times(0); | 78 EXPECT_CALL(log, Log(_, _, _)).Times(0); |
93 log.StartCapturingLogs(); | 79 log.StartCapturingLogs(); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 EXPECT_EQ(10u, queue.LastIntervalLength()); | 384 EXPECT_EQ(10u, queue.LastIntervalLength()); |
399 queue.Remove(9, 21); | 385 queue.Remove(9, 21); |
400 EXPECT_EQ(3u, queue.NumIntervals()); | 386 EXPECT_EQ(3u, queue.NumIntervals()); |
401 EXPECT_FALSE(queue.Contains(9)); | 387 EXPECT_FALSE(queue.Contains(9)); |
402 EXPECT_FALSE(queue.Contains(20)); | 388 EXPECT_FALSE(queue.Contains(20)); |
403 } | 389 } |
404 | 390 |
405 } // namespace | 391 } // namespace |
406 } // namespace test | 392 } // namespace test |
407 } // namespace net | 393 } // namespace net |
OLD | NEW |