#include "third_party/blink/renderer/platform/graphics/canvas_hibernation_handler.h"
#include <list>
#include "base/task/single_thread_task_runner.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "components/viz/test/test_context_provider.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.h"
#include "third_party/blink/renderer/platform/graphics/static_bitmap_image.h"
#include "third_party/blink/renderer/platform/graphics/test/fake_canvas_resource_host.h"
#include "third_party/blink/renderer/platform/graphics/test/gpu_memory_buffer_test_platform.h"
#include "third_party/blink/renderer/platform/graphics/test/gpu_test_utils.h"
#include "third_party/blink/renderer/platform/scheduler/public/main_thread_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
namespace blink {
Test;
class CanvasHibernationHandlerTest
: public testing::TestWithParam<
CanvasHibernationHandler::CompressionAlgorithm> { … };
namespace {
void SetPageVisible(
FakeCanvasResourceHost* host,
Canvas2DLayerBridge* bridge,
ScopedTestingPlatformSupport<GpuMemoryBufferTestPlatform>& platform,
bool page_visible) { … }
std::map<std::string, uint64_t> GetEntries(
const base::trace_event::MemoryAllocatorDump& dump) { … }
void DrawSomething(Canvas2DLayerBridge* bridge) { … }
class TestSingleThreadTaskRunner : public base::SingleThreadTaskRunner { … };
}
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(CanvasHibernationHandlerTest, SimpleTest) { … }
TEST_P(CanvasHibernationHandlerTest, ForegroundTooEarly) { … }
TEST_P(CanvasHibernationHandlerTest, BackgroundForeground) { … }
TEST_P(CanvasHibernationHandlerTest, ForegroundAfterEncoding) { … }
TEST_P(CanvasHibernationHandlerTest, ForegroundFlipForAfterEncoding) { … }
TEST_P(CanvasHibernationHandlerTest, ForegroundFlipForBeforeEncoding) { … }
TEST_P(CanvasHibernationHandlerTest, CanvasSnapshottedInBackground) { … }
TEST_P(CanvasHibernationHandlerTest, CanvasWriteInBackground) { … }
TEST_P(CanvasHibernationHandlerTest, CanvasWriteWhileCompressing) { … }
TEST_P(CanvasHibernationHandlerTest, HibernationMemoryMetrics) { … }
}