#include "absl/types/optional.h"
#include "base/at_exit.h"
+#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "base/threading/thread.h"
#include "base/tizen/global_resource_manager.h"
#include "base/tizen/provider_callbacks_helper.h"
#include "base/tizen/resource_manager.h"
+#include "media/base/test_data_util.h"
#include "media/base/test_helpers.h"
#include "media/filters/tizen/decoder_promotion.h"
#include "media/filters/tizen/media_video_codec.h"
TTvdVideoDecoderTestInitialize,
testing::ValuesIn(kPartialViewTests));
+TEST_F(TTvdVideoDecoderTest, DecodeStatusIsErrorWhenNullFacade) {
+ FakeResourceManager fake_resource_manager;
+ SetGlobalResourceManagerForTesting(&fake_resource_manager);
+ DecoderPromotion* decoder_promotion = DecoderPromotion::GetInstance();
+ decoder_promotion->SetResourceManagerForTesting(&fake_resource_manager);
+
+ base::test::TaskEnvironment task_environment{
+ base::test::TaskEnvironment::MainThreadType::IO};
+
+ base::Thread gpu_thread("gpu_thread");
+ ASSERT_TRUE(gpu_thread.StartAndWaitForTesting());
+
+ gpu::GpuDriverBugWorkarounds gpu_workarounds;
+
+ TTvdVideoDecoder video_decoder(
+ base::BindRepeating(
+ [](scoped_refptr<base::SingleThreadTaskRunner> task_runner)
+ -> scoped_refptr<CommandBufferHelper> {
+ return base::MakeRefCounted<FakeCommandBufferHelper>(task_runner);
+ },
+ gpu_thread.task_runner()),
+ gpu_thread.task_runner(),
+ base::BindRepeating(
+ [](const gpu::GpuDriverBugWorkarounds*)
+ -> std::unique_ptr<DecoderFacadeVideo> { return nullptr; }),
+ gpu_workarounds);
+
+ VideoDecoderConfig config = TestVideoConfig::NormalH264();
+ config.set_is_rtc(true);
+
+ constexpr const bool kLowLatency = true;
+ CdmContext* kNullCdmContextLowLatency = nullptr;
+
+ {
+ base::RunLoop run_loop;
+ video_decoder.Initialize(
+ config, kLowLatency, kNullCdmContextLowLatency,
+ base::BindOnce(
+ [](base::RunLoop* run_loop, DecoderStatus status) {
+ EXPECT_TRUE(status.is_ok());
+ run_loop->Quit();
+ },
+ &run_loop),
+ base::DoNothing(), base::DoNothing());
+ run_loop.Run();
+ }
+
+ {
+ auto buffer = ReadTestDataFile("h264-320x180-frame-0");
+ base::RunLoop run_loop;
+ base::MockCallback<VideoDecoder::DecodeCB> mock_decode_cb;
+ EXPECT_CALL(mock_decode_cb,
+ Run(DecoderStatus{DecoderStatus::Codes::kPlatformDecodeFailure}))
+ .WillOnce([&]() { run_loop.Quit(); });
+ video_decoder.Decode(buffer, mock_decode_cb.Get());
+ run_loop.Run();
+ }
+
+ gpu_thread.FlushForTesting();
+}
+
} // namespace media