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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_format_vp8_unittest.cc

Issue 1921233002: Replace the remaining scoped_ptr with unique_ptr in webrtc/modules/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 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 /* 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
11 #include <memory>
12
11 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
13 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h" 15 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h"
14 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.h" 16 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.h"
15 #include "webrtc/typedefs.h" 17 #include "webrtc/typedefs.h"
16 18
17 #define CHECK_ARRAY_SIZE(expected_size, array) \ 19 #define CHECK_ARRAY_SIZE(expected_size, array) \
18 static_assert(expected_size == sizeof(array) / sizeof(array[0]), \ 20 static_assert(expected_size == sizeof(array) / sizeof(array[0]), \
19 "check array size"); 21 "check array size");
20 22
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 void ExpectPacket(RtpDepacketizer::ParsedPayload* parsed_payload, 412 void ExpectPacket(RtpDepacketizer::ParsedPayload* parsed_payload,
411 const uint8_t* data, 413 const uint8_t* data,
412 size_t length) { 414 size_t length) {
413 ASSERT_TRUE(parsed_payload != NULL); 415 ASSERT_TRUE(parsed_payload != NULL);
414 EXPECT_THAT(std::vector<uint8_t>( 416 EXPECT_THAT(std::vector<uint8_t>(
415 parsed_payload->payload, 417 parsed_payload->payload,
416 parsed_payload->payload + parsed_payload->payload_length), 418 parsed_payload->payload + parsed_payload->payload_length),
417 ::testing::ElementsAreArray(data, length)); 419 ::testing::ElementsAreArray(data, length));
418 } 420 }
419 421
420 rtc::scoped_ptr<RtpDepacketizer> depacketizer_; 422 std::unique_ptr<RtpDepacketizer> depacketizer_;
421 }; 423 };
422 424
423 TEST_F(RtpDepacketizerVp8Test, BasicHeader) { 425 TEST_F(RtpDepacketizerVp8Test, BasicHeader) {
424 const uint8_t kHeaderLength = 1; 426 const uint8_t kHeaderLength = 1;
425 uint8_t packet[4] = {0}; 427 uint8_t packet[4] = {0};
426 packet[0] = 0x14; // Binary 0001 0100; S = 1, PartID = 4. 428 packet[0] = 0x14; // Binary 0001 0100; S = 1, PartID = 4.
427 packet[1] = 0x01; // P frame. 429 packet[1] = 0x01; // P frame.
428 RtpDepacketizer::ParsedPayload payload; 430 RtpDepacketizer::ParsedPayload payload;
429 431
430 ASSERT_TRUE(depacketizer_->Parse(&payload, packet, sizeof(packet))); 432 ASSERT_TRUE(depacketizer_->Parse(&payload, packet, sizeof(packet)));
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 input_header.layerSync); 595 input_header.layerSync);
594 } 596 }
595 597
596 TEST_F(RtpDepacketizerVp8Test, TestEmptyPayload) { 598 TEST_F(RtpDepacketizerVp8Test, TestEmptyPayload) {
597 // Using a wild pointer to crash on accesses from inside the depacketizer. 599 // Using a wild pointer to crash on accesses from inside the depacketizer.
598 uint8_t* garbage_ptr = reinterpret_cast<uint8_t*>(0x4711); 600 uint8_t* garbage_ptr = reinterpret_cast<uint8_t*>(0x4711);
599 RtpDepacketizer::ParsedPayload payload; 601 RtpDepacketizer::ParsedPayload payload;
600 EXPECT_FALSE(depacketizer_->Parse(&payload, garbage_ptr, 0)); 602 EXPECT_FALSE(depacketizer_->Parse(&payload, garbage_ptr, 0));
601 } 603 }
602 } // namespace webrtc 604 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_format_h264_unittest.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_format_vp9_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698