#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "content/browser/media/capture/frame_sink_video_capture_device.h"
#include <memory>
#include "base/containers/flat_map.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/shared_memory_mapping.h"
#include "build/chromeos_buildflags.h"
#include "components/viz/common/surfaces/region_capture_bounds.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_utils.h"
#include "media/base/video_frame.h"
#include "media/capture/video/video_frame_receiver.h"
#include "media/capture/video_capture_types.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 "services/viz/privileged/mojom/compositing/frame_sink_video_capture.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/native_widget_types.h"
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chromeos/lacros/lacros_test_helper.h"
#endif
_;
ByRef;
Eq;
Expectation;
Ge;
NiceMock;
NotNull;
SaveArg;
Sequence;
StrNe;
namespace content {
namespace {
#define DCHECK_ON_DEVICE_THREAD() …
#define DCHECK_NOT_ON_DEVICE_THREAD() …
#define RUN_UI_TASKS() …
#define POST_DEVICE_TASK(closure) …
#define WAIT_FOR_DEVICE_TASKS() …
constexpr gfx::Size kResolution = …;
constexpr int kMaxFrameRate = …;
constexpr base::TimeDelta kMinCapturePeriod = …;
constexpr media::VideoPixelFormat kFormat = …;
constexpr bool kNotPremapped = …;
media::VideoCaptureParams GetCaptureParams() { … }
class MockFrameSinkVideoCapturer : public viz::mojom::FrameSinkVideoCapturer { … };
class MockFrameSinkVideoConsumerFrameCallbacks
: public viz::mojom::FrameSinkVideoConsumerFrameCallbacks { … };
class MockVideoFrameReceiver : public media::VideoFrameReceiver { … };
class FrameSinkVideoCaptureDeviceForTest : public FrameSinkVideoCaptureDevice { … };
#define POST_DEVICE_METHOD_CALL0(method) …
#define POST_DEVICE_METHOD_CALL(method, ...) …
class FrameSinkVideoCaptureDeviceTest : public testing::Test { … };
TEST_F(FrameSinkVideoCaptureDeviceTest, CapturesAndDeliversFrames) { … }
TEST_F(FrameSinkVideoCaptureDeviceTest, SuspendsAndResumes) { … }
TEST_F(FrameSinkVideoCaptureDeviceTest, ShutsDownOnFatalError) { … }
}
}