#include "components/paint_preview/player/player_compositor_delegate.h"
#include <utility>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "base/unguessable_token.h"
#include "components/memory_pressure/fake_memory_pressure_monitor.h"
#include "components/paint_preview/browser/directory_key.h"
#include "components/paint_preview/browser/file_manager.h"
#include "components/paint_preview/browser/paint_preview_base_service.h"
#include "components/paint_preview/common/proto/paint_preview.pb.h"
#include "components/paint_preview/common/version.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/rect.h"
#include "url/gurl.h"
namespace paint_preview {
namespace {
constexpr std::array<size_t,
PlayerCompositorDelegate::PressureLevelCount::kLevels>
kMaxParallelRequests = …;
constexpr float kDefaultScaleFactor = …;
class FakePaintPreviewCompositorClient : public PaintPreviewCompositorClient { … };
class FakePaintPreviewCompositorService : public PaintPreviewCompositorService { … };
FakePaintPreviewCompositorClient* AsFakeClient(
PaintPreviewCompositorClient* client) { … }
FakePaintPreviewCompositorService* AsFakeService(
PaintPreviewCompositorService* service) { … }
class PlayerCompositorDelegateImpl : public PlayerCompositorDelegate { … };
}
class PlayerCompositorDelegateTest : public testing::Test { … };
TEST_F(PlayerCompositorDelegateTest, OnClick) { … }
TEST_F(PlayerCompositorDelegateTest, BadProto) { … }
TEST_F(PlayerCompositorDelegateTest, OldVersion) { … }
TEST_F(PlayerCompositorDelegateTest, InMemoryProto) { … }
TEST_F(PlayerCompositorDelegateTest, URLMismatch) { … }
TEST_F(PlayerCompositorDelegateTest, ServiceDisconnect) { … }
TEST_F(PlayerCompositorDelegateTest, ClientDisconnect) { … }
TEST_F(PlayerCompositorDelegateTest, InvalidCompositeRequest) { … }
TEST_F(PlayerCompositorDelegateTest, CompositorDeserializationError) { … }
TEST_F(PlayerCompositorDelegateTest, InvalidRootSkp) { … }
TEST_F(PlayerCompositorDelegateTest, CompressOnClose) { … }
TEST_F(PlayerCompositorDelegateTest, RequestBitmapWithCancel) { … }
TEST_F(PlayerCompositorDelegateTest, RequestBitmapWithCancelAll) { … }
TEST_F(PlayerCompositorDelegateTest, RequestBitmapSuccessQueued) { … }
TEST_F(PlayerCompositorDelegateTest, RequestMainFrameBitmapSuccess) { … }
TEST_F(PlayerCompositorDelegateTest, Timeout) { … }
TEST_F(PlayerCompositorDelegateTest, CriticalMemoryPressure) { … }
TEST_F(PlayerCompositorDelegateTest, CriticalMemoryPressureBeforeStart) { … }
TEST_F(PlayerCompositorDelegateTest,
RequestBitmapSuccessQueuedWithPressureAbort) { … }
}