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

Unified Diff: media/gpu/android_video_decode_accelerator_unittest.cc

Issue 2883913003: Add multiple destruction callbacks to AndroidOverlay. (Closed)
Patch Set: rebased.... though i got not conflicts? Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/gpu/android_video_decode_accelerator.cc ('k') | media/gpu/android_video_surface_chooser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/android_video_decode_accelerator_unittest.cc
diff --git a/media/gpu/android_video_decode_accelerator_unittest.cc b/media/gpu/android_video_decode_accelerator_unittest.cc
index 58d77d99c6751d4b0c1f561a879e789c59108222..b61f7cde0222d723639aa54bdc95cacfcdf5d410 100644
--- a/media/gpu/android_video_decode_accelerator_unittest.cc
+++ b/media/gpu/android_video_decode_accelerator_unittest.cc
@@ -251,14 +251,12 @@ class FakeOverlayChooser : public NiceMock<AndroidVideoSurfaceChooser> {
void Initialize(UseOverlayCB use_overlay_cb,
UseSurfaceTextureCB use_surface_texture_cb,
- StopUsingOverlayImmediatelyCB stop_immediately_cb,
AndroidOverlayFactoryCB initial_factory) override {
MockInitialize();
factory_ = std::move(initial_factory);
use_overlay_cb_ = std::move(use_overlay_cb);
use_surface_texture_cb_ = std::move(use_surface_texture_cb);
- stop_immediately_cb_ = std::move(stop_immediately_cb);
}
void ReplaceOverlayFactory(AndroidOverlayFactoryCB factory) override {
@@ -277,14 +275,8 @@ class FakeOverlayChooser : public NiceMock<AndroidVideoSurfaceChooser> {
base::RunLoop().RunUntilIdle();
}
- void StopImmediately(AndroidOverlay* overlay) {
- stop_immediately_cb_.Run(overlay);
- base::RunLoop().RunUntilIdle();
- }
-
UseOverlayCB use_overlay_cb_;
UseSurfaceTextureCB use_surface_texture_cb_;
- StopUsingOverlayImmediatelyCB stop_immediately_cb_;
AndroidOverlayFactoryCB factory_;
@@ -354,6 +346,8 @@ class AndroidVideoDecodeAcceleratorTest : public testing::Test {
// provided with that overlay.
std::unique_ptr<MockAndroidOverlay> overlay =
base::MakeUnique<MockAndroidOverlay>();
+ overlay_callbacks_ = overlay->GetCallbacks();
+
// Set the expectations first, since ProvideOverlay might cause callbacks.
EXPECT_CALL(codec_allocator_,
MockCreateMediaCodecAsync(overlay.get(), nullptr));
@@ -410,6 +404,9 @@ class AndroidVideoDecodeAcceleratorTest : public testing::Test {
AndroidVideoDecodeAccelerator::PlatformConfig platform_config_;
+ // Set by InitializeAVDAWithOverlay()
+ MockAndroidOverlay::Callbacks overlay_callbacks_;
+
// We maintain a weak ref to this since AVDA owns it.
base::WeakPtr<FakeOverlayChooser> chooser_;
@@ -554,7 +551,8 @@ TEST_F(AndroidVideoDecodeAcceleratorTest,
EXPECT_CALL(*codec_allocator_.most_recent_codec(), SetSurface(_))
.WillOnce(Return(true));
codec_allocator_.codec_destruction_observer()->DestructionIsOptional();
- chooser_->StopImmediately(codec_allocator_.most_recent_overlay());
+ overlay_callbacks_.SurfaceDestroyed.Run();
+ base::RunLoop().RunUntilIdle();
EXPECT_CALL(codec_allocator_,
MockReleaseMediaCodec(codec_allocator_.most_recent_codec(),
@@ -671,7 +669,7 @@ TEST_F(AndroidVideoDecodeAcceleratorTest,
MockReleaseMediaCodec(codec_allocator_.most_recent_codec(),
codec_allocator_.most_recent_overlay(), nullptr));
codec_allocator_.codec_destruction_observer()->ExpectDestruction();
- chooser_->StopImmediately(codec_allocator_.most_recent_overlay());
+ overlay_callbacks_.SurfaceDestroyed.Run();
base::RunLoop().RunUntilIdle();
// Verify that the codec has been released, since |vda_| will be destroyed
« no previous file with comments | « media/gpu/android_video_decode_accelerator.cc ('k') | media/gpu/android_video_surface_chooser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698