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

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

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