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

Unified Diff: media/base/android/media_codec_decoder_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 side-by-side diff with in-line comments
Download patch
Index: media/base/android/media_codec_decoder_unittest.cc
diff --git a/media/base/android/media_codec_decoder_unittest.cc b/media/base/android/media_codec_decoder_unittest.cc
index 087aec5689e2d6101307ae4ebbedcb518798c44e..50b406db308059f0d13ba521d410f06016424f9f 100644
--- a/media/base/android/media_codec_decoder_unittest.cc
+++ b/media/base/android/media_codec_decoder_unittest.cc
@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
#include <utility>
#include "base/bind.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/thread_task_runner_handle.h"
#include "base/timer/timer.h"
#include "media/base/android/audio_media_codec_decoder.h"
@@ -157,7 +159,7 @@ class MediaCodecDecoderTest : public testing::Test {
bool WaitForCondition(const Predicate& condition,
const base::TimeDelta& timeout = kDefaultTimeout);
- void SetDataFactory(scoped_ptr<TestDataFactory> factory) {
+ void SetDataFactory(std::unique_ptr<TestDataFactory> factory) {
data_factory_ = std::move(factory);
}
@@ -205,8 +207,8 @@ class MediaCodecDecoderTest : public testing::Test {
void OnVideoCodecCreated() {}
- scoped_ptr<MediaCodecDecoder> decoder_;
- scoped_ptr<TestDataFactory> data_factory_;
+ std::unique_ptr<MediaCodecDecoder> decoder_;
+ std::unique_ptr<TestDataFactory> data_factory_;
Minimax<base::TimeDelta> pts_stat_;
gfx::Size video_size_;
@@ -266,7 +268,7 @@ bool MediaCodecDecoderTest::WaitForCondition(const Predicate& condition,
}
void MediaCodecDecoderTest::CreateAudioDecoder() {
- decoder_ = scoped_ptr<MediaCodecDecoder>(new AudioMediaCodecDecoder(
+ decoder_ = base::WrapUnique(new AudioMediaCodecDecoder(
task_runner_, &frame_statistics_,
base::Bind(&MediaCodecDecoderTest::OnDataRequested,
base::Unretained(this)),
@@ -284,7 +286,7 @@ void MediaCodecDecoderTest::CreateAudioDecoder() {
}
void MediaCodecDecoderTest::CreateVideoDecoder() {
- decoder_ = scoped_ptr<MediaCodecDecoder>(new VideoMediaCodecDecoder(
+ decoder_ = base::WrapUnique(new VideoMediaCodecDecoder(
task_runner_, &frame_statistics_,
base::Bind(&MediaCodecDecoderTest::OnDataRequested,
base::Unretained(this)),
@@ -329,7 +331,7 @@ TEST_F(MediaCodecDecoderTest, AudioPrefetch) {
CreateAudioDecoder();
base::TimeDelta duration = base::TimeDelta::FromMilliseconds(500);
- SetDataFactory(scoped_ptr<TestDataFactory>(new AudioFactory(duration)));
+ SetDataFactory(base::WrapUnique(new AudioFactory(duration)));
decoder_->Prefetch(base::Bind(&MediaCodecDecoderTest::SetPrefetched,
base::Unretained(this), true));
@@ -342,7 +344,7 @@ TEST_F(MediaCodecDecoderTest, VideoPrefetch) {
CreateVideoDecoder();
base::TimeDelta duration = base::TimeDelta::FromMilliseconds(500);
- SetDataFactory(scoped_ptr<VideoFactory>(new VideoFactory(duration)));
+ SetDataFactory(base::WrapUnique(new VideoFactory(duration)));
decoder_->Prefetch(base::Bind(&MediaCodecDecoderTest::SetPrefetched,
base::Unretained(this), true));
@@ -366,7 +368,7 @@ TEST_F(MediaCodecDecoderTest, AudioConfigureValidParams) {
CreateAudioDecoder();
base::TimeDelta duration = base::TimeDelta::FromMilliseconds(500);
- scoped_ptr<AudioFactory> factory(new AudioFactory(duration));
+ std::unique_ptr<AudioFactory> factory(new AudioFactory(duration));
decoder_->SetDemuxerConfigs(factory->GetConfigs());
EXPECT_EQ(MediaCodecDecoder::kConfigOk, decoder_->Configure(nullptr));
@@ -381,7 +383,7 @@ TEST_F(MediaCodecDecoderTest, VideoConfigureNoParams) {
// We have to prefetch decoder.
base::TimeDelta duration = base::TimeDelta::FromMilliseconds(500);
- SetDataFactory(scoped_ptr<VideoFactory>(new VideoFactory(duration)));
+ SetDataFactory(base::WrapUnique(new VideoFactory(duration)));
decoder_->Prefetch(base::Bind(&MediaCodecDecoderTest::SetPrefetched,
base::Unretained(this), true));
@@ -404,7 +406,7 @@ TEST_F(MediaCodecDecoderTest, VideoConfigureNoSurface) {
// We have to prefetch decoder.
base::TimeDelta duration = base::TimeDelta::FromMilliseconds(500);
- SetDataFactory(scoped_ptr<VideoFactory>(new VideoFactory(duration)));
+ SetDataFactory(base::WrapUnique(new VideoFactory(duration)));
decoder_->Prefetch(base::Bind(&MediaCodecDecoderTest::SetPrefetched,
base::Unretained(this), true));
@@ -428,7 +430,7 @@ TEST_F(MediaCodecDecoderTest, VideoConfigureInvalidSurface) {
// We have to prefetch decoder.
base::TimeDelta duration = base::TimeDelta::FromMilliseconds(500);
- SetDataFactory(scoped_ptr<VideoFactory>(new VideoFactory(duration)));
+ SetDataFactory(base::WrapUnique(new VideoFactory(duration)));
decoder_->Prefetch(base::Bind(&MediaCodecDecoderTest::SetPrefetched,
base::Unretained(this), true));
@@ -462,7 +464,7 @@ TEST_F(MediaCodecDecoderTest, VideoConfigureValidParams) {
// We have to prefetch decoder.
base::TimeDelta duration = base::TimeDelta::FromMilliseconds(500);
- SetDataFactory(scoped_ptr<VideoFactory>(new VideoFactory(duration)));
+ SetDataFactory(base::WrapUnique(new VideoFactory(duration)));
decoder_->Prefetch(base::Bind(&MediaCodecDecoderTest::SetPrefetched,
base::Unretained(this), true));
@@ -491,7 +493,7 @@ TEST_F(MediaCodecDecoderTest, AudioStartWithoutConfigure) {
// Do the prefetch.
base::TimeDelta duration = base::TimeDelta::FromMilliseconds(500);
- SetDataFactory(scoped_ptr<AudioFactory>(new AudioFactory(duration)));
+ SetDataFactory(base::WrapUnique(new AudioFactory(duration)));
// Prefetch to avoid starvation at the beginning of playback.
decoder_->Prefetch(base::Bind(&MediaCodecDecoderTest::SetPrefetched,
@@ -515,7 +517,7 @@ TEST_F(MediaCodecDecoderTest, DISABLED_AudioPlayTillCompletion) {
base::TimeDelta duration = base::TimeDelta::FromMilliseconds(500);
base::TimeDelta timeout = base::TimeDelta::FromMilliseconds(1500);
- SetDataFactory(scoped_ptr<AudioFactory>(new AudioFactory(duration)));
+ SetDataFactory(base::WrapUnique(new AudioFactory(duration)));
// Prefetch to avoid starvation at the beginning of playback.
decoder_->Prefetch(base::Bind(&MediaCodecDecoderTest::SetPrefetched,
@@ -557,7 +559,7 @@ TEST_F(MediaCodecDecoderTest, VideoPlayTillCompletion) {
// the codec does initial configuration at this time. We increase the timeout
// to leave a room of 1 second for this initial configuration.
base::TimeDelta timeout = base::TimeDelta::FromMilliseconds(1500);
- SetDataFactory(scoped_ptr<VideoFactory>(new VideoFactory(duration)));
+ SetDataFactory(base::WrapUnique(new VideoFactory(duration)));
// Prefetch
decoder_->Prefetch(base::Bind(&MediaCodecDecoderTest::SetPrefetched,
@@ -595,7 +597,7 @@ TEST_F(MediaCodecDecoderTest, VideoStopAndResume) {
base::TimeDelta stop_request_time = base::TimeDelta::FromMilliseconds(200);
base::TimeDelta timeout = base::TimeDelta::FromMilliseconds(1000);
- SetDataFactory(scoped_ptr<VideoFactory>(new VideoFactory(duration)));
+ SetDataFactory(base::WrapUnique(new VideoFactory(duration)));
// Prefetch
decoder_->Prefetch(base::Bind(&MediaCodecDecoderTest::SetPrefetched,
@@ -666,7 +668,7 @@ TEST_F(MediaCodecDecoderTest, DISABLED_AudioStarvationAndStop) {
AudioFactory* factory = new AudioFactory(duration);
factory->SetStarvationMode(true);
- SetDataFactory(scoped_ptr<AudioFactory>(factory));
+ SetDataFactory(base::WrapUnique(factory));
// Prefetch.
decoder_->Prefetch(base::Bind(&MediaCodecDecoderTest::SetPrefetched,
@@ -713,7 +715,7 @@ TEST_F(MediaCodecDecoderTest, VideoFirstUnitIsReconfig) {
base::TimeDelta duration = base::TimeDelta::FromMilliseconds(200);
base::TimeDelta timeout = base::TimeDelta::FromMilliseconds(1000);
- SetDataFactory(scoped_ptr<VideoFactory>(new VideoFactory(duration)));
+ SetDataFactory(base::WrapUnique(new VideoFactory(duration)));
// Ask factory to produce initial configuration unit. The configuraton will
// be factory.GetConfigs().

Powered by Google App Engine
This is Rietveld 408576698