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

Side by Side Diff: media/base/audio_buffer_converter_unittest.cc

Issue 1906423005: Replace scoped_ptr with std::unique_ptr in //media/base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-media-base: . Created 4 years, 8 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/audio_buffer_converter.h"
6
5 #include <stdint.h> 7 #include <stdint.h>
6 8
7 #include "base/memory/scoped_ptr.h" 9 #include <memory>
10
8 #include "media/base/audio_buffer.h" 11 #include "media/base/audio_buffer.h"
9 #include "media/base/audio_buffer_converter.h"
10 #include "media/base/sinc_resampler.h" 12 #include "media/base/sinc_resampler.h"
11 #include "media/base/test_helpers.h" 13 #include "media/base/test_helpers.h"
12 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
14 16
15 namespace media { 17 namespace media {
16 18
17 // Important: Use an odd buffer size here so SIMD issues are caught. 19 // Important: Use an odd buffer size here so SIMD issues are caught.
18 const int kOutFrameSize = 441; 20 const int kOutFrameSize = 441;
19 const int kOutSampleRate = 44100; 21 const int kOutSampleRate = 44100;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 75 }
74 76
75 void ConsumeAllOutput() { 77 void ConsumeAllOutput() {
76 AddInput(AudioBuffer::CreateEOSBuffer()); 78 AddInput(AudioBuffer::CreateEOSBuffer());
77 while (audio_buffer_converter_->HasNextBuffer()) 79 while (audio_buffer_converter_->HasNextBuffer())
78 ConsumeOutput(); 80 ConsumeOutput();
79 EXPECT_EQ(output_frames_, ceil(expected_output_frames_)); 81 EXPECT_EQ(output_frames_, ceil(expected_output_frames_));
80 } 82 }
81 83
82 protected: 84 protected:
83 scoped_ptr<AudioBufferConverter> audio_buffer_converter_; 85 std::unique_ptr<AudioBufferConverter> audio_buffer_converter_;
84 86
85 int input_frames_; 87 int input_frames_;
86 double expected_output_frames_; 88 double expected_output_frames_;
87 int output_frames_; 89 int output_frames_;
88 int input_buffers_; 90 int input_buffers_;
89 AudioParameters output_params_; 91 AudioParameters output_params_;
90 }; 92 };
91 93
92 TEST_F(AudioBufferConverterTest, PassThrough) { 94 TEST_F(AudioBufferConverterTest, PassThrough) {
93 scoped_refptr<AudioBuffer> in = 95 scoped_refptr<AudioBuffer> in =
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 241
240 // Since the input buffer size is a multiple of the input request size there 242 // Since the input buffer size is a multiple of the input request size there
241 // should never be any frames remaining at this point. 243 // should never be any frames remaining at this point.
242 ASSERT_EQ(kInputFrameSize % 244 ASSERT_EQ(kInputFrameSize %
243 audio_buffer_converter_->input_buffer_size_for_testing(), 245 audio_buffer_converter_->input_buffer_size_for_testing(),
244 0); 246 0);
245 EXPECT_EQ(0, audio_buffer_converter_->input_frames_left_for_testing()); 247 EXPECT_EQ(0, audio_buffer_converter_->input_frames_left_for_testing());
246 } 248 }
247 249
248 } // namespace media 250 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698