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

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

Issue 1998723002: Move code in ui/gl/* from gfx:: to gl:: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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
« no previous file with comments | « media/base/android/media_codec_player.cc ('k') | media/base/android/media_player_android.h » ('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 "media/base/android/media_codec_player.h" 5 #include "media/base/android/media_codec_player.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 const char* test_name); 588 const char* test_name);
589 589
590 // Callback sent when demuxer is being deleted. 590 // Callback sent when demuxer is being deleted.
591 void OnDemuxerDeleted() { demuxer_ = nullptr; } 591 void OnDemuxerDeleted() { demuxer_ = nullptr; }
592 592
593 bool IsDemuxerDeleted() const { return !demuxer_; } 593 bool IsDemuxerDeleted() const { return !demuxer_; }
594 594
595 base::MessageLoop message_loop_; 595 base::MessageLoop message_loop_;
596 MockMediaPlayerManager manager_; 596 MockMediaPlayerManager manager_;
597 MockDemuxerAndroid* demuxer_; // owned by player_ 597 MockDemuxerAndroid* demuxer_; // owned by player_
598 scoped_refptr<gfx::SurfaceTexture> surface_texture_a_; 598 scoped_refptr<gl::SurfaceTexture> surface_texture_a_;
599 scoped_refptr<gfx::SurfaceTexture> surface_texture_b_; 599 scoped_refptr<gl::SurfaceTexture> surface_texture_b_;
600 MediaCodecPlayer* player_; // raw pointer due to DeleteOnCorrectThread() 600 MediaCodecPlayer* player_; // raw pointer due to DeleteOnCorrectThread()
601 601
602 private: 602 private:
603 bool is_timeout_expired() const { return is_timeout_expired_; } 603 bool is_timeout_expired() const { return is_timeout_expired_; }
604 void SetTimeoutExpired(bool value) { is_timeout_expired_ = value; } 604 void SetTimeoutExpired(bool value) { is_timeout_expired_ = value; }
605 605
606 bool is_timeout_expired_; 606 bool is_timeout_expired_;
607 607
608 DISALLOW_COPY_AND_ASSIGN(MediaCodecPlayerTest); 608 DISALLOW_COPY_AND_ASSIGN(MediaCodecPlayerTest);
609 }; 609 };
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 0, // player_id 645 0, // player_id
646 manager_.GetWeakPtr(), 646 manager_.GetWeakPtr(),
647 base::Bind(&MockMediaPlayerManager::OnMediaResourcesRequested, 647 base::Bind(&MockMediaPlayerManager::OnMediaResourcesRequested,
648 base::Unretained(&manager_)), 648 base::Unretained(&manager_)),
649 base::WrapUnique(demuxer_), GURL(), kDefaultMediaSessionId); 649 base::WrapUnique(demuxer_), GURL(), kDefaultMediaSessionId);
650 650
651 DCHECK(player_); 651 DCHECK(player_);
652 } 652 }
653 653
654 void MediaCodecPlayerTest::SetVideoSurface() { 654 void MediaCodecPlayerTest::SetVideoSurface() {
655 surface_texture_a_ = gfx::SurfaceTexture::Create(0); 655 surface_texture_a_ = gl::SurfaceTexture::Create(0);
656 gfx::ScopedJavaSurface surface(surface_texture_a_.get()); 656 gl::ScopedJavaSurface surface(surface_texture_a_.get());
657 657
658 ASSERT_NE(nullptr, player_); 658 ASSERT_NE(nullptr, player_);
659 player_->SetVideoSurface(std::move(surface)); 659 player_->SetVideoSurface(std::move(surface));
660 } 660 }
661 661
662 void MediaCodecPlayerTest::SetVideoSurfaceB() { 662 void MediaCodecPlayerTest::SetVideoSurfaceB() {
663 surface_texture_b_ = gfx::SurfaceTexture::Create(1); 663 surface_texture_b_ = gl::SurfaceTexture::Create(1);
664 gfx::ScopedJavaSurface surface(surface_texture_b_.get()); 664 gl::ScopedJavaSurface surface(surface_texture_b_.get());
665 665
666 ASSERT_NE(nullptr, player_); 666 ASSERT_NE(nullptr, player_);
667 player_->SetVideoSurface(std::move(surface)); 667 player_->SetVideoSurface(std::move(surface));
668 } 668 }
669 669
670 void MediaCodecPlayerTest::RemoveVideoSurface() { 670 void MediaCodecPlayerTest::RemoveVideoSurface() {
671 player_->SetVideoSurface(gfx::ScopedJavaSurface()); 671 player_->SetVideoSurface(gl::ScopedJavaSurface());
672 surface_texture_a_ = NULL; 672 surface_texture_a_ = NULL;
673 } 673 }
674 674
675 bool MediaCodecPlayerTest::WaitForCondition(const Predicate& condition, 675 bool MediaCodecPlayerTest::WaitForCondition(const Predicate& condition,
676 const base::TimeDelta& timeout) { 676 const base::TimeDelta& timeout) {
677 // Let the message_loop_ process events. 677 // Let the message_loop_ process events.
678 // We start the timer and RunUntilIdle() until it signals. 678 // We start the timer and RunUntilIdle() until it signals.
679 679
680 SetTimeoutExpired(false); 680 SetTimeoutExpired(false);
681 681
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after
2268 // TODO(timav): maybe we should not call the testing callback for 2268 // TODO(timav): maybe we should not call the testing callback for
2269 // kRenderAfterPreroll for video (for audio we already do not call). 2269 // kRenderAfterPreroll for video (for audio we already do not call).
2270 // EXPECT_TRUE(AlmostEqual(manager_.FirstFrameTime(DemuxerStream::AUDIO), 2270 // EXPECT_TRUE(AlmostEqual(manager_.FirstFrameTime(DemuxerStream::AUDIO),
2271 // manager_.FirstFrameTime(DemuxerStream::VIDEO), 50)); 2271 // manager_.FirstFrameTime(DemuxerStream::VIDEO), 50));
2272 2272
2273 // The playback should start at |seek_position| 2273 // The playback should start at |seek_position|
2274 EXPECT_TRUE(AlmostEqual(seek_position, manager_.pts_stat_.min(), 25)); 2274 EXPECT_TRUE(AlmostEqual(seek_position, manager_.pts_stat_.min(), 25));
2275 } 2275 }
2276 2276
2277 } // namespace media 2277 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_codec_player.cc ('k') | media/base/android/media_player_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698