#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/mojo/clients/mojo_stable_video_decoder.h"
#include <sys/mman.h>
#include "base/posix/eintr_wrapper.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "media/base/decoder.h"
#include "media/base/media_util.h"
#include "media/base/supported_video_decoder_config.h"
#include "media/base/video_decoder_config.h"
#include "media/base/video_frame.h"
#include "media/gpu/chromeos/oop_video_decoder.h"
#include "media/mojo/common/media_type_converters.h"
#include "media/mojo/common/mojo_decoder_buffer_converter.h"
#include "media/mojo/mojom/stable/stable_video_decoder.mojom.h"
#include "media/video/mock_gpu_video_accelerator_factories.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/gpu_fence.h"
_;
InSequence;
Matcher;
Mock;
Return;
StrictMock;
WithArgs;
namespace media {
namespace {
std::vector<SupportedVideoDecoderConfig> CreateListOfSupportedConfigs() { … }
VideoDecoderConfig CreateValidSupportedVideoDecoderConfig() { … }
VideoDecoderConfig CreateValidUnsupportedVideoDecoderConfig() { … }
stable::mojom::VideoFramePtr CreateTestNV12DecodedFrame(
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
base::TimeDelta timestamp) { … }
void AssertSharedImageInfoIsValidForNV12Frame(
const gpu::SharedImageInfo& actual,
const gfx::Rect& expected_visible_rect,
const gfx::ColorSpace& expected_color_space,
bool* result) { … }
MATCHER_P2(IsValidSharedImageInfoForNV12Frame,
expected_visible_rect,
expected_color_space,
"") { … }
void AssertNV12NativeGpuMemoryBufferHandleIsValid(
const gfx::GpuMemoryBufferHandle& actual,
const gfx::Size& coded_size,
bool* result) { … }
MATCHER_P(IsValidNV12NativeGpuMemoryBufferHandle, coded_size, "") { … }
class MockVideoFrameHandleReleaser
: public stable::mojom::VideoFrameHandleReleaser { … };
class MockStableVideoDecoderService : public stable::mojom::StableVideoDecoder { … };
}
class MockSharedImageInterface : public gpu::SharedImageInterface { … };
namespace {
class TestEndpoints { … };
}
class MojoStableVideoDecoderTest : public testing::Test { … };
TEST_F(MojoStableVideoDecoderTest,
InitializeWithSupportedConfigConstructsStableVideoDecoder) { … }
TEST_F(MojoStableVideoDecoderTest,
InitializeWithUnsupportedConfigDoesNotConstructStableVideoDecoder) { … }
TEST_F(MojoStableVideoDecoderTest,
TwoInitializationsWithSupportedConfigsConstructStableVideoDecoderOnce) { … }
TEST_F(MojoStableVideoDecoderTest, Decode) { … }
TEST_F(MojoStableVideoDecoderTest, Reset) { … }
}