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

Side by Side Diff: media/base/android/media_codec_decoder_unittest.cc

Issue 1551103002: Convert Pass()→std::move() in //media (Android Cast edition) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | media/base/android/media_codec_player.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <utility>
6
5 #include "base/bind.h" 7 #include "base/bind.h"
6 #include "base/logging.h" 8 #include "base/logging.h"
7 #include "base/macros.h" 9 #include "base/macros.h"
8 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
9 #include "base/timer/timer.h" 11 #include "base/timer/timer.h"
10 #include "media/base/android/media_codec_audio_decoder.h" 12 #include "media/base/android/media_codec_audio_decoder.h"
11 #include "media/base/android/media_codec_util.h" 13 #include "media/base/android/media_codec_util.h"
12 #include "media/base/android/media_codec_video_decoder.h" 14 #include "media/base/android/media_codec_video_decoder.h"
13 #include "media/base/android/media_statistics.h" 15 #include "media/base/android/media_statistics.h"
14 #include "media/base/android/sdk_media_codec_bridge.h" 16 #include "media/base/android/sdk_media_codec_bridge.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 typedef base::Callback<bool()> Predicate; 151 typedef base::Callback<bool()> Predicate;
150 152
151 typedef base::Callback<void(const DemuxerData&)> DataAvailableCallback; 153 typedef base::Callback<void(const DemuxerData&)> DataAvailableCallback;
152 154
153 // Waits for condition to become true or for timeout to expire. 155 // Waits for condition to become true or for timeout to expire.
154 // Returns true if the condition becomes true. 156 // Returns true if the condition becomes true.
155 bool WaitForCondition(const Predicate& condition, 157 bool WaitForCondition(const Predicate& condition,
156 const base::TimeDelta& timeout = kDefaultTimeout); 158 const base::TimeDelta& timeout = kDefaultTimeout);
157 159
158 void SetDataFactory(scoped_ptr<TestDataFactory> factory) { 160 void SetDataFactory(scoped_ptr<TestDataFactory> factory) {
159 data_factory_ = factory.Pass(); 161 data_factory_ = std::move(factory);
160 } 162 }
161 163
162 DemuxerConfigs GetConfigs() const { 164 DemuxerConfigs GetConfigs() const {
163 // ASSERT_NE does not compile here because it expects void return value. 165 // ASSERT_NE does not compile here because it expects void return value.
164 EXPECT_NE(nullptr, data_factory_.get()); 166 EXPECT_NE(nullptr, data_factory_.get());
165 return data_factory_->GetConfigs(); 167 return data_factory_->GetConfigs();
166 } 168 }
167 169
168 void CreateAudioDecoder(); 170 void CreateAudioDecoder();
169 void CreateVideoDecoder(); 171 void CreateVideoDecoder();
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 task_runner_->PostDelayedTask(FROM_HERE, base::Bind(data_available_cb_, data), 315 task_runner_->PostDelayedTask(FROM_HERE, base::Bind(data_available_cb_, data),
314 delay); 316 delay);
315 } 317 }
316 318
317 void MediaCodecDecoderTest::SetVideoSurface() { 319 void MediaCodecDecoderTest::SetVideoSurface() {
318 surface_texture_ = gfx::SurfaceTexture::Create(0); 320 surface_texture_ = gfx::SurfaceTexture::Create(0);
319 gfx::ScopedJavaSurface surface(surface_texture_.get()); 321 gfx::ScopedJavaSurface surface(surface_texture_.get());
320 ASSERT_NE(nullptr, decoder_.get()); 322 ASSERT_NE(nullptr, decoder_.get());
321 MediaCodecVideoDecoder* video_decoder = 323 MediaCodecVideoDecoder* video_decoder =
322 static_cast<MediaCodecVideoDecoder*>(decoder_.get()); 324 static_cast<MediaCodecVideoDecoder*>(decoder_.get());
323 video_decoder->SetVideoSurface(surface.Pass()); 325 video_decoder->SetVideoSurface(std::move(surface));
324 } 326 }
325 327
326 TEST_F(MediaCodecDecoderTest, AudioPrefetch) { 328 TEST_F(MediaCodecDecoderTest, AudioPrefetch) {
327 CreateAudioDecoder(); 329 CreateAudioDecoder();
328 330
329 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(500); 331 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(500);
330 SetDataFactory(scoped_ptr<TestDataFactory>(new AudioFactory(duration))); 332 SetDataFactory(scoped_ptr<TestDataFactory>(new AudioFactory(duration)));
331 333
332 decoder_->Prefetch(base::Bind(&MediaCodecDecoderTest::SetPrefetched, 334 decoder_->Prefetch(base::Bind(&MediaCodecDecoderTest::SetPrefetched,
333 base::Unretained(this), true)); 335 base::Unretained(this), true));
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 // Prepare the surface. 441 // Prepare the surface.
440 scoped_refptr<gfx::SurfaceTexture> surface_texture( 442 scoped_refptr<gfx::SurfaceTexture> surface_texture(
441 gfx::SurfaceTexture::Create(0)); 443 gfx::SurfaceTexture::Create(0));
442 gfx::ScopedJavaSurface surface(surface_texture.get()); 444 gfx::ScopedJavaSurface surface(surface_texture.get());
443 445
444 // Release the surface texture. 446 // Release the surface texture.
445 surface_texture = NULL; 447 surface_texture = NULL;
446 448
447 MediaCodecVideoDecoder* video_decoder = 449 MediaCodecVideoDecoder* video_decoder =
448 static_cast<MediaCodecVideoDecoder*>(decoder_.get()); 450 static_cast<MediaCodecVideoDecoder*>(decoder_.get());
449 video_decoder->SetVideoSurface(surface.Pass()); 451 video_decoder->SetVideoSurface(std::move(surface));
450 452
451 EXPECT_EQ(MediaCodecDecoder::kConfigFailure, decoder_->Configure(nullptr)); 453 EXPECT_EQ(MediaCodecDecoder::kConfigFailure, decoder_->Configure(nullptr));
452 } 454 }
453 455
454 TEST_F(MediaCodecDecoderTest, VideoConfigureValidParams) { 456 TEST_F(MediaCodecDecoderTest, VideoConfigureValidParams) {
455 SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); 457 SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE();
456 458
457 CreateVideoDecoder(); 459 CreateVideoDecoder();
458 460
459 // decoder_->Configure() searches back for the key frame. 461 // decoder_->Configure() searches back for the key frame.
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 752
751 EXPECT_TRUE(decoder_->IsStopped()); 753 EXPECT_TRUE(decoder_->IsStopped());
752 EXPECT_TRUE(decoder_->IsCompleted()); 754 EXPECT_TRUE(decoder_->IsCompleted());
753 EXPECT_EQ(data_factory_->last_pts(), pts_stat_.max()); 755 EXPECT_EQ(data_factory_->last_pts(), pts_stat_.max());
754 756
755 // Check that the reported video size is the one from the in-stream configs. 757 // Check that the reported video size is the one from the in-stream configs.
756 EXPECT_EQ(data_factory_->GetConfigs().video_size, video_size_); 758 EXPECT_EQ(data_factory_->GetConfigs().video_size, video_size_);
757 } 759 }
758 760
759 } // namespace media 761 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/base/android/media_codec_player.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698