Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: net/quic/test_tools/quic_test_utils.h

Issue 2848203002: Add a platform implementation of QuicTest and QuicTestWithParam (Closed)
Patch Set: net/quic/platform/impl/quic_test_impl.cc Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Common utilities for Quic tests 5 // Common utilities for Quic tests
6 6
7 #ifndef NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ 7 #ifndef NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_
8 #define NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ 8 #define NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_
9 9
10 #include <cstdint> 10 #include <cstdint>
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // packet could not be created. 172 // packet could not be created.
173 QuicPacket* BuildUnsizedDataPacket(QuicFramer* framer, 173 QuicPacket* BuildUnsizedDataPacket(QuicFramer* framer,
174 const QuicPacketHeader& header, 174 const QuicPacketHeader& header,
175 const QuicFrames& frames); 175 const QuicFrames& frames);
176 // Returns a QuicPacket that is owned by the caller, and of size |packet_size|. 176 // Returns a QuicPacket that is owned by the caller, and of size |packet_size|.
177 QuicPacket* BuildUnsizedDataPacket(QuicFramer* framer, 177 QuicPacket* BuildUnsizedDataPacket(QuicFramer* framer,
178 const QuicPacketHeader& header, 178 const QuicPacketHeader& header,
179 const QuicFrames& frames, 179 const QuicFrames& frames,
180 size_t packet_size); 180 size_t packet_size);
181 181
182 // When constructed, checks that all QUIC flags have their correct default
183 // values and when destructed, restores those values.
184 class QuicFlagSaver {
185 public:
186 QuicFlagSaver();
187 ~QuicFlagSaver();
188 };
189
190 // Compute SHA-1 hash of the supplied std::string. 182 // Compute SHA-1 hash of the supplied std::string.
191 std::string Sha1Hash(QuicStringPiece data); 183 std::string Sha1Hash(QuicStringPiece data);
192 184
193 // Given endpoint in memory |connection_id|, returns peer's in memory connection 185 // Given endpoint in memory |connection_id|, returns peer's in memory connection
194 // id. 186 // id.
195 QuicConnectionId GetPeerInMemoryConnectionId(QuicConnectionId connection_id); 187 QuicConnectionId GetPeerInMemoryConnectionId(QuicConnectionId connection_id);
196 188
197 // Simple random number generator used to compute random numbers suitable 189 // Simple random number generator used to compute random numbers suitable
198 // for pseudo-randomly dropping packets in tests. It works by computing 190 // for pseudo-randomly dropping packets in tests. It works by computing
199 // the sha1 hash of the current seed, and using the first 64 bits as 191 // the sha1 hash of the current seed, and using the first 64 bits as
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 iov->iov_base = const_cast<char*>(str.data()); 987 iov->iov_base = const_cast<char*>(str.data());
996 iov->iov_len = static_cast<size_t>(str.size()); 988 iov->iov_len = static_cast<size_t>(str.size());
997 QuicIOVector quic_iov(iov, 1, str.size()); 989 QuicIOVector quic_iov(iov, 1, str.size());
998 return quic_iov; 990 return quic_iov;
999 } 991 }
1000 992
1001 } // namespace test 993 } // namespace test
1002 } // namespace net 994 } // namespace net
1003 995
1004 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ 996 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_stream_sequencer_buffer_peer.cc ('k') | net/quic/test_tools/quic_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698