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

Side by Side Diff: net/quic/quic_packet_creator_test.cc

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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
« no previous file with comments | « net/quic/quic_packet_creator.cc ('k') | net/quic/quic_packet_generator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "net/quic/quic_packet_creator.h" 5 #include "net/quic/quic_packet_creator.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/macros.h"
9 #include "base/stl_util.h" 10 #include "base/stl_util.h"
10 #include "net/quic/crypto/null_encrypter.h" 11 #include "net/quic/crypto/null_encrypter.h"
11 #include "net/quic/crypto/quic_decrypter.h" 12 #include "net/quic/crypto/quic_decrypter.h"
12 #include "net/quic/crypto/quic_encrypter.h" 13 #include "net/quic/crypto/quic_encrypter.h"
13 #include "net/quic/quic_flags.h" 14 #include "net/quic/quic_flags.h"
14 #include "net/quic/quic_utils.h" 15 #include "net/quic/quic_utils.h"
15 #include "net/quic/test_tools/mock_random.h" 16 #include "net/quic/test_tools/mock_random.h"
16 #include "net/quic/test_tools/quic_framer_peer.h" 17 #include "net/quic/test_tools/quic_framer_peer.h"
17 #include "net/quic/test_tools/quic_packet_creator_peer.h" 18 #include "net/quic/test_tools/quic_packet_creator_peer.h"
18 #include "net/quic/test_tools/quic_test_utils.h" 19 #include "net/quic/test_tools/quic_test_utils.h"
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 QuicFrame(new QuicStreamFrame(0u, false, 0u, StringPiece()))); 1243 QuicFrame(new QuicStreamFrame(0u, false, 0u, StringPiece())));
1243 1244
1244 for (int i = 0; i < 2; ++i) { 1245 for (int i = 0; i < 2; ++i) {
1245 for (int j = 0; j < 64; ++j) { 1246 for (int j = 0; j < 64; ++j) {
1246 SerializedPacket serialized = SerializeAllFrames(frames_); 1247 SerializedPacket serialized = SerializeAllFrames(frames_);
1247 // Verify both BoolSource and hash algorithm. 1248 // Verify both BoolSource and hash algorithm.
1248 bool expected_rand_bool = 1249 bool expected_rand_bool =
1249 (mock_random_.RandUint64() & (UINT64_C(1) << j)) != 0; 1250 (mock_random_.RandUint64() & (UINT64_C(1) << j)) != 0;
1250 bool observed_rand_bool = 1251 bool observed_rand_bool =
1251 (serialized.entropy_hash & (1 << ((j + 1) % 8))) != 0; 1252 (serialized.entropy_hash & (1 << ((j + 1) % 8))) != 0;
1252 uint8 rest_of_hash = serialized.entropy_hash & ~(1 << ((j + 1) % 8)); 1253 uint8_t rest_of_hash = serialized.entropy_hash & ~(1 << ((j + 1) % 8));
1253 EXPECT_EQ(expected_rand_bool, observed_rand_bool); 1254 EXPECT_EQ(expected_rand_bool, observed_rand_bool);
1254 EXPECT_EQ(0, rest_of_hash); 1255 EXPECT_EQ(0, rest_of_hash);
1255 delete serialized.packet; 1256 delete serialized.packet;
1256 } 1257 }
1257 // After 64 calls, BoolSource will refresh the bucket - make sure it does. 1258 // After 64 calls, BoolSource will refresh the bucket - make sure it does.
1258 mock_random_.ChangeValue(); 1259 mock_random_.ChangeValue();
1259 } 1260 }
1260 1261
1261 delete frames_[0].stream_frame; 1262 delete frames_[0].stream_frame;
1262 } 1263 }
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 creator_.SetCurrentPath(kDefaultPathId, 2, 10000 / kDefaultMaxPacketSize); 1520 creator_.SetCurrentPath(kDefaultPathId, 2, 10000 / kDefaultMaxPacketSize);
1520 // FEC packet consumes a packet number. 1521 // FEC packet consumes a packet number.
1521 EXPECT_EQ(64 * 256 - max_packets_per_fec_group, creator_.packet_number()); 1522 EXPECT_EQ(64 * 256 - max_packets_per_fec_group, creator_.packet_number());
1522 EXPECT_EQ(PACKET_2BYTE_PACKET_NUMBER, 1523 EXPECT_EQ(PACKET_2BYTE_PACKET_NUMBER,
1523 QuicPacketCreatorPeer::NextPacketNumberLength(&creator_)); 1524 QuicPacketCreatorPeer::NextPacketNumberLength(&creator_));
1524 } 1525 }
1525 1526
1526 } // namespace 1527 } // namespace
1527 } // namespace test 1528 } // namespace test
1528 } // namespace net 1529 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_packet_creator.cc ('k') | net/quic/quic_packet_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698