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/test_tools/quic_test_utils.h" | 5 #include "net/quic/test_tools/quic_test_utils.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "net/quic/core/crypto/crypto_framer.h" | 10 #include "net/quic/core/crypto/crypto_framer.h" |
11 #include "net/quic/core/crypto/crypto_handshake.h" | 11 #include "net/quic/core/crypto/crypto_handshake.h" |
12 #include "net/quic/core/crypto/crypto_utils.h" | 12 #include "net/quic/core/crypto/crypto_utils.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_data_writer.h" | 16 #include "net/quic/core/quic_data_writer.h" |
17 #include "net/quic/core/quic_flags.h" | |
18 #include "net/quic/core/quic_framer.h" | 17 #include "net/quic/core/quic_framer.h" |
19 #include "net/quic/core/quic_packet_creator.h" | 18 #include "net/quic/core/quic_packet_creator.h" |
20 #include "net/quic/core/quic_utils.h" | 19 #include "net/quic/core/quic_utils.h" |
21 #include "net/quic/platform/api/quic_endian.h" | 20 #include "net/quic/platform/api/quic_endian.h" |
| 21 #include "net/quic/platform/api/quic_flags.h" |
22 #include "net/quic/platform/api/quic_logging.h" | 22 #include "net/quic/platform/api/quic_logging.h" |
23 #include "net/quic/platform/api/quic_ptr_util.h" | 23 #include "net/quic/platform/api/quic_ptr_util.h" |
24 #include "net/quic/test_tools/crypto_test_utils.h" | 24 #include "net/quic/test_tools/crypto_test_utils.h" |
25 #include "net/quic/test_tools/quic_connection_peer.h" | 25 #include "net/quic/test_tools/quic_connection_peer.h" |
26 #include "net/spdy/spdy_frame_builder.h" | 26 #include "net/spdy/spdy_frame_builder.h" |
27 #include "third_party/boringssl/src/include/openssl/sha.h" | 27 #include "third_party/boringssl/src/include/openssl/sha.h" |
28 | 28 |
29 using std::string; | 29 using std::string; |
30 using testing::_; | 30 using testing::_; |
31 using testing::Invoke; | 31 using testing::Invoke; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Re-construct the data packet with data ownership. | 77 // Re-construct the data packet with data ownership. |
78 return new QuicPacket(buffer, length, /* owns_buffer */ true, | 78 return new QuicPacket(buffer, length, /* owns_buffer */ true, |
79 header.public_header.connection_id_length, | 79 header.public_header.connection_id_length, |
80 header.public_header.version_flag, | 80 header.public_header.version_flag, |
81 header.public_header.nonce != nullptr, | 81 header.public_header.nonce != nullptr, |
82 header.public_header.packet_number_length); | 82 header.public_header.packet_number_length); |
83 } | 83 } |
84 | 84 |
85 QuicFlagSaver::QuicFlagSaver() { | 85 QuicFlagSaver::QuicFlagSaver() { |
86 #define QUIC_FLAG(type, flag, value) \ | 86 #define QUIC_FLAG(type, flag, value) \ |
87 CHECK_EQ(value, base::GetFlag(flag)) \ | 87 CHECK_EQ(value, GetQuicFlag(flag) ) \ |
88 << "Flag set to an unexpected value. A prior test is likely " \ | 88 << "Flag set to an unexpected value. A prior test is likely " \ |
89 << "setting a flag without using a QuicFlagSaver"; | 89 << "setting a flag without using a QuicFlagSaver"; |
90 #include "net/quic/core/quic_flags_list.h" | 90 #include "net/quic/core/quic_flags_list.h" |
91 #undef QUIC_FLAG | 91 #undef QUIC_FLAG |
92 } | 92 } |
93 | 93 |
94 QuicFlagSaver::~QuicFlagSaver() { | 94 QuicFlagSaver::~QuicFlagSaver() { |
95 #define QUIC_FLAG(type, flag, value) base::SetFlag(&flag, value); | 95 #define QUIC_FLAG(type, flag, value) SetQuicFlag(&flag, value); |
96 #include "net/quic/core/quic_flags_list.h" | 96 #include "net/quic/core/quic_flags_list.h" |
97 #undef QUIC_FLAG | 97 #undef QUIC_FLAG |
98 } | 98 } |
99 | 99 |
100 string Sha1Hash(QuicStringPiece data) { | 100 string Sha1Hash(QuicStringPiece data) { |
101 char buffer[SHA_DIGEST_LENGTH]; | 101 char buffer[SHA_DIGEST_LENGTH]; |
102 SHA1(reinterpret_cast<const uint8_t*>(data.data()), data.size(), | 102 SHA1(reinterpret_cast<const uint8_t*>(data.data()), data.size(), |
103 reinterpret_cast<uint8_t*>(buffer)); | 103 reinterpret_cast<uint8_t*>(buffer)); |
104 return string(buffer, arraysize(buffer)); | 104 return string(buffer, arraysize(buffer)); |
105 } | 105 } |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 // strike register worries that we've just overflowed a uint32_t time. | 850 // strike register worries that we've just overflowed a uint32_t time. |
851 (*server_connection)->AdvanceTime(connection_start_time); | 851 (*server_connection)->AdvanceTime(connection_start_time); |
852 } | 852 } |
853 | 853 |
854 QuicStreamId QuicClientDataStreamId(int i) { | 854 QuicStreamId QuicClientDataStreamId(int i) { |
855 return kClientDataStreamId1 + 2 * i; | 855 return kClientDataStreamId1 + 2 * i; |
856 } | 856 } |
857 | 857 |
858 } // namespace test | 858 } // namespace test |
859 } // namespace net | 859 } // namespace net |
OLD | NEW |