Chromium Code Reviews| 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 7374063682c2b39043d376f5720fad56e43c878d..dd1523791f0a67e6f57b43abde48f3a4fa2d8303 100644 |
| --- a/media/gpu/android_video_decode_accelerator_unittest.cc |
| +++ b/media/gpu/android_video_decode_accelerator_unittest.cc |
| @@ -234,9 +234,9 @@ class FakeCodecAllocator : public NiceMock<AVDACodecAllocator> { |
| // Surface chooser that calls mocked functions to allow counting calls, but |
| // also records arguments. Note that gmock can't mock out unique_ptrs |
| // anyway, so we can't mock AndroidVideoSurfaceChooser directly. |
| -class FakeOverlayHelper : public NiceMock<AndroidVideoSurfaceChooser> { |
| +class FakeOverlayChooser : public NiceMock<AndroidVideoSurfaceChooser> { |
| public: |
| - FakeOverlayHelper() : weak_factory_(this) {} |
| + FakeOverlayChooser() : weak_factory_(this) {} |
| // These are called by the real functions. You may set expectations on |
| // them if you like. |
| @@ -245,15 +245,14 @@ class FakeOverlayHelper : public NiceMock<AndroidVideoSurfaceChooser> { |
| // We guarantee that we'll only clear this during destruction, so that you |
| // may treat it as "pointer that lasts as long as |this| does". |
| - base::WeakPtr<FakeOverlayHelper> GetWeakPtrForTesting() { |
| + base::WeakPtr<FakeOverlayChooser> GetWeakPtrForTesting() { |
| return weak_factory_.GetWeakPtr(); |
| } |
| - void Initialize( |
| - UseOverlayCB use_overlay_cb, |
| - UseSurfaceTextureCB use_surface_texture_cb, |
| - StopUsingOverlayImmediatelyCB stop_immediately_cb, |
| - std::unique_ptr<AndroidOverlayFactory> initial_factory) override { |
| + 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); |
| @@ -262,8 +261,7 @@ class FakeOverlayHelper : public NiceMock<AndroidVideoSurfaceChooser> { |
| stop_immediately_cb_ = std::move(stop_immediately_cb); |
| } |
| - void ReplaceOverlayFactory( |
| - std::unique_ptr<AndroidOverlayFactory> factory) override { |
| + void ReplaceOverlayFactory(AndroidOverlayFactoryCB factory) override { |
| MockReplaceOverlayFactory(); |
| factory_ = std::move(factory); |
| } |
| @@ -288,12 +286,12 @@ class FakeOverlayHelper : public NiceMock<AndroidVideoSurfaceChooser> { |
| UseSurfaceTextureCB use_surface_texture_cb_; |
| StopUsingOverlayImmediatelyCB stop_immediately_cb_; |
| - std::unique_ptr<AndroidOverlayFactory> factory_; |
| + AndroidOverlayFactoryCB factory_; |
| - base::WeakPtrFactory<FakeOverlayHelper> weak_factory_; |
| + base::WeakPtrFactory<FakeOverlayChooser> weak_factory_; |
| private: |
| - DISALLOW_COPY_AND_ASSIGN(FakeOverlayHelper); |
| + DISALLOW_COPY_AND_ASSIGN(FakeOverlayChooser); |
| }; |
| } // namespace |
| @@ -318,7 +316,7 @@ class AndroidVideoDecodeAcceleratorTest : public testing::Test { |
| gl::GLContextAttribs()); |
| context_->MakeCurrent(surface_.get()); |
| - chooser_that_is_usually_null_ = base::MakeUnique<FakeOverlayHelper>(); |
| + chooser_that_is_usually_null_ = base::MakeUnique<FakeOverlayChooser>(); |
| chooser_ = chooser_that_is_usually_null_->GetWeakPtrForTesting(); |
| platform_config_.sdk_int = base::android::SDK_VERSION_MARSHMALLOW; |
| @@ -350,7 +348,7 @@ class AndroidVideoDecodeAcceleratorTest : public testing::Test { |
| config_.surface_id = 123; |
| ASSERT_TRUE(InitializeAVDA()); |
| base::RunLoop().RunUntilIdle(); |
| - ASSERT_TRUE(chooser_->factory_ != nullptr); |
| + ASSERT_TRUE(!chooser_->factory_.is_null()); |
|
tguilbert
2017/05/04 21:52:05
NIT: ASSERT_FALSE?
liberato (no reviews please)
2017/05/05 16:50:23
after removing the is_null, it turns back into ASS
|
| // Have the factory provide an overlay, and verify that codec creation is |
| // provided with that overlay. |
| @@ -371,7 +369,7 @@ class AndroidVideoDecodeAcceleratorTest : public testing::Test { |
| ASSERT_TRUE(InitializeAVDA()); |
| base::RunLoop().RunUntilIdle(); |
| // We do not expect a factory, since we are using SurfaceTexture. |
| - ASSERT_TRUE(chooser_->factory_ == nullptr); |
| + ASSERT_TRUE(chooser_->factory_.is_null()); |
|
tguilbert
2017/05/04 21:52:05
NIT: base::Callback has an explicit bool operator.
liberato (no reviews please)
2017/05/05 16:50:23
Done. i also turned this one into ASSERT_FALSE.
|
| // Set the expectations first, since ProvideOverlay might cause callbacks. |
| EXPECT_CALL(codec_allocator_, |
| @@ -413,7 +411,7 @@ class AndroidVideoDecodeAcceleratorTest : public testing::Test { |
| AndroidVideoDecodeAccelerator::PlatformConfig platform_config_; |
| // We maintain a weak ref to this since AVDA owns it. |
| - base::WeakPtr<FakeOverlayHelper> chooser_; |
| + base::WeakPtr<FakeOverlayChooser> chooser_; |
| // This must be a unique pointer to a VDA, not an AVDA, to ensure the |
| // the default_delete specialization that calls Destroy() will be used. |
| @@ -426,7 +424,7 @@ class AndroidVideoDecodeAcceleratorTest : public testing::Test { |
| private: |
| // This is the object that |chooser_| points to, or nullptr once we assign |
| // ownership to AVDA. |
| - std::unique_ptr<FakeOverlayHelper> chooser_that_is_usually_null_; |
| + std::unique_ptr<FakeOverlayChooser> chooser_that_is_usually_null_; |
| }; |
| TEST_F(AndroidVideoDecodeAcceleratorTest, ConfigureUnsupportedCodec) { |