| 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/core/quic_packet_creator.h" | 5 #include "net/quic/core/quic_packet_creator.h" |
| 6 | 6 |
| 7 #include <cstdint> | 7 #include <cstdint> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "net/quic/core/crypto/null_encrypter.h" | 13 #include "net/quic/core/crypto/null_encrypter.h" |
| 14 #include "net/quic/core/crypto/quic_decrypter.h" | 14 #include "net/quic/core/crypto/quic_decrypter.h" |
| 15 #include "net/quic/core/crypto/quic_encrypter.h" | 15 #include "net/quic/core/crypto/quic_encrypter.h" |
| 16 #include "net/quic/core/quic_flags.h" | 16 #include "net/quic/core/quic_flags.h" |
| 17 #include "net/quic/core/quic_simple_buffer_allocator.h" | 17 #include "net/quic/core/quic_simple_buffer_allocator.h" |
| 18 #include "net/quic/core/quic_utils.h" | 18 #include "net/quic/core/quic_utils.h" |
| 19 #include "net/quic/test_tools/mock_random.h" | 19 #include "net/quic/test_tools/mock_random.h" |
| 20 #include "net/quic/test_tools/quic_framer_peer.h" | 20 #include "net/quic/test_tools/quic_framer_peer.h" |
| 21 #include "net/quic/test_tools/quic_packet_creator_peer.h" | 21 #include "net/quic/test_tools/quic_packet_creator_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 #include "net/test/gtest_util.h" |
| 24 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
| 25 | 25 |
| 26 using base::StringPiece; | 26 using base::StringPiece; |
| 27 using std::ostream; | 27 using std::ostream; |
| 28 using std::string; | 28 using std::string; |
| 29 using std::vector; | |
| 30 using testing::DoAll; | 29 using testing::DoAll; |
| 31 using testing::InSequence; | 30 using testing::InSequence; |
| 32 using testing::Return; | 31 using testing::Return; |
| 33 using testing::SaveArg; | 32 using testing::SaveArg; |
| 34 using testing::StrictMock; | 33 using testing::StrictMock; |
| 35 using testing::_; | 34 using testing::_; |
| 36 | 35 |
| 37 namespace net { | 36 namespace net { |
| 38 namespace test { | 37 namespace test { |
| 39 namespace { | 38 namespace { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 53 << " include version: " << p.version_serialization << " }"; | 52 << " include version: " << p.version_serialization << " }"; |
| 54 return os; | 53 return os; |
| 55 } | 54 } |
| 56 | 55 |
| 57 QuicVersion version; | 56 QuicVersion version; |
| 58 QuicConnectionIdLength connection_id_length; | 57 QuicConnectionIdLength connection_id_length; |
| 59 bool version_serialization; | 58 bool version_serialization; |
| 60 }; | 59 }; |
| 61 | 60 |
| 62 // Constructs various test permutations. | 61 // Constructs various test permutations. |
| 63 vector<TestParams> GetTestParams() { | 62 std::vector<TestParams> GetTestParams() { |
| 64 vector<TestParams> params; | 63 std::vector<TestParams> params; |
| 65 constexpr QuicConnectionIdLength kMax = PACKET_8BYTE_CONNECTION_ID; | 64 constexpr QuicConnectionIdLength kMax = PACKET_8BYTE_CONNECTION_ID; |
| 66 QuicVersionVector all_supported_versions = AllSupportedVersions(); | 65 QuicVersionVector all_supported_versions = AllSupportedVersions(); |
| 67 for (size_t i = 0; i < all_supported_versions.size(); ++i) { | 66 for (size_t i = 0; i < all_supported_versions.size(); ++i) { |
| 68 params.push_back(TestParams(all_supported_versions[i], true, kMax)); | 67 params.push_back(TestParams(all_supported_versions[i], true, kMax)); |
| 69 params.push_back(TestParams(all_supported_versions[i], false, kMax)); | 68 params.push_back(TestParams(all_supported_versions[i], false, kMax)); |
| 70 } | 69 } |
| 71 params.push_back( | 70 params.push_back( |
| 72 TestParams(all_supported_versions[0], true, PACKET_0BYTE_CONNECTION_ID)); | 71 TestParams(all_supported_versions[0], true, PACKET_0BYTE_CONNECTION_ID)); |
| 73 params.push_back(TestParams(all_supported_versions[0], true, kMax)); | 72 params.push_back(TestParams(all_supported_versions[0], true, kMax)); |
| 74 return params; | 73 return params; |
| (...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 EXPECT_CALL(delegate_, | 1065 EXPECT_CALL(delegate_, |
| 1067 OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, _, _)); | 1066 OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, _, _)); |
| 1068 EXPECT_QUIC_BUG(creator_.ConsumeData(kCryptoStreamId, data_iovec, 0u, 0u, | 1067 EXPECT_QUIC_BUG(creator_.ConsumeData(kCryptoStreamId, data_iovec, 0u, 0u, |
| 1069 false, false, &frame), | 1068 false, false, &frame), |
| 1070 "Client hello won't fit in a single packet."); | 1069 "Client hello won't fit in a single packet."); |
| 1071 } | 1070 } |
| 1072 | 1071 |
| 1073 } // namespace | 1072 } // namespace |
| 1074 } // namespace test | 1073 } // namespace test |
| 1075 } // namespace net | 1074 } // namespace net |
| OLD | NEW |