Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 const size_t kMaxReportBlocks = (1 << 5) - 1; | 120 const size_t kMaxReportBlocks = (1 << 5) - 1; |
| 121 ReportBlock rb; | 121 ReportBlock rb; |
| 122 for (size_t i = 0; i < kMaxReportBlocks; ++i) { | 122 for (size_t i = 0; i < kMaxReportBlocks; ++i) { |
| 123 rb.SetMediaSsrc(kRemoteSsrc + i); | 123 rb.SetMediaSsrc(kRemoteSsrc + i); |
| 124 EXPECT_TRUE(rr.AddReportBlock(rb)); | 124 EXPECT_TRUE(rr.AddReportBlock(rb)); |
| 125 } | 125 } |
| 126 rb.SetMediaSsrc(kRemoteSsrc + kMaxReportBlocks); | 126 rb.SetMediaSsrc(kRemoteSsrc + kMaxReportBlocks); |
| 127 EXPECT_FALSE(rr.AddReportBlock(rb)); | 127 EXPECT_FALSE(rr.AddReportBlock(rb)); |
| 128 } | 128 } |
| 129 | 129 |
| 130 TEST(RtcpPacketReceiverReportTest, SetReportBlocksOverwritesOldBlocks) { | |
|
eladalon
2017/07/21 12:53:19
nit: Checking by size only does not guarantee corr
danilchap
2017/07/21 17:11:14
I lack imagination to see that code, but it's not
| |
| 131 ReceiverReport rr; | |
| 132 rr.AddReportBlock(ReportBlock()); | |
| 133 ASSERT_EQ(rr.report_blocks().size(), 1u); | |
| 134 | |
| 135 std::vector<ReportBlock> blocks(3); | |
| 136 EXPECT_TRUE(rr.SetReportBlocks(blocks)); | |
| 137 EXPECT_EQ(rr.report_blocks().size(), 3u); | |
| 138 } | |
| 139 | |
| 140 TEST(RtcpPacketReceiverReportTest, SetTooManyReportBlocks) { | |
| 141 ReceiverReport rr; | |
| 142 const size_t kMaxReportBlocks = (1 << 5) - 1; | |
| 143 | |
| 144 std::vector<ReportBlock> blocks(kMaxReportBlocks); | |
| 145 EXPECT_TRUE(rr.SetReportBlocks(blocks)); | |
|
eladalon
2017/07/21 12:53:19
nit: Two tests here:
1. Max number of blocks accep
danilchap
2017/07/21 17:11:14
renamed to document this test is about showing the
| |
| 146 | |
| 147 blocks.push_back(ReportBlock()); | |
| 148 EXPECT_FALSE(rr.SetReportBlocks(blocks)); | |
| 149 } | |
| 150 | |
| 130 } // namespace webrtc | 151 } // namespace webrtc |
| OLD | NEW |