#include "third_party/blink/renderer/modules/webcodecs/video_encoder.h"
#include "base/run_loop.h"
#include "media/base/mock_filters.h"
#include "media/video/video_encoder_info.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/renderer/bindings/core/v8/script_function.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_tester.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_union_cssimagevalue_htmlcanvaselement_htmlimageelement_htmlvideoelement_imagebitmap_offscreencanvas_svgimageelement_videoframe.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_video_encoder_config.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_video_encoder_encode_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_video_encoder_init.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_video_frame_init.h"
#include "third_party/blink/renderer/core/html/canvas/image_data.h"
#include "third_party/blink/renderer/core/imagebitmap/image_bitmap.h"
#include "third_party/blink/renderer/core/testing/mock_function_scope.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h"
#include "third_party/blink/renderer/modules/webcodecs/codec_pressure_manager.h"
#include "third_party/blink/renderer/modules/webcodecs/codec_pressure_manager_provider.h"
#include "third_party/blink/renderer/modules/webcodecs/video_encoder.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
namespace blink {
namespace {
_;
ByMove;
DoAll;
Invoke;
Return;
SaveArg;
WithArgs;
ACTION_P(RunClosure, closure) { … }
class MockVideoEncoder : public VideoEncoder { … };
class VideoEncoderTest : public testing::Test { … };
constexpr gfx::Size kEncodeSize(80, 60);
VideoEncoderConfig* CreateConfig() { … }
VideoEncoder* CreateEncoder(ScriptState* script_state,
const VideoEncoderInit* init,
ExceptionState& exception_state) { … }
MockVideoEncoder* CreateMockEncoder(ScriptState* script_state,
VideoEncoderInit* init,
ExceptionState& exception_state) { … }
VideoEncoderInit* CreateInit(ScriptFunction* output_callback,
ScriptFunction* error_callback) { … }
VideoFrame* MakeVideoFrame(ScriptState* script_state,
int width,
int height,
int timestamp) { … }
TEST_F(VideoEncoderTest, RejectFlushAfterClose) { … }
TEST_F(VideoEncoderTest, CodecReclamation) { … }
TEST_F(
VideoEncoderTest,
ConfigureAndEncode_CallVideoEncoderMetricsProviderInitializeAndIncrementEncodedFrameCount) { … }
TEST_F(VideoEncoderTest,
ConfigureTwice_CallVideoEncoderMetricsProviderInitializeTwice) { … }
TEST_F(VideoEncoderTest,
InitializeFailure_CallVideoEncoderMetricsProviderSetError) { … }
TEST_F(VideoEncoderTest, NoAvailableMediaVideoEncoder) { … }
}
}