#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <vector>
#include "base/memory/scoped_refptr.h"
#include "build/build_config.h"
#include "cc/paint/refcounted_buffer.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings_provider.h"
#include "third_party/blink/public/common/privacy_budget/identifiable_surface.h"
#include "third_party/blink/public/common/privacy_budget/identifiable_token.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_blob_callback.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_image_bitmap_options.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_image_data_settings.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_float32array_uint16array_uint8clampedarray.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_begin_layer_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_typedefs.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_union_blob_htmlcanvaselement_htmlimageelement_htmlvideoelement_imagebitmap_imagedata_offscreencanvas_svgimageelement_videoframe.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/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/html/canvas/canvas_context_creation_attributes_core.h"
#include "third_party/blink/renderer/core/html/canvas/canvas_performance_monitor.h"
#include "third_party/blink/renderer/core/html/canvas/canvas_rendering_context.h"
#include "third_party/blink/renderer/core/html/canvas/html_canvas_element.h"
#include "third_party/blink/renderer/core/html/canvas/image_data.h"
#include "third_party/blink/renderer/core/testing/page_test_base.h"
#include "third_party/blink/renderer/core/typed_arrays/array_buffer_view_helpers.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h"
#include "third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.h"
#include "third_party/blink/renderer/modules/canvas/canvas2d/canvas_style_test_utils.h"
#include "third_party/blink/renderer/modules/canvas/canvas2d/identifiability_study_helper.h"
#include "third_party/blink/renderer/modules/canvas/canvas2d/mesh_2d_index_buffer.h"
#include "third_party/blink/renderer/modules/canvas/canvas2d/mesh_2d_uv_buffer.h"
#include "third_party/blink/renderer/modules/canvas/canvas2d/mesh_2d_vertex_buffer.h"
#include "third_party/blink/renderer/modules/canvas/imagebitmap/image_bitmap_factories.h"
#include "third_party/blink/renderer/platform/bindings/exception_code.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/graphics/graphics_types.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
#include "third_party/skia/include/private/base/SkPoint_impl.h"
#include "v8/include/v8-context.h"
#include "v8/include/v8-local-handle.h"
namespace v8 {
class Isolate;
}
namespace blink {
class CanvasRenderingContext2DAPITest : public PageTestBase { … };
CanvasRenderingContext2DAPITest::CanvasRenderingContext2DAPITest() = default;
CanvasRenderingContext2D* CanvasRenderingContext2DAPITest::Context2D() const { … }
void CanvasRenderingContext2DAPITest::CreateContext(OpacityMode opacity_mode) { … }
void CanvasRenderingContext2DAPITest::SetUp() { … }
void CanvasRenderingContext2DAPITest::TearDown() { … }
TEST_F(CanvasRenderingContext2DAPITest, SetShadowColor_Clamping) { … }
String TrySettingStrokeStyle(CanvasRenderingContext2DAPITest* test,
const String& value) { … }
String TrySettingFillStyle(CanvasRenderingContext2DAPITest* test,
const String& value) { … }
String TrySettingShadowColor(CanvasRenderingContext2D* ctx,
const String& value) { … }
void TrySettingColor(CanvasRenderingContext2DAPITest* test,
const String& value,
const String& expected) { … }
TEST_F(CanvasRenderingContext2DAPITest, ColorSerialization) { … }
TEST_F(CanvasRenderingContext2DAPITest, DefaultAttributeValues) { … }
TEST_F(CanvasRenderingContext2DAPITest, LineDashStateSave) { … }
TEST_F(CanvasRenderingContext2DAPITest, CreateImageData) { … }
TEST_F(CanvasRenderingContext2DAPITest, CreateImageDataTooBig) { … }
TEST_F(CanvasRenderingContext2DAPITest, GetImageDataTooBig) { … }
TEST_F(CanvasRenderingContext2DAPITest,
GetImageDataIntegerOverflowNegativeParams) { … }
TEST_F(CanvasRenderingContext2DAPITest, UnclosedLayerCreateImageBitmap) { … }
TEST_F(CanvasRenderingContext2DAPITest, UnclosedLayerCreatePattern) { … }
TEST_F(CanvasRenderingContext2DAPITest, UnclosedLayerDrawImage) { … }
TEST_F(CanvasRenderingContext2DAPITest, UnclosedLayerGetImageData) { … }
TEST_F(CanvasRenderingContext2DAPITest, UnclosedLayerPutImageData) { … }
TEST_F(CanvasRenderingContext2DAPITest, UnclosedLayerToBlob) { … }
TEST_F(CanvasRenderingContext2DAPITest, UnclosedLayerToDataUrl) { … }
TEST_F(CanvasRenderingContext2DAPITest, UnclosedLayerDrawMesh) { … }
void ResetCanvasForAccessibilityRectTest(Document& document) { … }
class ActiveSettingsProvider : public IdentifiabilityStudySettingsProvider { … };
class StudyParticipationRaii { … };
TEST_F(CanvasRenderingContext2DAPITest, IdentifiabilityStudyMaxOperations) { … }
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN)
#define MAYBE_IdentifiabilityStudyDigest_Font …
#else
#define MAYBE_IdentifiabilityStudyDigest_Font …
#endif
TEST_F(CanvasRenderingContext2DAPITest, MAYBE_IdentifiabilityStudyDigest_Font) { … }
TEST_F(CanvasRenderingContext2DAPITest, IdentifiabilityStudyDisabled) { … }
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN)
#define MAYBE_IdentifiabilityStudyDigest_StrokeText …
#else
#define MAYBE_IdentifiabilityStudyDigest_StrokeText …
#endif
TEST_F(CanvasRenderingContext2DAPITest,
MAYBE_IdentifiabilityStudyDigest_StrokeText) { … }
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN)
#define MAYBE_IdentifiabilityStudyDigest_FillText …
#else
#define MAYBE_IdentifiabilityStudyDigest_FillText …
#endif
TEST_F(CanvasRenderingContext2DAPITest,
MAYBE_IdentifiabilityStudyDigest_FillText) { … }
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN)
#define MAYBE_IdentifiabilityStudyDigest_TextAlign …
#else
#define MAYBE_IdentifiabilityStudyDigest_TextAlign …
#endif
TEST_F(CanvasRenderingContext2DAPITest,
MAYBE_IdentifiabilityStudyDigest_TextAlign) { … }
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN)
#define MAYBE_IdentifiabilityStudyDigest_TextBaseline …
#else
#define MAYBE_IdentifiabilityStudyDigest_TextBaseline …
#endif
TEST_F(CanvasRenderingContext2DAPITest,
MAYBE_IdentifiabilityStudyDigest_TextBaseline) { … }
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN)
#define MAYBE_IdentifiabilityStudyDigest_StrokeStyle …
#else
#define MAYBE_IdentifiabilityStudyDigest_StrokeStyle …
#endif
TEST_F(CanvasRenderingContext2DAPITest,
MAYBE_IdentifiabilityStudyDigest_StrokeStyle) { … }
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN)
#define MAYBE_IdentifiabilityStudyDigest_FillStyle …
#else
#define MAYBE_IdentifiabilityStudyDigest_FillStyle …
#endif
TEST_F(CanvasRenderingContext2DAPITest,
MAYBE_IdentifiabilityStudyDigest_FillStyle) { … }
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN)
#define MAYBE_IdentifiabilityStudyDigest_Combo …
#else
#define MAYBE_IdentifiabilityStudyDigest_Combo …
#endif
TEST_F(CanvasRenderingContext2DAPITest,
MAYBE_IdentifiabilityStudyDigest_Combo) { … }
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN)
#define MAYBE_IdentifiabilityStudyDigest_putImageData …
#else
#define MAYBE_IdentifiabilityStudyDigest_putImageData …
#endif
TEST_F(CanvasRenderingContext2DAPITest,
MAYBE_IdentifiabilityStudyDigest_putImageData) { … }
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN)
#define MAYBE_IdentifiabilityStudyDigest_drawImage …
#else
#define MAYBE_IdentifiabilityStudyDigest_drawImage …
#endif
TEST_F(CanvasRenderingContext2DAPITest,
MAYBE_IdentifiabilityStudyDigest_drawImage) { … }
ElementsAre;
IsNull;
Pointee;
MATCHER_P(Mesh2dBufferIs, matcher, "") { … }
NotShared<DOMFloat32Array> CreateFloat32Array(std::vector<float> array) { … }
NotShared<DOMUint16Array> CreateUint16Array(std::vector<uint16_t> array) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DVertexBuffer0Floats) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DVertexBuffer1Float) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DVertexBuffer2Floats) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DVertexBuffer3Floats) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DVertexBuffer4Floats) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DUVBuffer0Floats) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DUVBuffer1Float) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DUVBuffer2Floats) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DUVBuffer3Floats) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DUVBuffer4Floats) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DIndexBuffer0Uints) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DIndexBuffer1Uint) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DIndexBuffer2Uints) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DUVBuffer3Uints) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DIndexBuffer4Uints) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DIndexBuffer5Uints) { … }
TEST_F(CanvasRenderingContext2DAPITest, Mesh2DUVBuffer6Uints) { … }
TEST_F(CanvasRenderingContext2DAPITest, DrawMesh) { … }
}