| 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_generator.h" | 5 #include "net/quic/core/quic_packet_generator.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 "net/quic/core/crypto/crypto_protocol.h" | 12 #include "net/quic/core/crypto/crypto_protocol.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_simple_buffer_allocator.h" | 16 #include "net/quic/core/quic_simple_buffer_allocator.h" |
| 17 #include "net/quic/core/quic_utils.h" | 17 #include "net/quic/core/quic_utils.h" |
| 18 #include "net/quic/platform/api/quic_socket_address.h" | 18 #include "net/quic/platform/api/quic_socket_address.h" |
| 19 #include "net/quic/platform/api/quic_string_piece.h" | 19 #include "net/quic/platform/api/quic_string_piece.h" |
| 20 #include "net/quic/platform/api/quic_test.h" |
| 20 #include "net/quic/test_tools/mock_random.h" | 21 #include "net/quic/test_tools/mock_random.h" |
| 21 #include "net/quic/test_tools/quic_packet_creator_peer.h" | 22 #include "net/quic/test_tools/quic_packet_creator_peer.h" |
| 22 #include "net/quic/test_tools/quic_packet_generator_peer.h" | 23 #include "net/quic/test_tools/quic_packet_generator_peer.h" |
| 23 #include "net/quic/test_tools/quic_test_utils.h" | 24 #include "net/quic/test_tools/quic_test_utils.h" |
| 24 #include "net/quic/test_tools/simple_quic_framer.h" | 25 #include "net/quic/test_tools/simple_quic_framer.h" |
| 25 #include "testing/gmock/include/gmock/gmock.h" | |
| 26 #include "testing/gtest/include/gtest/gtest.h" | |
| 27 | 26 |
| 28 using std::string; | 27 using std::string; |
| 29 using testing::InSequence; | 28 using testing::InSequence; |
| 30 using testing::Return; | 29 using testing::Return; |
| 31 using testing::StrictMock; | 30 using testing::StrictMock; |
| 32 using testing::_; | 31 using testing::_; |
| 33 | 32 |
| 34 namespace net { | 33 namespace net { |
| 35 namespace test { | 34 namespace test { |
| 36 namespace { | 35 namespace { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 size_t num_rst_stream_frames; | 94 size_t num_rst_stream_frames; |
| 96 size_t num_stop_waiting_frames; | 95 size_t num_stop_waiting_frames; |
| 97 size_t num_stream_frames; | 96 size_t num_stream_frames; |
| 98 size_t num_ping_frames; | 97 size_t num_ping_frames; |
| 99 size_t num_mtu_discovery_frames; | 98 size_t num_mtu_discovery_frames; |
| 100 size_t num_padding_frames; | 99 size_t num_padding_frames; |
| 101 }; | 100 }; |
| 102 | 101 |
| 103 } // namespace | 102 } // namespace |
| 104 | 103 |
| 105 class QuicPacketGeneratorTest : public ::testing::Test { | 104 class QuicPacketGeneratorTest : public QuicTest { |
| 106 public: | 105 public: |
| 107 QuicPacketGeneratorTest() | 106 QuicPacketGeneratorTest() |
| 108 : framer_(AllSupportedVersions(), | 107 : framer_(AllSupportedVersions(), |
| 109 QuicTime::Zero(), | 108 QuicTime::Zero(), |
| 110 Perspective::IS_CLIENT), | 109 Perspective::IS_CLIENT), |
| 111 generator_(42, | 110 generator_(42, |
| 112 &framer_, | 111 &framer_, |
| 113 &random_generator_, | 112 &random_generator_, |
| 114 &buffer_allocator_, | 113 &buffer_allocator_, |
| 115 &delegate_), | 114 &delegate_), |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 for (size_t i = 2; i < packets_.size(); ++i) { | 1040 for (size_t i = 2; i < packets_.size(); ++i) { |
| 1042 // Following packets only have paddings. | 1041 // Following packets only have paddings. |
| 1043 contents.num_stream_frames = 0; | 1042 contents.num_stream_frames = 0; |
| 1044 contents.num_padding_frames = 1; | 1043 contents.num_padding_frames = 1; |
| 1045 CheckPacketContains(contents, i); | 1044 CheckPacketContains(contents, i); |
| 1046 } | 1045 } |
| 1047 } | 1046 } |
| 1048 | 1047 |
| 1049 } // namespace test | 1048 } // namespace test |
| 1050 } // namespace net | 1049 } // namespace net |
| OLD | NEW |