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_framer.h" | 5 #include "net/quic/quic_framer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/port.h" | 15 #include "base/port.h" |
16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
17 #include "net/quic/crypto/quic_decrypter.h" | 17 #include "net/quic/crypto/quic_decrypter.h" |
18 #include "net/quic/crypto/quic_encrypter.h" | 18 #include "net/quic/crypto/quic_encrypter.h" |
19 #include "net/quic/quic_protocol.h" | 19 #include "net/quic/quic_protocol.h" |
20 #include "net/quic/quic_utils.h" | 20 #include "net/quic/quic_utils.h" |
21 #include "net/quic/test_tools/quic_framer_peer.h" | 21 #include "net/quic/test_tools/quic_framer_peer.h" |
22 #include "net/quic/test_tools/quic_test_utils.h" | 22 #include "net/quic/test_tools/quic_test_utils.h" |
| 23 #include "net/test/gtest_util.h" |
23 | 24 |
24 using base::hash_set; | 25 using base::hash_set; |
25 using base::StringPiece; | 26 using base::StringPiece; |
26 using std::make_pair; | 27 using std::make_pair; |
27 using std::map; | 28 using std::map; |
28 using std::numeric_limits; | 29 using std::numeric_limits; |
29 using std::pair; | 30 using std::pair; |
30 using std::string; | 31 using std::string; |
31 using std::vector; | 32 using std::vector; |
32 using testing::Return; | 33 using testing::Return; |
(...skipping 2938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2971 header.packet_sequence_number = GG_UINT64_C(0x123456789ABC); | 2972 header.packet_sequence_number = GG_UINT64_C(0x123456789ABC); |
2972 header.fec_group = 0; | 2973 header.fec_group = 0; |
2973 | 2974 |
2974 QuicCongestionFeedbackFrame congestion_feedback_frame; | 2975 QuicCongestionFeedbackFrame congestion_feedback_frame; |
2975 congestion_feedback_frame.type = | 2976 congestion_feedback_frame.type = |
2976 static_cast<CongestionFeedbackType>(kFixRate + 1); | 2977 static_cast<CongestionFeedbackType>(kFixRate + 1); |
2977 | 2978 |
2978 QuicFrames frames; | 2979 QuicFrames frames; |
2979 frames.push_back(QuicFrame(&congestion_feedback_frame)); | 2980 frames.push_back(QuicFrame(&congestion_feedback_frame)); |
2980 | 2981 |
2981 scoped_ptr<QuicPacket> data( | 2982 scoped_ptr<QuicPacket> data; |
2982 framer_.BuildUnsizedDataPacket(header, frames).packet); | 2983 EXPECT_DFATAL( |
| 2984 data.reset(framer_.BuildUnsizedDataPacket(header, frames).packet), |
| 2985 "AppendQuicCongestionFeedbackFrame failed"); |
2983 ASSERT_TRUE(data == NULL); | 2986 ASSERT_TRUE(data == NULL); |
2984 } | 2987 } |
2985 | 2988 |
2986 TEST_P(QuicFramerTest, BuildRstFramePacket) { | 2989 TEST_P(QuicFramerTest, BuildRstFramePacket) { |
2987 QuicPacketHeader header; | 2990 QuicPacketHeader header; |
2988 header.public_header.guid = GG_UINT64_C(0xFEDCBA9876543210); | 2991 header.public_header.guid = GG_UINT64_C(0xFEDCBA9876543210); |
2989 header.public_header.reset_flag = false; | 2992 header.public_header.reset_flag = false; |
2990 header.public_header.version_flag = false; | 2993 header.public_header.version_flag = false; |
2991 header.fec_flag = false; | 2994 header.fec_flag = false; |
2992 header.entropy_flag = false; | 2995 header.entropy_flag = false; |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3513 EXPECT_CALL(visitor, OnPacketComplete()); | 3516 EXPECT_CALL(visitor, OnPacketComplete()); |
3514 EXPECT_CALL(visitor, OnUnauthenticatedPublicHeader(_)).WillOnce(Return(true)); | 3517 EXPECT_CALL(visitor, OnUnauthenticatedPublicHeader(_)).WillOnce(Return(true)); |
3515 | 3518 |
3516 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); | 3519 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); |
3517 EXPECT_TRUE(framer_.ProcessPacket(encrypted)); | 3520 EXPECT_TRUE(framer_.ProcessPacket(encrypted)); |
3518 EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); | 3521 EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); |
3519 } | 3522 } |
3520 | 3523 |
3521 } // namespace test | 3524 } // namespace test |
3522 } // namespace net | 3525 } // namespace net |
OLD | NEW |