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

Side by Side Diff: webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red_unittest.cc

Issue 1696853004: Replace scoped_ptr with unique_ptr in webrtc/modules/audio_coding/codecs/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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>
11 #include <vector> 12 #include <vector>
12 13
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 #include "webrtc/base/checks.h" 15 #include "webrtc/base/checks.h"
15 #include "webrtc/base/scoped_ptr.h"
16 #include "webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.h" 16 #include "webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.h"
17 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h" 17 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h"
18 18
19 using ::testing::Return; 19 using ::testing::Return;
20 using ::testing::_; 20 using ::testing::_;
21 using ::testing::SetArgPointee; 21 using ::testing::SetArgPointee;
22 using ::testing::InSequence; 22 using ::testing::InSequence;
23 using ::testing::Invoke; 23 using ::testing::Invoke;
24 using ::testing::MockFunction; 24 using ::testing::MockFunction;
25 25
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 void Encode() { 61 void Encode() {
62 ASSERT_TRUE(red_.get() != NULL); 62 ASSERT_TRUE(red_.get() != NULL);
63 encoded_info_ = red_->Encode( 63 encoded_info_ = red_->Encode(
64 timestamp_, 64 timestamp_,
65 rtc::ArrayView<const int16_t>(audio_, num_audio_samples_10ms), 65 rtc::ArrayView<const int16_t>(audio_, num_audio_samples_10ms),
66 encoded_.size(), &encoded_[0]); 66 encoded_.size(), &encoded_[0]);
67 timestamp_ += num_audio_samples_10ms; 67 timestamp_ += num_audio_samples_10ms;
68 } 68 }
69 69
70 MockAudioEncoder mock_encoder_; 70 MockAudioEncoder mock_encoder_;
71 rtc::scoped_ptr<AudioEncoderCopyRed> red_; 71 std::unique_ptr<AudioEncoderCopyRed> red_;
72 uint32_t timestamp_; 72 uint32_t timestamp_;
73 int16_t audio_[kMaxNumSamples]; 73 int16_t audio_[kMaxNumSamples];
74 const int sample_rate_hz_; 74 const int sample_rate_hz_;
75 size_t num_audio_samples_10ms; 75 size_t num_audio_samples_10ms;
76 std::vector<uint8_t> encoded_; 76 std::vector<uint8_t> encoded_;
77 AudioEncoder::EncodedInfo encoded_info_; 77 AudioEncoder::EncodedInfo encoded_info_;
78 const int red_payload_type_; 78 const int red_payload_type_;
79 }; 79 };
80 80
81 class MockEncodeHelper { 81 class MockEncodeHelper {
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 config.speech_encoder = NULL; 327 config.speech_encoder = NULL;
328 EXPECT_DEATH(red = new AudioEncoderCopyRed(config), 328 EXPECT_DEATH(red = new AudioEncoderCopyRed(config),
329 "Speech encoder not provided."); 329 "Speech encoder not provided.");
330 // The delete operation is needed to avoid leak reports from memcheck. 330 // The delete operation is needed to avoid leak reports from memcheck.
331 delete red; 331 delete red;
332 } 332 }
333 333
334 #endif // GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) 334 #endif // GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
335 335
336 } // namespace webrtc 336 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698