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

Side by Side Diff: webrtc/test/fake_network_pipe_unittest.cc

Issue 2534683002: RTC_[D]CHECK_op: Remove superfluous casts (Closed)
Patch Set: test Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 virtual void SetUp() { 63 virtual void SetUp() {
64 receiver_.reset(new TestReceiver()); 64 receiver_.reset(new TestReceiver());
65 ON_CALL(*receiver_, DeliverPacket(_, _, _, _)) 65 ON_CALL(*receiver_, DeliverPacket(_, _, _, _))
66 .WillByDefault(Return(PacketReceiver::DELIVERY_OK)); 66 .WillByDefault(Return(PacketReceiver::DELIVERY_OK));
67 } 67 }
68 68
69 virtual void TearDown() { 69 virtual void TearDown() {
70 } 70 }
71 71
72 void SendPackets(FakeNetworkPipe* pipe, int number_packets, int packet_size) { 72 void SendPackets(FakeNetworkPipe* pipe, int number_packets, int packet_size) {
73 RTC_DCHECK_GE(packet_size, static_cast<int>(sizeof(int))); 73 RTC_DCHECK_GE(packet_size, sizeof(int));
74 std::unique_ptr<uint8_t[]> packet(new uint8_t[packet_size]); 74 std::unique_ptr<uint8_t[]> packet(new uint8_t[packet_size]);
75 for (int i = 0; i < number_packets; ++i) { 75 for (int i = 0; i < number_packets; ++i) {
76 // Set a sequence number for the packets by 76 // Set a sequence number for the packets by
77 // using the first bytes in the packet. 77 // using the first bytes in the packet.
78 memcpy(packet.get(), &i, sizeof(int)); 78 memcpy(packet.get(), &i, sizeof(int));
79 pipe->SendPacket(packet.get(), packet_size); 79 pipe->SendPacket(packet.get(), packet_size);
80 } 80 }
81 } 81 }
82 82
83 int PacketTimeMs(int capacity_kbps, int packet_size) const { 83 int PacketTimeMs(int capacity_kbps, int packet_size) const {
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 receiver->delivered_sequence_numbers_[i]; 413 receiver->delivered_sequence_numbers_[i];
414 if (diff > 1) 414 if (diff > 1)
415 ++num_bursts; 415 ++num_bursts;
416 } 416 }
417 417
418 double average_burst_length = static_cast<double>(lost_packets) / num_bursts; 418 double average_burst_length = static_cast<double>(lost_packets) / num_bursts;
419 419
420 EXPECT_NEAR(kAvgBurstLength, average_burst_length, 0.3); 420 EXPECT_NEAR(kAvgBurstLength, average_burst_length, 0.3);
421 } 421 }
422 } // namespace webrtc 422 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698